]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MAJOR: http: fix regression introduced by commit d655ffe
authorWilly Tarreau <w@1wt.eu>
Tue, 2 Apr 2013 22:22:25 +0000 (00:22 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 2 Apr 2013 22:22:25 +0000 (00:22 +0200)
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

index 311268f1be8c9aa2f819eb479627593730f3dc46..f4502bfe139ea70c4e80c262a701fb338faaad9d 100644 (file)
@@ -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 */