From: Willy Tarreau Date: Sun, 3 Jan 2010 11:24:37 +0000 (+0100) Subject: [BUG] http: redirects were broken by chunk changes X-Git-Tag: v1.4-dev5~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3bb9c23bd61b68b56cf667a1870f03b3af3e122a;p=thirdparty%2Fhaproxy.git [BUG] http: redirects were broken by chunk changes Redirects used to initialize a chunk whose size was not set (0). Also, the return code of chunk_strcpy() is 1 in case of success. --- diff --git a/src/proto_http.c b/src/proto_http.c index 5cc0f23e02..e1c4414b02 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -2702,7 +2702,7 @@ int http_process_req_common(struct session *s, struct buffer *req, int an_bit, s ret = !ret; if (ret) { - struct chunk rdr = { trash, 0 }; + struct chunk rdr = { .str = trash, .size = sizeof(trash), .len = 0 }; const char *msg_fmt; /* build redirect message */ @@ -2719,7 +2719,7 @@ int http_process_req_common(struct session *s, struct buffer *req, int an_bit, s break; } - if (unlikely(chunk_strcpy(&rdr, msg_fmt))) + if (unlikely(!chunk_strcpy(&rdr, msg_fmt))) goto return_bad_req; switch(rule->type) {