diff --git a/src/proto_http.c b/src/proto_http.c index 720d66bf3..9b094d732 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -1970,14 +1970,25 @@ static inline int http_skip_chunk_crlf(struct http_msg *msg) /* * Selects a compression algorithm depending on the client request. -*/ - + */ int select_compression_request_header(struct session *s, struct buffer *req) { struct http_txn *txn = &s->txn; struct hdr_ctx ctx; struct comp_algo *comp_algo = NULL; + /* 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. + * See http://zoompf.com/2012/02/lose-the-wait-http-compression for more details. + */ + ctx.idx = 0; + if (http_find_header2("User-Agent", 10, req->p, &txn->hdr_idx, &ctx) && + ctx.vlen >= 9 && + memcmp(ctx.line + ctx.val, "Mozilla/4", 9) == 0) { + s->comp_algo = NULL; + return 0; + } + ctx.idx = 0; /* no compression when Cache-Control: no-transform found */ while (http_find_header2("Cache-Control", 13, req->p, &txn->hdr_idx, &ctx)) {