]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] http redirect: use proper call to return last response
authorWilly Tarreau <w@1wt.eu>
Thu, 7 Jan 2010 23:26:50 +0000 (00:26 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 7 Jan 2010 23:36:57 +0000 (00:36 +0100)
During a redirect, we used to send the last chunk of response with
stream_int_cond_close(). But this is wrong in case of pipeline,
because if the response already contains something, this function
will refrain from touching the buffer. Use a concatenation function
instead.

Also, this call might still fail when the buffer is full, we need
a second fix to refrain from parsing an HTTP request as long as the
response buffer is full, otherwise we may not even be able to return
a pending redirect or an error code.

src/proto_http.c

index a3354207acad904490a6ab26ce26142b1b376086..915abc244429cc896128972ae7ce5bbd02e0126a 100644 (file)
@@ -2855,7 +2855,8 @@ int http_process_req_common(struct session *s, struct buffer *req, int an_bit, s
                                /* keep-alive not possible */
                                memcpy(rdr.str + rdr.len, "\r\nConnection: close\r\n\r\n", 23);
                                rdr.len += 23;
-                               stream_int_cond_close(req->prod, &rdr);
+                               buffer_write(req->prod->ob, rdr.str, rdr.len);
+                               stream_int_cond_close(req->prod, NULL);
                                goto return_prx_cond;
                        }
                }