Remove body from POST request in webhook (#5067)

When webhook notification is configured, Minio server tries to lookup the
webhook endpoint by making a POST request with body set as releasetag.
We can remove the body from the POST request as the POST body does not
add any specific value.

This discussion on IETF group says empty POSTs are okay
http://lists.w3.org/Archives/Public/ietf-http-wg/2010JulSep/0272.html

Fixes: https://github.com/minio/minio/issues/5066
master
Nitish Tiwari 7 years ago committed by GitHub
parent 45463b1d6b
commit ad53c5d859
  1. 9
      cmd/notify-webhook.go

@ -91,10 +91,9 @@ func isNetErrorIgnored(err error) bool {
}
// Lookup endpoint address by successfully POSTting
// a JSON which would send out minio release.
// empty body.
func lookupEndpoint(urlStr string) error {
minioRelease := bytes.NewReader([]byte(ReleaseTag))
req, err := http.NewRequest("POST", urlStr, minioRelease)
req, err := http.NewRequest("POST", urlStr, bytes.NewReader([]byte("")))
if err != nil {
return err
}
@ -107,8 +106,8 @@ func lookupEndpoint(urlStr string) error {
},
}
// Set content-type.
req.Header.Set("Content-Type", "application/json")
// Set content-length to zero as there is no payload.
req.ContentLength = 0
// Set proper server user-agent.
req.Header.Set("User-Agent", globalServerUserAgent)

Loading…
Cancel
Save