From 0394a8f01307c4d82b8797b4b5d1fef1d34d2223 Mon Sep 17 00:00:00 2001 From: Krishna Srinivas <634494+krishnasrinivas@users.noreply.github.com> Date: Tue, 11 Jun 2019 21:04:52 -0700 Subject: [PATCH] Send Content-Length in the response headers (#7771) curl using http1.0 would hang sometimes when Content-Length is missing in response headers fixes #7661 --- cmd/api-response.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/api-response.go b/cmd/api-response.go index 7c50aab0a..3daea936e 100644 --- a/cmd/api-response.go +++ b/cmd/api-response.go @@ -22,6 +22,7 @@ import ( "net/http" "net/url" "path" + "strconv" "strings" "time" @@ -523,6 +524,7 @@ func writeResponse(w http.ResponseWriter, statusCode int, response []byte, mType if mType != mimeNone { w.Header().Set("Content-Type", string(mType)) } + w.Header().Set("Content-Length", strconv.Itoa(len(response))) w.WriteHeader(statusCode) if response != nil { w.Write(response)