mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-23 22:27:01 +00:00
MINOR: compression: automatically disable compression for older browsers
A number of older browsers have many issues with compressed contents. It happens that all these older browsers announce themselves as "Mozilla/4" and that despite not being all broken, the amount of working browsers announcing themselves this way compared to all other ones is so tiny that it's not worth wasting cycles trying to adapt to every specific one. So let's simply disable compression for these older browsers. More information on this very detailed article : http://zoompf.com/2012/02/lose-the-wait-http-compression
This commit is contained in:
parent
82fe75c1a7
commit
05d846092f
@ -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)) {
|
||||
|
Loading…
Reference in New Issue
Block a user