1
0
Эх сурвалжийг харах

withmatt -> httpheaders of our own

Viktor Sokolov 2 сар өмнө
parent
commit
9262d701cc

+ 1 - 1
etag/etag.go

@@ -12,9 +12,9 @@ import (
 	"sync"
 
 	"github.com/imgproxy/imgproxy/v3/config"
+	"github.com/imgproxy/imgproxy/v3/httpheaders"
 	"github.com/imgproxy/imgproxy/v3/imagedata"
 	"github.com/imgproxy/imgproxy/v3/options"
-	"go.withmatt.com/httpheaders"
 )
 
 type eTagCalc struct {

+ 1 - 1
etag/etag_test.go

@@ -8,9 +8,9 @@ import (
 
 	"github.com/sirupsen/logrus"
 	"github.com/stretchr/testify/suite"
-	"go.withmatt.com/httpheaders"
 
 	"github.com/imgproxy/imgproxy/v3/config"
+	"github.com/imgproxy/imgproxy/v3/httpheaders"
 	"github.com/imgproxy/imgproxy/v3/imagedata"
 	"github.com/imgproxy/imgproxy/v3/options"
 )

+ 0 - 1
go.mod

@@ -205,7 +205,6 @@ require (
 	go.uber.org/atomic v1.11.0 // indirect
 	go.uber.org/multierr v1.11.0 // indirect
 	go.uber.org/zap v1.27.0 // indirect
-	go.withmatt.com/httpheaders v1.0.0 // indirect
 	go.yaml.in/yaml/v2 v2.4.2 // indirect
 	go.yaml.in/yaml/v3 v3.0.4 // indirect
 	golang.org/x/crypto v0.39.0 // indirect

+ 0 - 2
go.sum

@@ -560,8 +560,6 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
 go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
 go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
 go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
-go.withmatt.com/httpheaders v1.0.0 h1:xZhtLWyIWCd8FT3CvUBRQLhQpgZaMmHNfIIT0wwNc1A=
-go.withmatt.com/httpheaders v1.0.0/go.mod h1:bKAYNgm9s2ViHIoGOnMKo4F2zJXBdvpfGuSEJQYF8pQ=
 go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI=
 go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU=
 go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=

+ 64 - 0
httpheaders/headers.go

@@ -0,0 +1,64 @@
+// Inspired by https://github.com/mattrobenolt/go-httpheaders
+// Thanks, Matt Robenolt!
+package httpheaders
+
+const (
+	Accept                          = "Accept"
+	AcceptCharset                   = "Accept-Charset"
+	AcceptEncoding                  = "Accept-Encoding"
+	AcceptLanguage                  = "Accept-Language"
+	AcceptRanges                    = "Accept-Ranges"
+	AccessControlAllowCredentials   = "Access-Control-Allow-Credentials"
+	AccessControlAllowHeaders       = "Access-Control-Allow-Headers"
+	AccessControlAllowMethods       = "Access-Control-Allow-Methods"
+	AccessControlAllowOrigin        = "Access-Control-Allow-Origin"
+	AccessControlMaxAge             = "Access-Control-Max-Age"
+	Age                             = "Age"
+	AltSvc                          = "Alt-Svc"
+	Authorization                   = "Authorization"
+	CacheControl                    = "Cache-Control"
+	Connection                      = "Connection"
+	ContentDisposition              = "Content-Disposition"
+	ContentEncoding                 = "Content-Encoding"
+	ContentLanguage                 = "Content-Language"
+	ContentLength                   = "Content-Length"
+	ContentRange                    = "Content-Range"
+	ContentSecurityPolicy           = "Content-Security-Policy"
+	ContentSecurityPolicyReportOnly = "Content-Security-Policy-Report-Only"
+	ContentType                     = "Content-Type"
+	Cookie                          = "Cookie"
+	Date                            = "Date"
+	Dnt                             = "Dnt"
+	Etag                            = "Etag"
+	Expect                          = "Expect"
+	ExpectCt                        = "Expect-Ct"
+	Expires                         = "Expires"
+	Forwarded                       = "Forwarded"
+	Host                            = "Host"
+	IfMatch                         = "If-Match"
+	IfModifiedSince                 = "If-Modified-Since"
+	IfNoneMatch                     = "If-None-Match"
+	IfUnmodifiedSince               = "If-Unmodified-Since"
+	KeepAlive                       = "Keep-Alive"
+	LastModified                    = "Last-Modified"
+	Link                            = "Link"
+	Location                        = "Location"
+	Origin                          = "Origin"
+	Pragma                          = "Pragma"
+	Referer                         = "Referer"
+	RequestId                       = "Request-Id"
+	RetryAfter                      = "Retry-After"
+	Server                          = "Server"
+	SetCookie                       = "Set-Cookie"
+	StrictTransportSecurity         = "Strict-Transport-Security"
+	Upgrade                         = "Upgrade"
+	UserAgent                       = "User-Agent"
+	Vary                            = "Vary"
+	Via                             = "Via"
+	WwwAuthenticate                 = "Www-Authenticate"
+	XContentTypeOptions             = "X-Content-Type-Options"
+	XForwardedFor                   = "X-Forwarded-For"
+	XForwardedHost                  = "X-Forwarded-Host"
+	XForwardedProto                 = "X-Forwarded-Proto"
+	XFrameOptions                   = "X-Frame-Options"
+)

+ 1 - 1
imagefetcher/fetcher.go

@@ -8,9 +8,9 @@ import (
 	"time"
 
 	"github.com/imgproxy/imgproxy/v3/config"
+	"github.com/imgproxy/imgproxy/v3/httpheaders"
 	"github.com/imgproxy/imgproxy/v3/transport"
 	"github.com/imgproxy/imgproxy/v3/transport/common"
-	"go.withmatt.com/httpheaders"
 )
 
 const (

+ 1 - 1
imagefetcher/request.go

@@ -12,7 +12,7 @@ import (
 	"strings"
 	"time"
 
-	"go.withmatt.com/httpheaders"
+	"github.com/imgproxy/imgproxy/v3/httpheaders"
 )
 
 var (

+ 1 - 1
processing_handler.go

@@ -13,13 +13,13 @@ import (
 	"time"
 
 	log "github.com/sirupsen/logrus"
-	"go.withmatt.com/httpheaders"
 	"golang.org/x/sync/semaphore"
 
 	"github.com/imgproxy/imgproxy/v3/config"
 	"github.com/imgproxy/imgproxy/v3/cookies"
 	"github.com/imgproxy/imgproxy/v3/errorreport"
 	"github.com/imgproxy/imgproxy/v3/etag"
+	"github.com/imgproxy/imgproxy/v3/httpheaders"
 	"github.com/imgproxy/imgproxy/v3/ierrors"
 	"github.com/imgproxy/imgproxy/v3/imagedata"
 	"github.com/imgproxy/imgproxy/v3/imagefetcher"

+ 1 - 1
processing_handler_test.go

@@ -14,11 +14,11 @@ import (
 
 	"github.com/sirupsen/logrus"
 	"github.com/stretchr/testify/suite"
-	"go.withmatt.com/httpheaders"
 
 	"github.com/imgproxy/imgproxy/v3/config"
 	"github.com/imgproxy/imgproxy/v3/config/configurators"
 	"github.com/imgproxy/imgproxy/v3/etag"
+	"github.com/imgproxy/imgproxy/v3/httpheaders"
 	"github.com/imgproxy/imgproxy/v3/imagedata"
 	"github.com/imgproxy/imgproxy/v3/imagemeta"
 	"github.com/imgproxy/imgproxy/v3/imagetype"

+ 1 - 1
svg/svg_test.go

@@ -6,9 +6,9 @@ import (
 	"testing"
 
 	"github.com/stretchr/testify/suite"
-	"go.withmatt.com/httpheaders"
 
 	"github.com/imgproxy/imgproxy/v3/config"
+	"github.com/imgproxy/imgproxy/v3/httpheaders"
 	"github.com/imgproxy/imgproxy/v3/imagedata"
 	"github.com/imgproxy/imgproxy/v3/testutil"
 )