Welcome! Log In Create A New Profile

Advanced

Re: disabling HTTP keepalive by User-Agent

Igor Sysoev
January 26, 2010 10:16AM
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/
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
*/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

disabling HTTP keepalive by User-Agent

joshua January 25, 2010 12:50PM

Re: disabling HTTP keepalive by User-Agent

agentzh January 25, 2010 09:04PM

Re: disabling HTTP keepalive by User-Agent

Igor Sysoev January 26, 2010 10:16AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 294
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready