]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: http: further cleanups of response forwarding function
authorWilly Tarreau <w@1wt.eu>
Mon, 21 Apr 2014 08:54:27 +0000 (10:54 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 22 Apr 2014 21:15:28 +0000 (23:15 +0200)
There is no reason for mixing compressing and non-compressing
code in the DATA state, they don't share anything. Better make
this clearer.

src/proto_http.c

index 8e0b0bf408a4bb5c11211404b3e81952edaccd8b..114efef89d9d96f99b2236438979f09ee5b2c53c 100644 (file)
@@ -6227,17 +6227,19 @@ int http_response_forward_body(struct session *s, struct channel *res, int an_bi
                                if (ret < 0)
                                        goto aborted_xfer;
 
-                               if (res->to_forward || msg->chunk_len) {
-                                       res->flags |= CF_WAKE_WRITE;
+                               if (msg->chunk_len) {
+                                       /* input empty or output full */
+                                       if (res->buf->i > msg->next)
+                                               res->flags |= CF_WAKE_WRITE;
                                        goto missing_data;
                                }
                        }
-
-                       if (msg->chunk_len > res->buf->i - msg->next) {
-                               res->flags |= CF_WAKE_WRITE;
-                               goto missing_data;
-                       }
                        else {
+                               if (msg->chunk_len > res->buf->i - msg->next) {
+                                       /* output full */
+                                       res->flags |= CF_WAKE_WRITE;
+                                       goto missing_data;
+                               }
                                msg->next += msg->chunk_len;
                                msg->chunk_len = 0;
                        }