aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_request.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2007-09-09 18:28:49 +0000
committerIgor Sysoev <igor@sysoev.ru>2007-09-09 18:28:49 +0000
commitec67b19ea01d8a71c64a64a183669549e091f7a8 (patch)
treedf7d57f0e5f9c11d42534ffae66c9626f0fb198b /src/http/ngx_http_request.c
parent51082f7f1de50a85a74ee721de381f3ef593a53a (diff)
downloadnginx-ec67b19ea01d8a71c64a64a183669549e091f7a8.tar.gz
nginx-ec67b19ea01d8a71c64a64a183669549e091f7a8.zip
there may be several "Connection" header lines and each may have several tokens
Diffstat (limited to 'src/http/ngx_http_request.c')
-rw-r--r--src/http/ngx_http_request.c44
1 files changed, 23 insertions, 21 deletions
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index ea534912e..d7843c62a 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);
@@ -71,7 +73,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),
@@ -1199,6 +1201,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)
{
@@ -1317,26 +1334,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);
}
}