From 709e6fa6decf0914d7d5fdf97ac103ba7fbd5051 Mon Sep 17 00:00:00 2001 From: WeebDataHoarder <57538841+WeebDataHoarder@users.noreply.github.com> Date: Tue, 7 Jun 2022 01:11:52 +0200 Subject: [PATCH] Use GetHost() method --- FinalCommander.go | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/FinalCommander.go b/FinalCommander.go index 2d058c9..e0b86a3 100644 --- a/FinalCommander.go +++ b/FinalCommander.go @@ -237,12 +237,12 @@ func handleHexHash(pathElements []string, ctx httputils.RequestContext, host str } func handle(ctx httputils.RequestContext) { - if len(ctx.GetRequestHeader("Host")) > 0 && ctx.GetRequestHeader("Host") != ctx.GetTLSServerName() { //Prevents rebinding / DNS stuff + if len(ctx.GetHost()) > 0 && strings.Split(ctx.GetHost(), ":")[0] != ctx.GetTLSServerName() { //Prevents rebinding / DNS stuff ctx.SetResponseCode(http.StatusNotFound) return } - host := ctx.GetRequestHeader("Host") + host := ctx.GetHost() if host == "" && ctx.GetTLSServerName() != "" { host = ctx.GetTLSServerName() + redirectListenAddress } diff --git a/go.mod b/go.mod index 742afab..76dda80 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module git.gammaspectra.live/S.O.N.G/FinalCommander go 1.18 require ( - git.gammaspectra.live/S.O.N.G/MakyuuIchaival v0.0.0-20220606212530-4821aa05b5d6 + git.gammaspectra.live/S.O.N.G/MakyuuIchaival v0.0.0-20220606230857-517eb1652a49 github.com/cloudflare/circl v1.1.0 github.com/dgraph-io/badger/v3 v3.2103.2 github.com/ipfs/go-cid v0.2.0 diff --git a/go.sum b/go.sum index 8a5e006..b617d82 100644 --- a/go.sum +++ b/go.sum @@ -7,8 +7,8 @@ dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBr dmitri.shuralyov.com/service/change v0.0.0-20181023043359-a85b471d5412/go.mod h1:a1inKt/atXimZ4Mv927x+r7UpyzRUf4emIoiiSC2TN4= dmitri.shuralyov.com/state v0.0.0-20180228185332-28bcc343414c/go.mod h1:0PRwlb0D6DFvNNtx+9ybjezNCa8XF0xaYcETyp6rHWU= git.apache.org/thrift.git v0.0.0-20180902110319-2566ecd5d999/go.mod h1:fPE2ZNJGynbRyZ4dJvy6G277gSllfV2HJqblrnkyeyg= -git.gammaspectra.live/S.O.N.G/MakyuuIchaival v0.0.0-20220606212530-4821aa05b5d6 h1:eTAOxKCXiEsP8v47OL9S/OAPWHH1KjXSAgsUIPeim7U= -git.gammaspectra.live/S.O.N.G/MakyuuIchaival v0.0.0-20220606212530-4821aa05b5d6/go.mod h1:eWzPxHEC8uYNigoSqsjUOsML8cGScgwhVs5dY3HDinM= +git.gammaspectra.live/S.O.N.G/MakyuuIchaival v0.0.0-20220606230857-517eb1652a49 h1:zbbwuNcl7WBk8YLXVB/L+XM5O/Em87t20GdiHV4kWck= +git.gammaspectra.live/S.O.N.G/MakyuuIchaival v0.0.0-20220606230857-517eb1652a49/go.mod h1:eWzPxHEC8uYNigoSqsjUOsML8cGScgwhVs5dY3HDinM= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=