]> git.kaiwu.me - nginx.git/commitdiff
Upstream: Connection header processing.
authorMaxim Dounin <mdounin@mdounin.ru>
Thu, 15 Sep 2011 19:21:19 +0000 (19:21 +0000)
committerMaxim Dounin <mdounin@mdounin.ru>
Thu, 15 Sep 2011 19:21:19 +0000 (19:21 +0000)
src/http/ngx_http_upstream.c
src/http/ngx_http_upstream.h

index 3f0259aebd2c24b68bf0182fd38b9a089637dd34..d3d433b240c2dcd0874c56bb0d862bb172488722 100644 (file)
@@ -91,6 +91,8 @@ static ngx_int_t ngx_http_upstream_process_buffering(ngx_http_request_t *r,
     ngx_table_elt_t *h, ngx_uint_t offset);
 static ngx_int_t ngx_http_upstream_process_charset(ngx_http_request_t *r,
     ngx_table_elt_t *h, ngx_uint_t offset);
+static ngx_int_t ngx_http_upstream_process_connection(ngx_http_request_t *r,
+    ngx_table_elt_t *h, ngx_uint_t offset);
 static ngx_int_t
     ngx_http_upstream_process_transfer_encoding(ngx_http_request_t *r,
     ngx_table_elt_t *h, ngx_uint_t offset);
@@ -218,7 +220,7 @@ ngx_http_upstream_header_t  ngx_http_upstream_headers_in[] = {
                  offsetof(ngx_http_headers_out_t, accept_ranges), 1 },
 
     { ngx_string("Connection"),
-                 ngx_http_upstream_ignore_header_line, 0,
+                 ngx_http_upstream_process_connection, 0,
                  ngx_http_upstream_ignore_header_line, 0, 0 },
 
     { ngx_string("Keep-Alive"),
@@ -3371,6 +3373,23 @@ ngx_http_upstream_process_charset(ngx_http_request_t *r, ngx_table_elt_t *h,
 }
 
 
+static ngx_int_t
+ngx_http_upstream_process_connection(ngx_http_request_t *r, ngx_table_elt_t *h,
+    ngx_uint_t offset)
+{
+    r->upstream->headers_in.connection = h;
+
+    if (ngx_strlcasestrn(h->value.data, h->value.data + h->value.len,
+                         (u_char *) "close", 5 - 1)
+        != NULL)
+    {
+        r->upstream->headers_in.connection_close = 1;
+    }
+
+    return NGX_OK;
+}
+
+
 static ngx_int_t
 ngx_http_upstream_process_transfer_encoding(ngx_http_request_t *r,
     ngx_table_elt_t *h, ngx_uint_t offset)
index 4bb79575c9884d65abaa8e3286318c945cd83e5b..bcdd64b168bdf724f978ef6831418279c929a8eb 100644 (file)
@@ -227,6 +227,7 @@ typedef struct {
 
     ngx_array_t                      cache_control;
 
+    unsigned                         connection_close:1;
     unsigned                         chunked:1;
 } ngx_http_upstream_headers_in_t;