]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] http: take a capture of truncated responses
authorWilly Tarreau <w@1wt.eu>
Fri, 2 Sep 2011 18:16:24 +0000 (20:16 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 4 Sep 2011 22:54:56 +0000 (00:54 +0200)
If a server starts to respond but stops before the body, then we
capture the truncated response. We don't do this on the request
because it would happen too often upon stupid attacks.

src/proto_http.c

index 7f37002cd22e08be71d7fb3c8d0c6732c11899f1..439e1cee09375d2fbb627da0402cfdd1e3cc2654 100644 (file)
@@ -4815,9 +4815,9 @@ int http_wait_for_response(struct session *s, struct buffer *rep, int an_bit)
                        return 0;
                }
 
-               /* close from server */
+               /* close from server, capture the response if the server has started to respond */
                else if (rep->flags & BF_SHUTR) {
-                       if (msg->err_pos >= 0)
+                       if (msg->msg_state >= HTTP_MSG_RPVER || msg->err_pos >= 0)
                                http_capture_bad_message(&s->be->invalid_rep, s, rep, msg, msg->msg_state, s->fe);
 
                        s->be->be_counters.failed_resp++;