diff options
| author | Igor Sysoev <igor@sysoev.ru> | 2007-09-23 19:20:45 +0000 |
|---|---|---|
| committer | Igor Sysoev <igor@sysoev.ru> | 2007-09-23 19:20:45 +0000 |
| commit | 18084d4999e59bda2404f3e60936653b69fb319d (patch) | |
| tree | 00dfea94482a8d72d9c3a97a367325da1f9f22a7 /src/http/ngx_http_request.c | |
| parent | 53acfdb9b8874d1147075322ecab7744695c8409 (diff) | |
| download | nginx-18084d4999e59bda2404f3e60936653b69fb319d.tar.gz nginx-18084d4999e59bda2404f3e60936653b69fb319d.tar.bz2 | |
r1468 merge:
there may be several "Connection" header lines and each may have several tokens
Diffstat (limited to '')
| -rw-r--r-- | src/http/ngx_http_request.c | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c index e75d9ff5c..7bfa8284d 100644 --- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c @@ -21,6 +21,8 @@ static ngx_int_t ngx_http_process_header_line(ngx_http_request_t *r, ngx_table_elt_t *h, ngx_uint_t offset); static ngx_int_t ngx_http_process_unique_header_line(ngx_http_request_t *r, ngx_table_elt_t *h, ngx_uint_t offset); +static ngx_int_t ngx_http_process_connection(ngx_http_request_t *r, + ngx_table_elt_t *h, ngx_uint_t offset); static ngx_int_t ngx_http_process_cookie(ngx_http_request_t *r, ngx_table_elt_t *h, ngx_uint_t offset); @@ -72,7 +74,7 @@ ngx_http_header_t ngx_http_headers_in[] = { ngx_http_process_unique_header_line }, { ngx_string("Connection"), offsetof(ngx_http_headers_in_t, connection), - ngx_http_process_unique_header_line }, + ngx_http_process_connection }, { ngx_string("If-Modified-Since"), offsetof(ngx_http_headers_in_t, if_modified_since), @@ -1200,6 +1202,21 @@ ngx_http_process_unique_header_line(ngx_http_request_t *r, ngx_table_elt_t *h, static ngx_int_t +ngx_http_process_connection(ngx_http_request_t *r, ngx_table_elt_t *h, + ngx_uint_t offset) +{ + if (ngx_strstr(h->value.data, "close")) { + r->headers_in.connection_type = NGX_HTTP_CONNECTION_CLOSE; + + } else if (ngx_strstr(h->value.data, "keep-alive")) { + r->headers_in.connection_type = NGX_HTTP_CONNECTION_KEEP_ALIVE; + } + + return NGX_OK; +} + + +static ngx_int_t ngx_http_process_cookie(ngx_http_request_t *r, ngx_table_elt_t *h, ngx_uint_t offset) { @@ -1318,26 +1335,11 @@ ngx_http_process_request_header(ngx_http_request_t *r) return NGX_ERROR; } - if (r->headers_in.connection) { - if (r->headers_in.connection->value.len == 5 - && ngx_strcasecmp(r->headers_in.connection->value.data, - (u_char *) "close") - == 0) - { - r->headers_in.connection_type = NGX_HTTP_CONNECTION_CLOSE; - - } else if (r->headers_in.connection->value.len == 10 - && ngx_strcasecmp(r->headers_in.connection->value.data, - (u_char *) "keep-alive") - == 0) - { - r->headers_in.connection_type = NGX_HTTP_CONNECTION_KEEP_ALIVE; - - if (r->headers_in.keep_alive) { - r->headers_in.keep_alive_n = - ngx_atotm(r->headers_in.keep_alive->value.data, - r->headers_in.keep_alive->value.len); - } + if (r->headers_in.connection_type == NGX_HTTP_CONNECTION_KEEP_ALIVE) { + if (r->headers_in.keep_alive) { + r->headers_in.keep_alive_n = + ngx_atotm(r->headers_in.keep_alive->value.data, + r->headers_in.keep_alive->value.len); } } |
