Welcome! Log In Create A New Profile

Advanced

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

Maxim Dounin
September 04, 2011 07:48AM
# HG changeset patch
# User Maxim Dounin <mdounin@mdounin.ru>
# Date 1297818715 -10800
# Node ID 326308f7e409d9d5e92265ee98be2b3bbd4ba39e
# Parent 3c397bb4808ed5a8ec21e07eb9604b1766f723b8
Upstream: process Transfer-Encoding header and detect chunked one.

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,9 @@ 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_transfer_encoding(ngx_http_request_t *r,
+ ngx_table_elt_t *h, ngx_uint_t offset);
static ngx_int_t ngx_http_upstream_copy_header_line(ngx_http_request_t *r,
ngx_table_elt_t *h, ngx_uint_t offset);
static ngx_int_t
@@ -247,6 +250,10 @@ ngx_http_upstream_header_t ngx_http_ups
ngx_http_upstream_process_charset, 0,
ngx_http_upstream_copy_header_line, 0, 0 },

+ { ngx_string("Transfer-Encoding"),
+ ngx_http_upstream_process_transfer_encoding, 0,
+ ngx_http_upstream_ignore_header_line, 0, 0 },
+
#if (NGX_HTTP_GZIP)
{ ngx_string("Content-Encoding"),
ngx_http_upstream_process_header_line,
@@ -3365,6 +3372,23 @@ ngx_http_upstream_process_charset(ngx_ht


static ngx_int_t
+ngx_http_upstream_process_transfer_encoding(ngx_http_request_t *r,
+ ngx_table_elt_t *h, ngx_uint_t offset)
+{
+ r->upstream->headers_in.transfer_encoding = h;
+
+ if (ngx_strlcasestrn(h->value.data, h->value.data + h->value.len,
+ (u_char *) "chunked", 7 - 1)
+ != NULL)
+ {
+ r->upstream->headers_in.chunked = 1;
+ }
+
+ return NGX_OK;
+}
+
+
+static ngx_int_t
ngx_http_upstream_copy_header_line(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
@@ -217,6 +217,7 @@ typedef struct {
ngx_table_elt_t *location;
ngx_table_elt_t *accept_ranges;
ngx_table_elt_t *www_authenticate;
+ ngx_table_elt_t *transfer_encoding;

#if (NGX_HTTP_GZIP)
ngx_table_elt_t *content_encoding;
@@ -225,6 +226,8 @@ typedef struct {
off_t content_length_n;

ngx_array_t cache_control;
+
+ 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 1950 September 04, 2011 07:46AM

[PATCH 01 of 15] Correct SSL shutdown handling

Maxim Dounin 863 September 04, 2011 07:46AM

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

Maxim Dounin 842 September 04, 2011 07:46AM

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

Maxim Dounin 893 September 04, 2011 07:46AM

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

Maxim Dounin 893 September 04, 2011 07:46AM

[PATCH 05 of 15] Upstream: content_length_n API change

Maxim Dounin 1089 September 04, 2011 07:46AM

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

Maxim Dounin 786 September 04, 2011 07:46AM

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

Maxim Dounin 899 September 04, 2011 07:48AM

[PATCH 08 of 15] Upstream: keepalive flag

Maxim Dounin 819 September 04, 2011 07:48AM

[PATCH 09 of 15] Keepalive support in memcached

Maxim Dounin 790 September 04, 2011 07:48AM

[PATCH 10 of 15] Keepalive support in fastcgi

Maxim Dounin 965 September 04, 2011 07:48AM

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

Maxim Dounin 913 September 04, 2011 07:48AM

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

Maxim Dounin 885 September 04, 2011 07:48AM

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

Maxim Dounin 873 September 04, 2011 07:48AM

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

Maxim Dounin 1015 September 04, 2011 07:48AM

[PATCH 15 of 15] Upstream keepalive module

Maxim Dounin 961 September 04, 2011 07:48AM

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

Maxim Dounin 756 September 05, 2011 01:56PM

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

splitice 1199 September 06, 2011 01:46AM



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

Online Users

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