mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-08 18:23:15 +00:00
BUG/MINOR: http: compression should consider all Accept-Encoding header values
Right now commit 82fe75c1
came with a minor bug limiting the check to the first
accept-encoding header value only.
This commit is contained in:
parent
7e488d781c
commit
3c7b97b9f9
@ -1976,6 +1976,7 @@ int select_compression_request_header(struct session *s, struct buffer *req)
|
|||||||
struct http_txn *txn = &s->txn;
|
struct http_txn *txn = &s->txn;
|
||||||
struct hdr_ctx ctx;
|
struct hdr_ctx ctx;
|
||||||
struct comp_algo *comp_algo = NULL;
|
struct comp_algo *comp_algo = NULL;
|
||||||
|
struct comp_algo *comp_algo_back = NULL;
|
||||||
|
|
||||||
/* Disable compression for older user agents announcing themselves as "Mozilla/4".
|
/* Disable compression for older user agents announcing themselves as "Mozilla/4".
|
||||||
* Note all of them are broken but they are very few and the broken ones are there.
|
* Note all of them are broken but they are very few and the broken ones are there.
|
||||||
@ -1999,10 +2000,10 @@ int select_compression_request_header(struct session *s, struct buffer *req)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* search for the algo in the backend in priority or the frontend */
|
/* search for the algo in the backend in priority or the frontend */
|
||||||
if ((s->be->comp && (comp_algo = s->be->comp->algos)) || (s->fe->comp && (comp_algo = s->fe->comp->algos))) {
|
if ((s->be->comp && (comp_algo_back = s->be->comp->algos)) || (s->fe->comp && (comp_algo_back = s->fe->comp->algos))) {
|
||||||
ctx.idx = 0;
|
ctx.idx = 0;
|
||||||
while (http_find_header2("Accept-Encoding", 15, req->p, &txn->hdr_idx, &ctx)) {
|
while (http_find_header2("Accept-Encoding", 15, req->p, &txn->hdr_idx, &ctx)) {
|
||||||
for (; comp_algo; comp_algo = comp_algo->next) {
|
for (comp_algo = comp_algo_back; comp_algo; comp_algo = comp_algo->next) {
|
||||||
if (word_match(ctx.line + ctx.val, ctx.vlen, comp_algo->name, comp_algo->name_len)) {
|
if (word_match(ctx.line + ctx.val, ctx.vlen, comp_algo->name, comp_algo->name_len)) {
|
||||||
s->comp_algo = comp_algo;
|
s->comp_algo = comp_algo;
|
||||||
return 1;
|
return 1;
|
||||||
@ -2012,8 +2013,8 @@ int select_compression_request_header(struct session *s, struct buffer *req)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* identity is implicit does not require headers */
|
/* identity is implicit does not require headers */
|
||||||
if ((s->be->comp && (comp_algo = s->be->comp->algos)) || (s->fe->comp && (comp_algo = s->fe->comp->algos))) {
|
if ((s->be->comp && (comp_algo_back = s->be->comp->algos)) || (s->fe->comp && (comp_algo_back = s->fe->comp->algos))) {
|
||||||
for (; comp_algo; comp_algo = comp_algo->next) {
|
for (comp_algo = comp_algo_back; comp_algo; comp_algo = comp_algo->next) {
|
||||||
if (comp_algo->add_data == identity_add_data) {
|
if (comp_algo->add_data == identity_add_data) {
|
||||||
s->comp_algo = comp_algo;
|
s->comp_algo = comp_algo;
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user