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.
This commit is contained in:
Anis Elleuch 2021-09-04 17:07:24 +01:00 committed by GitHub
parent 1250312287
commit 42b1d92b2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -388,7 +388,7 @@ func gatewayHandleEnvVars() {
// shouldMeterRequest checks whether incoming request should be added to prometheus gateway metrics // shouldMeterRequest checks whether incoming request should be added to prometheus gateway metrics
func shouldMeterRequest(req *http.Request) bool { 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 // MetricsTransport is a custom wrapper around Transport to track metrics