]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] http: report correct flags in case of client aborts during body
authorWilly Tarreau <w@1wt.eu>
Mon, 7 Jun 2010 11:47:49 +0000 (13:47 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 7 Jun 2010 20:43:54 +0000 (22:43 +0200)
Some client abort/timeouts during body transfer were reported as "PR--"
instead of "CD--" or "cD--". This fix has to be ported to 1.5.

src/proto_http.c

index 32fa17c9aae31565f2f2bb0ad1b11ad05ed102c8..1362cf3131a5d7d6c668a5038c2bd5e084e2e762 100644 (file)
@@ -3603,6 +3603,11 @@ int http_process_request_body(struct session *s, struct buffer *req, int an_bit)
        if ((req->flags & BF_READ_TIMEOUT) || tick_is_expired(req->analyse_exp, now_ms)) {
                txn->status = 408;
                stream_int_retnclose(req->prod, error_message(s, HTTP_ERR_408));
+
+               if (!(s->flags & SN_ERR_MASK))
+                       s->flags |= SN_ERR_CLITO;
+               if (!(s->flags & SN_FINST_MASK))
+                       s->flags |= SN_FINST_D;
                goto return_err_msg;
        }
 
@@ -3632,16 +3637,16 @@ int http_process_request_body(struct session *s, struct buffer *req, int an_bit)
        txn->status = 400;
        stream_int_retnclose(req->prod, error_message(s, HTTP_ERR_400));
 
+       if (!(s->flags & SN_ERR_MASK))
+               s->flags |= SN_ERR_PRXCOND;
+       if (!(s->flags & SN_FINST_MASK))
+               s->flags |= SN_FINST_R;
+
  return_err_msg:
        req->analysers = 0;
        s->fe->counters.failed_req++;
        if (s->listener->counters)
                s->listener->counters->failed_req++;
-
-       if (!(s->flags & SN_ERR_MASK))
-               s->flags |= SN_ERR_PRXCOND;
-       if (!(s->flags & SN_FINST_MASK))
-               s->flags |= SN_FINST_R;
        return 0;
 }
 
@@ -4220,12 +4225,22 @@ int http_request_forward_body(struct session *s, struct buffer *req, int an_bit)
 
  missing_data:
        /* stop waiting for data if the input is closed before the end */
-       if (req->flags & BF_SHUTR)
+       if (req->flags & BF_SHUTR) {
+               if (!(s->flags & SN_ERR_MASK))
+                       s->flags |= SN_ERR_CLICL;
+               if (!(s->flags & SN_FINST_MASK))
+                       s->flags |= SN_FINST_D;
                goto return_bad_req;
+       }
 
        /* waiting for the last bits to leave the buffer */
-       if (req->flags & BF_SHUTW)
+       if (req->flags & BF_SHUTW) {
+               if (!(s->flags & SN_ERR_MASK))
+                       s->flags |= SN_ERR_SRVCL;
+               if (!(s->flags & SN_FINST_MASK))
+                       s->flags |= SN_FINST_D;
                goto return_bad_req;
+       }
 
        http_silent_debug(__LINE__, s);
        return 0;