diff --git a/http/client.go b/http/client.go index c688e5565..a8a5106d6 100644 --- a/http/client.go +++ b/http/client.go @@ -1115,6 +1115,7 @@ func (c *InternalClient) SendMessage(ctx context.Context, uri *pilosa.URI, msg [ req.Header.Set("Content-Type", "application/x-protobuf") req.Header.Set("User-Agent", "pilosa/"+pilosa.Version) req.Header.Set("Accept", "application/json") + req.Header.Set("Connection", "keep-alive") // Execute request. resp, err := c.executeRequest(req.WithContext(ctx)) @@ -1232,6 +1233,7 @@ func (c *InternalClient) TranslateIDsNode(ctx context.Context, uri *pilosa.URI, // is closed. func (c *InternalClient) executeRequest(req *http.Request) (*http.Response, error) { tracing.GlobalTracer.InjectHTTPHeaders(req) + req.Close = false resp, err := c.httpClient.Do(req) if err != nil { if resp != nil { diff --git a/http/handler.go b/http/handler.go index 584791d75..68bb384ce 100644 --- a/http/handler.go +++ b/http/handler.go @@ -1590,7 +1590,7 @@ func (h *Handler) handlePostClusterMessage(w http.ResponseWriter, r *http.Reques http.Error(w, "Unsupported media type", http.StatusUnsupportedMediaType) return } - + defer r.Body.Close() err := h.api.ClusterMessage(r.Context(), r.Body) if err != nil { // TODO this was the previous behavior, but perhaps not everything is a bad request