diff --git a/go.sum b/go.sum index e268df5..4fe38a6 100644 --- a/go.sum +++ b/go.sum @@ -105,6 +105,7 @@ github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= diff --git a/pkg/handler/post_test.go b/pkg/handler/post_test.go index 00ae801..e18baa2 100644 --- a/pkg/handler/post_test.go +++ b/pkg/handler/post_test.go @@ -310,11 +310,11 @@ func TestPost(t *testing.T) { "Upload-Length": "300", "X-Forwarded-Host": "bar.com", "X-Forwarded-Proto": "http", - "Forwarded": "proto=https,host=foo.com", + "Forwarded": "for=192.168.10.112;host=upload.example.tld;proto=https;proto-version=", }, Code: http.StatusCreated, ResHeader: map[string]string{ - "Location": "https://foo.com/files/foo", + "Location": "https://upload.example.tld/files/foo", }, }).Run(handler, t) }) diff --git a/pkg/handler/unrouted_handler.go b/pkg/handler/unrouted_handler.go index 138ef6c..3ff4b15 100644 --- a/pkg/handler/unrouted_handler.go +++ b/pkg/handler/unrouted_handler.go @@ -21,7 +21,7 @@ const UploadLengthDeferred = "1" var ( reExtractFileID = regexp.MustCompile(`([^/]+)\/?$`) - reForwardedHost = regexp.MustCompile(`host=([^,]+)`) + reForwardedHost = regexp.MustCompile(`host=([^;]+)`) reForwardedProto = regexp.MustCompile(`proto=(https?)`) reMimeType = regexp.MustCompile(`^[a-z]+\/[a-z0-9\-\+\.]+$`) )