]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] http: ensure we abort data transfer on write error
authorWilly Tarreau <w@1wt.eu>
Sat, 2 Jan 2010 22:58:04 +0000 (23:58 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 2 Jan 2010 23:00:45 +0000 (00:00 +0100)
When a write error is encountered during a data phase, we must
absolutely abort the pending data transfer, otherwise it will
never complete.

src/proto_http.c

index fd266730f2f4d275acf8b1ffba8ab5ebe6be3278..33a45e89d873cc200d535bf594e55f6376923953 100644 (file)
@@ -3244,6 +3244,11 @@ int http_request_forward_body(struct session *s, struct buffer *req, int an_bit)
        struct http_txn *txn = &s->txn;
        struct http_msg *msg = &s->txn.req;
 
+       if (req->flags & (BF_SHUTW|BF_WRITE_ERROR|BF_WRITE_TIMEOUT)) {
+               req->analysers &= ~an_bit;
+               return 1;
+       }
+
        if (unlikely(msg->msg_state < HTTP_MSG_BODY))
                return 0;
 
@@ -4347,6 +4352,11 @@ int http_response_forward_body(struct session *s, struct buffer *res, int an_bit
        struct http_txn *txn = &s->txn;
        struct http_msg *msg = &s->txn.rsp;
 
+       if (res->flags & (BF_SHUTW|BF_WRITE_ERROR|BF_WRITE_TIMEOUT)) {
+               res->analysers &= ~an_bit;
+               return 1;
+       }
+
        if (unlikely(msg->msg_state < HTTP_MSG_BODY))
                return 0;