Welcome! Log In Create A New Profile

Advanced

[PATCH 12 of 15] Upstream: process Connection header and detect close token

Maxim Dounin
September 04, 2011 07:48AM
# HG changeset patch
# User Maxim Dounin <mdounin@mdounin.ru>
# Date 1315040808 -14400
# Node ID 0e57952574064b354ee3084b6c8b3cac80941c33
# Parent 326308f7e409d9d5e92265ee98be2b3bbd4ba39e
Upstream: process Connection header and detect close token.

diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -91,6 +91,8 @@ static ngx_int_t ngx_http_upstream_proce
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_ups
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"),
@@ -3372,6 +3374,23 @@ ngx_http_upstream_process_charset(ngx_ht


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)
{
diff --git a/src/http/ngx_http_upstream.h b/src/http/ngx_http_upstream.h
--- a/src/http/ngx_http_upstream.h
+++ b/src/http/ngx_http_upstream.h
@@ -227,6 +227,7 @@ typedef struct {

ngx_array_t cache_control;

+ unsigned connection_close:1;
unsigned chunked:1;
} ngx_http_upstream_headers_in_t;


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

[PATCH 00 of 15] upstream keepalive patch queue

Maxim Dounin 1954 September 04, 2011 07:46AM

[PATCH 01 of 15] Correct SSL shutdown handling

Maxim Dounin 864 September 04, 2011 07:46AM

[PATCH 02 of 15] Proper setting of read->eof in pipe code

Maxim Dounin 843 September 04, 2011 07:46AM

[PATCH 03 of 15] Workaround for cpu hog on errors with cached connections

Maxim Dounin 894 September 04, 2011 07:46AM

[PATCH 04 of 15] Upstream: separate pool for peer connections

Maxim Dounin 895 September 04, 2011 07:46AM

[PATCH 05 of 15] Upstream: content_length_n API change

Maxim Dounin 1091 September 04, 2011 07:46AM

[PATCH 06 of 15] Upstream: r->upstream->length type change to off_t

Maxim Dounin 787 September 04, 2011 07:46AM

[PATCH 07 of 15] Upstream: pipe length and input_filter_init in buffered mode

Maxim Dounin 900 September 04, 2011 07:48AM

[PATCH 08 of 15] Upstream: keepalive flag

Maxim Dounin 821 September 04, 2011 07:48AM

[PATCH 09 of 15] Keepalive support in memcached

Maxim Dounin 792 September 04, 2011 07:48AM

[PATCH 10 of 15] Keepalive support in fastcgi

Maxim Dounin 966 September 04, 2011 07:48AM

[PATCH 11 of 15] Upstream: process Transfer-Encoding header and detect chunked one

Maxim Dounin 915 September 04, 2011 07:48AM

[PATCH 12 of 15] Upstream: process Connection header and detect close token

Maxim Dounin 886 September 04, 2011 07:48AM

[PATCH 13 of 15] Protocol version parsing in ngx_http_parse_status_line()

Maxim Dounin 875 September 04, 2011 07:48AM

[PATCH 14 of 15] Proxy: basic HTTP/1.1 support (including keepalive)

Maxim Dounin 1016 September 04, 2011 07:48AM

[PATCH 15 of 15] Upstream keepalive module

Maxim Dounin 962 September 04, 2011 07:48AM

Re: [PATCH 00 of 15] upstream keepalive patch queue

Maxim Dounin 757 September 05, 2011 01:56PM

Re: [PATCH 00 of 15] upstream keepalive patch queue

splitice 1202 September 06, 2011 01:46AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 200
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