disabling HTTP keepalive by User-Agent
Igor Sysoev
igor at sysoev.ru
Tue Jan 26 18:08:04 MSK 2010
On Mon, Jan 25, 2010 at 12:50:43PM -0500, joshua wrote:
> A long-standing bug in Safari causes file uploads to hang when keepalive connections are improperly reused.
>
> https://bugs.webkit.org/show_bug.cgi?id=5760
>
> In Apache, disabling keepalive support for Webkit solves this problem.
>
> Is there a way to do this with nginx?
The patch.
--
Igor Sysoev
http://sysoev.ru/en/
-------------- next part --------------
Index: src/http/ngx_http_request.c
===================================================================
--- src/http/ngx_http_request.c (revision 2733)
+++ src/http/ngx_http_request.c (working copy)
@@ -1448,6 +1448,9 @@
} 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;
}
Index: src/http/ngx_http_request.h
===================================================================
--- src/http/ngx_http_request.h (revision 2733)
+++ src/http/ngx_http_request.h (working copy)
@@ -220,6 +220,7 @@
unsigned opera:1;
unsigned gecko:1;
unsigned chrome:1;
+ unsigned safari:1;
unsigned konqueror:1;
} ngx_http_headers_in_t;
Index: src/http/ngx_http_core_module.c
===================================================================
--- src/http/ngx_http_core_module.c (revision 2733)
+++ src/http/ngx_http_core_module.c (working copy)
@@ -783,10 +783,13 @@
break;
}
- if (r->keepalive && r->headers_in.msie && r->method == NGX_HTTP_POST) {
+ if (r->keepalive
+ && r->method == NGX_HTTP_POST
+ && (r->headers_in.msie || r->headers_in.safari))
+ {
/*
- * MSIE may wait for some time if an response for
+ * MSIE and Safari 3may wait for some time if an response for
* a POST request was sent over a keepalive connection
*/
More information about the nginx
mailing list