]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: http: deinitialize compression after a compression error
authorWilly Tarreau <w@1wt.eu>
Tue, 22 Apr 2014 19:22:06 +0000 (21:22 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 22 Apr 2014 21:15:28 +0000 (23:15 +0200)
If for some reason, the compression returns an error, the compression
is not deinitialized which also means that any pending data are not
flushed and could be lost, especially in the chunked-encoded case.
No backport is needed.

src/proto_http.c

index ff0a6620302c4968ae54bd6de487d86ba26f01cb..45ffd0013e50e9decf32411a77c01795ee7dca57 100644 (file)
@@ -6434,6 +6434,11 @@ int http_response_forward_body(struct session *s, struct channel *res, int an_bi
        return 0;
 
  aborted_xfer:
+       if (unlikely(compressing)) {
+               http_compression_buffer_end(s, &res->buf, &tmpbuf, msg->msg_state >= HTTP_MSG_TRAILERS);
+               compressing = 0;
+       }
+
        txn->rsp.msg_state = HTTP_MSG_ERROR;
        /* don't send any error message as we're in the body */
        stream_int_retnclose(res->cons, NULL);