From: Willy Tarreau Date: Tue, 2 Apr 2013 22:22:25 +0000 (+0200) Subject: BUG/MAJOR: http: fix regression introduced by commit d655ffe X-Git-Tag: v1.5-dev18~30 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2d43e18b6927b73aa9b1e6c8a40fc5b235498a5f;p=thirdparty%2Fhaproxy.git BUG/MAJOR: http: fix regression introduced by commit d655ffe Sander Klein reported that since last snapshot, some downloads would hang from nginx but succeed from apache. The culprit was not too hard to find given the low number of recent changes affecting the data path. Commit d655ffe slightly reorganized the HTTP state machine and introduced this regression. The reason is that we must never jump into the MSG_DONE case without first flushing remaining data because this is not done anymore afterwards. This part is scheduled for being reorganized since it's totally ugly especially since we added compression, and this regression is an illustration of its readability. The issue is entirely dependant on the server close sequence, which explains why it was reproducible only with nginx here. --- diff --git a/src/proto_http.c b/src/proto_http.c index 311268f1be..f4502bfe13 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -5936,7 +5936,10 @@ int http_response_forward_body(struct session *s, struct channel *res, int an_bi channel_forward(res, msg->next); msg->next = 0; } - /* we're in HTTP_MSG_DONE now, fall through */ + /* we're in HTTP_MSG_DONE now, but we might still have + * some data pending, so let's loop over once. + */ + break; default: /* other states, DONE...TUNNEL */