From e4f7a702dc9f85bec35bfa159ad346a4f8b8ab65 Mon Sep 17 00:00:00 2001 From: Pavel Korotkov Date: Tue, 21 Jul 2020 11:35:30 +0300 Subject: [PATCH] Move auth HTTP header field regexp to a package level variable --- auth/center.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/auth/center.go b/auth/center.go index fc629a8..3579776 100644 --- a/auth/center.go +++ b/auth/center.go @@ -26,7 +26,7 @@ import ( "go.uber.org/zap" ) -const authorizationFieldPattern = `AWS4-HMAC-SHA256 Credential=(?P[^/]+)/(?P[^/]+)/(?P[^/]*)/(?P[^/]+)/aws4_request, SignedHeaders=(?P.*), Signature=(?P.*)` +var authorizationFieldRegexp = regexp.MustCompile(`AWS4-HMAC-SHA256 Credential=(?P[^/]+)/(?P[^/]+)/(?P[^/]*)/(?P[^/]+)/aws4_request, SignedHeaders=(?P.*), Signature=(?P.*)`) const emptyStringSHA256 = `e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855` @@ -54,7 +54,7 @@ func NewCenter(log *zap.Logger) *Center { zstdDecoder, _ := zstd.NewReader(nil) return &Center{ log: log, - submatcher: ®expSubmatcher{re: regexp.MustCompile(authorizationFieldPattern)}, + submatcher: ®expSubmatcher{re: authorizationFieldRegexp}, zstdEncoder: zstdEncoder, zstdDecoder: zstdDecoder, }