]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: http-ana: Report SF_FINST_R flag on error waiting the request body
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 13 Jan 2023 09:49:31 +0000 (10:49 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 13 Jan 2023 09:49:37 +0000 (10:49 +0100)
When we wait for the request body, we are still in the request analysis. So
a SF_FINST_R flag must be reported in logs. Even if some data are already
received, at this staged, nothing is sent to the server.

This patch could be backported in all stable versions.

reg-tests/http-messaging/http_request_buffer.vtc
src/http_ana.c

index e9a90c58f158b0eeea0927007c36ab38994b5430..15ec5404542a2998c97f1596c27f514c440223ff 100644 (file)
@@ -24,7 +24,7 @@ server s1 {
 
 syslog S -level info {
        recv
-       expect ~ "[^:\\[ ]*\\[[0-9]*\\]: .* .* fe1 fe1/<NOSRV> .* 408 .* - - cD-- .* .* \"GET /this-is-a-long-url-this-is-a-long-url-this-is-a-long-url-this-is-a-long-url-this-is-a-long-url-this-is-a-long-url-this-is-a-long-url HTTP/1\\.1\""
+       expect ~ "[^:\\[ ]*\\[[0-9]*\\]: .* .* fe1 fe1/<NOSRV> .* 408 .* - - cR-- .* .* \"GET /this-is-a-long-url-this-is-a-long-url-this-is-a-long-url-this-is-a-long-url-this-is-a-long-url-this-is-a-long-url-this-is-a-long-url HTTP/1\\.1\""
        barrier b1 sync
 
        recv
index edd635daf34891fe017f704c50e5981bcbbc23ac..8c32b7a2a932ce5f5b571f897c963fa1ffb4a012 100644 (file)
@@ -891,9 +891,8 @@ int http_wait_for_request_body(struct stream *s, struct channel *req, int an_bit
 {
        struct session *sess = s->sess;
        struct http_txn *txn = s->txn;
-       struct http_msg *msg = &s->txn->req;
 
-       DBG_TRACE_ENTER(STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA, s, txn, msg);
+       DBG_TRACE_ENTER(STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA, s, txn, &s->txn->req);
 
 
        switch (http_wait_for_msg_body(s, req, s->be->timeout.httpreq, 0)) {
@@ -951,7 +950,7 @@ int http_wait_for_request_body(struct stream *s, struct channel *req, int an_bit
        if (!(s->flags & SF_ERR_MASK))
                s->flags |= SF_ERR_PRXCOND;
        if (!(s->flags & SF_FINST_MASK))
-               s->flags |= (msg->msg_state < HTTP_MSG_DATA ? SF_FINST_R : SF_FINST_D);
+               s->flags |= SF_FINST_R;
 
        req->analysers &= AN_REQ_FLT_END;
        req->analyse_exp = TICK_ETERNITY;
@@ -4229,7 +4228,7 @@ enum rule_result http_wait_for_msg_body(struct stream *s, struct channel *chn,
        if (!(s->flags & SF_ERR_MASK))
                s->flags |= SF_ERR_CLITO;
        if (!(s->flags & SF_FINST_MASK))
-               s->flags |= SF_FINST_D;
+               s->flags |= SF_FINST_R;
        _HA_ATOMIC_INC(&sess->fe->fe_counters.failed_req);
        if (sess->listener && sess->listener->counters)
                _HA_ATOMIC_INC(&sess->listener->counters->failed_req);
@@ -4242,7 +4241,7 @@ enum rule_result http_wait_for_msg_body(struct stream *s, struct channel *chn,
        if (!(s->flags & SF_ERR_MASK))
                s->flags |= SF_ERR_SRVTO;
        if (!(s->flags & SF_FINST_MASK))
-               s->flags |= SF_FINST_D;
+               s->flags |= SF_FINST_R;
        stream_inc_http_fail_ctr(s);
        http_reply_and_close(s, txn->status, http_error_message(s));
        ret = HTTP_RULE_RES_ABRT;