Mercurial > hg > nginx-vendor-1-0
diff src/http/ngx_http_upstream.c @ 206:3866d57d9cfd NGINX_0_3_50
nginx 0.3.50
*) Change: the "proxy_redirect_errors" and "fastcgi_redirect_errors"
directives was renamed to the "proxy_intercept_errors" and
"fastcgi_intercept_errors" directives.
*) Feature: the ngx_http_charset_module supports the recoding from the
single byte encodings to the UTF-8 encoding and back.
*) Feature: the "X-Accel-Charset" response header line is supported in
proxy and FastCGI mode.
*) Bugfix: the "\" escape symbol in the "\"" and "\'" pairs in the SSI
command was removed only if the command also has the "$" symbol.
*) Bugfix: the "<!--" string might be added on some conditions in the
SSI after inclusion.
*) Bugfix: if the "Content-Length: 0" header line was in response, then
in nonbuffered proxying mode the client connection was not closed.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Wed, 28 Jun 2006 00:00:00 +0400 |
parents | ca5f86d94316 |
children | b12b3b1a9426 |
line wrap: on
line diff
--- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -49,6 +49,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_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_copy_header_line(ngx_http_request_t *r, ngx_table_elt_t *h, ngx_uint_t offset); static ngx_int_t @@ -199,6 +201,10 @@ ngx_http_upstream_header_t ngx_http_ups ngx_http_upstream_process_buffering, 0, ngx_http_upstream_ignore_header_line, 0, 0 }, + { ngx_string("X-Accel-Charset"), + ngx_http_upstream_process_charset, 0, + ngx_http_upstream_ignore_header_line, 0, 0 }, + #if (NGX_HTTP_GZIP) { ngx_string("Content-Encoding"), ngx_http_upstream_process_header_line, @@ -1080,7 +1086,7 @@ ngx_http_upstream_process_header(ngx_eve if (u->headers_in.status_n >= NGX_HTTP_BAD_REQUEST - && u->conf->redirect_errors + && u->conf->intercept_errors && r->err_ctx == NULL) { clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); @@ -1515,7 +1521,7 @@ ngx_http_upstream_process_non_buffered_b clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); - do_write = ev->write; + do_write = ev->write || u->length == 0; for ( ;; ) { @@ -1559,6 +1565,7 @@ ngx_http_upstream_process_non_buffered_b } if (size && u->peer.connection->read->ready) { + n = u->peer.connection->recv(u->peer.connection, b->last, size); if (n == NGX_AGAIN) { @@ -2126,6 +2133,16 @@ ngx_http_upstream_process_buffering(ngx_ static ngx_int_t +ngx_http_upstream_process_charset(ngx_http_request_t *r, ngx_table_elt_t *h, + ngx_uint_t offset) +{ + r->headers_out.override_charset = &h->value; + + 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) { @@ -2184,8 +2201,33 @@ static ngx_int_t ngx_http_upstream_copy_content_type(ngx_http_request_t *r, ngx_table_elt_t *h, ngx_uint_t offset) { + u_char *p, *last; + + r->headers_out.content_type_len = h->value.len; r->headers_out.content_type = h->value; + for (p = h->value.data; *p; p++) { + + if (*p != ';') { + continue; + } + + last = p; + + while (*++p == ' ') { /* void */ } + + if (ngx_strncasecmp(p, "charset=", 8) != 0) { + continue; + } + + p += 8; + + r->headers_out.content_type_len = last - h->value.data; + + r->headers_out.charset.len = h->value.data + h->value.len - p; + r->headers_out.charset.data = p; + } + return NGX_OK; }