From: Willy Tarreau Date: Sat, 12 Feb 2011 12:07:35 +0000 (+0100) Subject: [BUG] http: update the header list's tail when removing the last header X-Git-Tag: v1.5-dev8~322 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5c4784f4b8f29da0301894cd0c2ee01cb983c375;p=thirdparty%2Fhaproxy.git [BUG] http: update the header list's tail when removing the last header Stefan Behte reported a strange case where depending on the position of the Connection header in the header list, some headers added after it were or were not usable in "balance hdr()". The reason is that when the last header is removed, the list's tail was not updated, so any header added after that one was not visible from the list. This fix must be backported to 1.4 and possibly 1.3. --- diff --git a/src/proto_http.c b/src/proto_http.c index c5debcaff5..dbd6a2e814 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -601,6 +601,8 @@ int http_remove_header2(struct http_msg *msg, struct buffer *buf, idx->used--; hdr->len = 0; /* unused entry */ idx->v[ctx->prev].next = idx->v[ctx->idx].next; + if (idx->tail == ctx->idx) + idx->tail = ctx->prev; ctx->idx = ctx->prev; /* walk back to the end of previous header */ ctx->line -= idx->v[ctx->idx].len + idx->v[cur_idx].cr + 1; ctx->val = idx->v[ctx->idx].len; /* point to end of previous header */