From 2d43e18b6927b73aa9b1e6c8a40fc5b235498a5f Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 3 Apr 2013 00:22:25 +0200 Subject: [PATCH] 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. --- src/proto_http.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/proto_http.c b/src/proto_http.c index 311268f1b..f4502bfe1 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 */