From 42b1d92b2a967759d6022ec488aafbc92109f566 Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Sat, 4 Sep 2021 17:07:24 +0100 Subject: [PATCH] azure: Fix crash after using ParseForm() for query param lookups (#13147) Azure storage SDK uses http.Request feature which panics when the request contains r.Form popuplated. Azure gateway code creates a new request, however it modifies the transport to add our metrics code which sets Request.Form during shouldMeterRequest() call. This commit simplifies shouldMeterRequest() to avoid setting request.Form and avoid the crash. --- cmd/gateway-common.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/gateway-common.go b/cmd/gateway-common.go index d10bda345..09356721a 100644 --- a/cmd/gateway-common.go +++ b/cmd/gateway-common.go @@ -388,7 +388,7 @@ func gatewayHandleEnvVars() { // shouldMeterRequest checks whether incoming request should be added to prometheus gateway metrics func shouldMeterRequest(req *http.Request) bool { - return !(guessIsBrowserReq(req) || guessIsHealthCheckReq(req) || guessIsMetricsReq(req)) + return req.URL != nil && !strings.HasPrefix(req.URL.Path, minioReservedBucketPath+slashSeparator) } // MetricsTransport is a custom wrapper around Transport to track metrics