]> git.kaiwu.me - nginx.git/commitdiff
disable keepalive for Safari:
authorIgor Sysoev <igor@sysoev.ru>
Mon, 1 Feb 2010 12:01:01 +0000 (12:01 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Mon, 1 Feb 2010 12:01:01 +0000 (12:01 +0000)
    https://bugs.webkit.org/show_bug.cgi?id=5760

src/http/ngx_http_core_module.c
src/http/ngx_http_request.c
src/http/ngx_http_request.h

index f3b62d9d4a8dcbb178aff3bd9695f8fb20adf28a..78c141220ac2d3577ed1b337899d312ba40a2b3e 100644 (file)
@@ -783,14 +783,24 @@ ngx_http_handler(ngx_http_request_t *r)
             break;
         }
 
-        if (r->keepalive && r->headers_in.msie && r->method == NGX_HTTP_POST) {
-
-            /*
-             * MSIE may wait for some time if an response for
-             * a POST request was sent over a keepalive connection
-             */
+        if (r->keepalive) {
+
+            if (r->headers_in.msie) {
+                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) {
index 9ca19f556f59b81873ab04b80ca5c7835fd8abd1..3432b50a0263c248ec1672f961e98198ecccbfff 100644 (file)
@@ -1450,6 +1450,9 @@ ngx_http_process_user_agent(ngx_http_request_t *r, ngx_table_elt_t *h,
         } 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 79ec0287341540cfe7cc8cee448372607dc4c323..902ec3ec1497c583f519c5f482ea258e8e726a68 100644 (file)
@@ -220,6 +220,7 @@ typedef struct {
     unsigned                          opera:1;
     unsigned                          gecko:1;
     unsigned                          chrome:1;
+    unsigned                          safari:1;
     unsigned                          konqueror:1;
 } ngx_http_headers_in_t;