merge r3316, r3317, r3420, r3421, r3453:
browsers related fixes: *) add MSIE padding for Chrome too *) disable keepalive for Safari: https://bugs.webkit.org/show_bug.cgi?id=5760 *) do not disable keepalive after POST requests for MSIE 7+
This commit is contained in:
parent
68a58c361d
commit
47762239ef
4 changed files with 35 additions and 17 deletions
|
@ -744,14 +744,24 @@ ngx_http_handler(ngx_http_request_t *r)
|
|||
break;
|
||||
}
|
||||
|
||||
if (r->keepalive && r->headers_in.msie && r->method == NGX_HTTP_POST) {
|
||||
if (r->keepalive) {
|
||||
|
||||
/*
|
||||
* MSIE may wait for some time if an response for
|
||||
* a POST request was sent over a keepalive connection
|
||||
*/
|
||||
if (r->headers_in.msie6) {
|
||||
if (r->method == NGX_HTTP_POST) {
|
||||
/*
|
||||
* MSIE may wait for some time if an response for
|
||||
* a POST request was sent over a keepalive connection
|
||||
*/
|
||||
r->keepalive = 0;
|
||||
}
|
||||
|
||||
r->keepalive = 0;
|
||||
} else if (r->headers_in.safari) {
|
||||
/*
|
||||
* Safari may send a POST request to a closed keepalive
|
||||
* connection and stalls for some time
|
||||
*/
|
||||
r->keepalive = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (r->headers_in.content_length_n > 0) {
|
||||
|
|
|
@ -1443,6 +1443,12 @@ ngx_http_process_user_agent(ngx_http_request_t *r, ngx_table_elt_t *h,
|
|||
if (ngx_strstrn(user_agent, "Gecko/", 6 - 1)) {
|
||||
r->headers_in.gecko = 1;
|
||||
|
||||
} else if (ngx_strstrn(user_agent, "Chrome/", 7 - 1)) {
|
||||
r->headers_in.chrome = 1;
|
||||
|
||||
} else if (ngx_strstrn(user_agent, "Safari/", 7 - 1)) {
|
||||
r->headers_in.safari = 1;
|
||||
|
||||
} else if (ngx_strstrn(user_agent, "Konqueror", 9 - 1)) {
|
||||
r->headers_in.konqueror = 1;
|
||||
}
|
||||
|
|
|
@ -220,6 +220,8 @@ typedef struct {
|
|||
unsigned msie6:1;
|
||||
unsigned opera:1;
|
||||
unsigned gecko:1;
|
||||
unsigned chrome:1;
|
||||
unsigned safari:1;
|
||||
unsigned konqueror:1;
|
||||
} ngx_http_headers_in_t;
|
||||
|
||||
|
|
|
@ -31,13 +31,13 @@ static u_char ngx_http_error_tail[] =
|
|||
;
|
||||
|
||||
|
||||
static u_char ngx_http_msie_stub[] =
|
||||
"<!-- The padding to disable MSIE's friendly error page -->" CRLF
|
||||
"<!-- The padding to disable MSIE's friendly error page -->" CRLF
|
||||
"<!-- The padding to disable MSIE's friendly error page -->" CRLF
|
||||
"<!-- The padding to disable MSIE's friendly error page -->" CRLF
|
||||
"<!-- The padding to disable MSIE's friendly error page -->" CRLF
|
||||
"<!-- The padding to disable MSIE's friendly error page -->" CRLF
|
||||
static u_char ngx_http_msie_padding[] =
|
||||
"<!-- a padding to disable MSIE and Chrome friendly error page -->" CRLF
|
||||
"<!-- a padding to disable MSIE and Chrome friendly error page -->" CRLF
|
||||
"<!-- a padding to disable MSIE and Chrome friendly error page -->" CRLF
|
||||
"<!-- a padding to disable MSIE and Chrome friendly error page -->" CRLF
|
||||
"<!-- a padding to disable MSIE and Chrome friendly error page -->" CRLF
|
||||
"<!-- a padding to disable MSIE and Chrome friendly error page -->" CRLF
|
||||
;
|
||||
|
||||
|
||||
|
@ -598,12 +598,12 @@ ngx_http_send_special_response(ngx_http_request_t *r,
|
|||
r->headers_out.content_length_n = ngx_http_error_pages[err].len
|
||||
+ len;
|
||||
if (clcf->msie_padding
|
||||
&& r->headers_in.msie
|
||||
&& (r->headers_in.msie || r->headers_in.chrome)
|
||||
&& r->http_version >= NGX_HTTP_VERSION_10
|
||||
&& err >= NGX_HTTP_LEVEL_300)
|
||||
{
|
||||
r->headers_out.content_length_n +=
|
||||
sizeof(ngx_http_msie_stub) - 1;
|
||||
sizeof(ngx_http_msie_padding) - 1;
|
||||
msie_padding = 1;
|
||||
}
|
||||
|
||||
|
@ -671,8 +671,8 @@ ngx_http_send_special_response(ngx_http_request_t *r,
|
|||
}
|
||||
|
||||
b->memory = 1;
|
||||
b->pos = ngx_http_msie_stub;
|
||||
b->last = ngx_http_msie_stub + sizeof(ngx_http_msie_stub) - 1;
|
||||
b->pos = ngx_http_msie_padding;
|
||||
b->last = ngx_http_msie_padding + sizeof(ngx_http_msie_padding) - 1;
|
||||
|
||||
out[1].next = &out[2];
|
||||
out[2].buf = b;
|
||||
|
|
Loading…
Reference in a new issue