From: Willy Tarreau Date: Thu, 28 May 2015 15:23:54 +0000 (+0200) Subject: MEDIUM: http: no need to close the request on redirect if data was parsed X-Git-Tag: v1.6-dev2~76 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2de8a50918b9d66da74d27395adf5f9a0260a257;p=thirdparty%2Fhaproxy.git MEDIUM: http: no need to close the request on redirect if data was parsed There are two reasons for not keeping the client connection alive upon a redirect : - save the client from uploading all data - avoid keeping a connection alive if the redirect goes to another domain The first case should consider an exception when all the data from the client have been read already. This specifically happens on response redirects after a POST to a server. This is an easy situation to detect. It could later be improved to cover the cases where option http-buffer-request is used. --- diff --git a/src/proto_http.c b/src/proto_http.c index d331eb13e1..4d352f7638 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -4116,7 +4116,7 @@ static int http_apply_redirect_rule(struct redirect_rule *rule, struct stream *s if (*location == '/' && (req->flags & HTTP_MSGF_XFER_LEN) && - !(req->flags & HTTP_MSGF_TE_CHNK) && !req->body_len && + ((!(req->flags & HTTP_MSGF_TE_CHNK) && !req->body_len) || (req->msg_state == HTTP_MSG_DONE)) && ((txn->flags & TX_CON_WANT_MSK) == TX_CON_WANT_SCL || (txn->flags & TX_CON_WANT_MSK) == TX_CON_WANT_KAL)) { /* keep-alive possible */