diff options
Diffstat (limited to 'src/http/modules/proxy')
-rw-r--r-- | src/http/modules/proxy/ngx_http_proxy_handler.c | 354 | ||||
-rw-r--r-- | src/http/modules/proxy/ngx_http_proxy_handler.h | 6 | ||||
-rw-r--r-- | src/http/modules/proxy/ngx_http_proxy_header.c | 12 | ||||
-rw-r--r-- | src/http/modules/proxy/ngx_http_proxy_upstream.c | 49 |
4 files changed, 130 insertions, 291 deletions
diff --git a/src/http/modules/proxy/ngx_http_proxy_handler.c b/src/http/modules/proxy/ngx_http_proxy_handler.c index 62e348e0a..7a1c03ce3 100644 --- a/src/http/modules/proxy/ngx_http_proxy_handler.c +++ b/src/http/modules/proxy/ngx_http_proxy_handler.c @@ -13,14 +13,20 @@ static ngx_int_t ngx_http_proxy_handler(ngx_http_request_t *r); static ngx_int_t ngx_http_proxy_cache_get(ngx_http_proxy_ctx_t *p); +static size_t ngx_http_proxy_log_proxy_state_getlen(ngx_http_request_t *r, + uintptr_t data); static u_char *ngx_http_proxy_log_proxy_state(ngx_http_request_t *r, - u_char *buf, uintptr_t data); + u_char *buf, + ngx_http_log_op_t *op); + +#if 0 static u_char *ngx_http_proxy_log_cache_state(ngx_http_request_t *r, u_char *buf, uintptr_t data); static u_char *ngx_http_proxy_log_reason(ngx_http_request_t *r, u_char *buf, uintptr_t data); +#endif -static ngx_int_t ngx_http_proxy_pre_conf(ngx_conf_t *cf); +static ngx_int_t ngx_http_proxy_add_log_formats(ngx_conf_t *cf); static void *ngx_http_proxy_create_loc_conf(ngx_conf_t *cf); static char *ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child); @@ -231,7 +237,6 @@ static ngx_command_t ngx_http_proxy_commands[] = { offsetof(ngx_http_proxy_loc_conf_t, default_expires), NULL }, - { ngx_string("proxy_next_upstream"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_ANY, ngx_conf_set_bitmask_slot, @@ -251,7 +256,7 @@ static ngx_command_t ngx_http_proxy_commands[] = { ngx_http_module_t ngx_http_proxy_module_ctx = { - ngx_http_proxy_pre_conf, /* pre conf */ + ngx_http_proxy_add_log_formats, /* pre conf */ NULL, /* create main configuration */ NULL, /* init main configuration */ @@ -270,16 +275,22 @@ ngx_module_t ngx_http_proxy_module = { ngx_http_proxy_commands, /* module directives */ NGX_HTTP_MODULE, /* module type */ NULL, /* init module */ - NULL /* init child */ + NULL /* init process */ }; static ngx_http_log_op_name_t ngx_http_proxy_log_fmt_ops[] = { - { ngx_string("proxy"), 0, ngx_http_proxy_log_proxy_state }, + { ngx_string("proxy"), 0, NULL, + ngx_http_proxy_log_proxy_state_getlen, + ngx_http_proxy_log_proxy_state }, + +#if 0 { ngx_string("proxy_cache_state"), 0, ngx_http_proxy_log_cache_state }, { ngx_string("proxy_reason"), 0, ngx_http_proxy_log_reason }, - { ngx_null_string, 0, NULL } +#endif + + { ngx_null_string, 0, NULL, NULL, NULL } }; @@ -301,8 +312,12 @@ ngx_http_header_t ngx_http_proxy_headers_in[] = { offsetof(ngx_http_proxy_headers_in_t, content_type) }, { ngx_string("Content-Length"), offsetof(ngx_http_proxy_headers_in_t, content_length) }, + +#if (NGX_HTTP_GZIP) { ngx_string("Content-Encoding"), offsetof(ngx_http_proxy_headers_in_t, content_encoding) }, +#endif + { ngx_string("Last-Modified"), offsetof(ngx_http_proxy_headers_in_t, last_modified) }, { ngx_string("Location"), @@ -779,11 +794,12 @@ u_char *ngx_http_proxy_log_error(void *data, u_char *buf, size_t len) peer = &ctx->proxy->upstream->peer; p = ngx_snprintf(buf, len, - " while %s, client: %V, URL: %V, upstream: %V%V", + " while %s, client: %V, URL: %V, upstream: http://%V%s%V", ctx->proxy->action, &r->connection->addr_text, &r->unparsed_uri, - &peer->peers->peers[peer->cur_peer].addr_port_text, + &peer->peers->peer[peer->cur_peer].name, + ctx->proxy->lcf->upstream->uri_separator, &ctx->proxy->lcf->upstream->uri); len -= p - buf; buf = p; @@ -835,8 +851,24 @@ u_char *ngx_http_proxy_log_error(void *data, u_char *buf, size_t len) } +static size_t ngx_http_proxy_log_proxy_state_getlen(ngx_http_request_t *r, + uintptr_t data) +{ + ngx_http_proxy_ctx_t *p; + + p = ngx_http_get_module_err_ctx(r, ngx_http_proxy_module); + + if (p == NULL) { + return 1; + } + + return p->states.nelts * /* STUB */ 100; +} + + static u_char *ngx_http_proxy_log_proxy_state(ngx_http_request_t *r, - u_char *buf, uintptr_t data) + u_char *buf, + ngx_http_log_op_t *op) { ngx_uint_t i; ngx_http_proxy_ctx_t *p; @@ -845,21 +877,10 @@ static u_char *ngx_http_proxy_log_proxy_state(ngx_http_request_t *r, p = ngx_http_get_module_err_ctx(r, ngx_http_proxy_module); if (p == NULL) { - if (buf == NULL) { - return (u_char *) 1; - } - *buf = '-'; return buf + 1; } - - if (buf == NULL) { - /* find the request line length */ - return (u_char *) (uintptr_t) (p->states.nelts * /* STUB */ 100); - } - - i = 0; state = p->states.elts; @@ -935,6 +956,8 @@ static u_char *ngx_http_proxy_log_proxy_state(ngx_http_request_t *r, } +#if 0 + static u_char *ngx_http_proxy_log_cache_state(ngx_http_request_t *r, u_char *buf, uintptr_t data) { @@ -1014,23 +1037,23 @@ static u_char *ngx_http_proxy_log_reason(ngx_http_request_t *r, u_char *buf, } } +#endif + -static ngx_int_t ngx_http_proxy_pre_conf(ngx_conf_t *cf) +static ngx_int_t ngx_http_proxy_add_log_formats(ngx_conf_t *cf) { ngx_http_log_op_name_t *op; for (op = ngx_http_proxy_log_fmt_ops; op->name.len; op++) { /* void */ } - op->op = NULL; - - op = ngx_http_log_fmt_ops; + op->run = NULL; - for (op = ngx_http_log_fmt_ops; op->op; op++) { + for (op = ngx_http_log_fmt_ops; op->run; op++) { if (op->name.len == 0) { - op = (ngx_http_log_op_name_t *) op->op; + op = (ngx_http_log_op_name_t *) op->run; } } - op->op = (ngx_http_log_op_pt) ngx_http_proxy_log_fmt_ops; + op->run = (ngx_http_log_op_run_pt) ngx_http_proxy_log_fmt_ops; return NGX_OK; } @@ -1044,24 +1067,19 @@ static void *ngx_http_proxy_create_loc_conf(ngx_conf_t *cf) ngx_pcalloc(cf->pool, sizeof(ngx_http_proxy_loc_conf_t)), NGX_CONF_ERROR); - /* set by ngx_pcalloc(): - - conf->bufs.num = 0; - - conf->path = NULL; - - conf->next_upstream = 0; - conf->use_stale = 0; - - conf->upstreams = NULL; - conf->peers = NULL; - - conf->cache_path = NULL; - conf->temp_path = NULL; - - conf->busy_lock = NULL; - - */ + /* + * set by ngx_pcalloc(): + * + * conf->bufs.num = 0; + * conf->path = NULL; + * conf->next_upstream = 0; + * conf->use_stale = 0; + * conf->upstreams = NULL; + * conf->peers = NULL; + * conf->cache_path = NULL; + * conf->temp_path = NULL; + * conf->busy_lock = NULL; + */ conf->connect_timeout = NGX_CONF_UNSET_MSEC; conf->send_timeout = NGX_CONF_UNSET_MSEC; @@ -1210,11 +1228,15 @@ static char *ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, ngx_conf_merge_bitmask_value(conf->use_stale, prev->use_stale, NGX_CONF_BITMASK_SET); +#if 0 ngx_conf_merge_path_value(conf->cache_path, prev->cache_path, - "cache", 1, 2, 0, cf->pool); + NGX_HTTP_PROXY_CACHE_PATH, 1, 2, 0, + ngx_garbage_collector_temp_handler, cf); +#endif ngx_conf_merge_path_value(conf->temp_path, prev->temp_path, - "temp", 1, 2, 0, cf->pool); + NGX_HTTP_PROXY_TEMP_PATH, 1, 2, 0, + ngx_garbage_collector_temp_handler, cf); ngx_conf_merge_value(conf->cache, prev->cache, 0); @@ -1256,24 +1278,23 @@ static char *ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, } - static char *ngx_http_proxy_set_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { ngx_http_proxy_loc_conf_t *lcf = conf; - ngx_uint_t i, len; - char *err; - u_char *host; - in_addr_t addr; - ngx_str_t *value; - struct hostent *h; - ngx_http_core_loc_conf_t *clcf; - + ngx_str_t *value, *url; + ngx_inet_upstream_t inet_upstream; + ngx_http_core_loc_conf_t *clcf; +#if (NGX_HAVE_UNIX_DOMAIN) + ngx_unix_domain_upstream_t unix_upstream; +#endif value = cf->args->elts; - if (ngx_strncasecmp(value[1].data, "http://", 7) != 0) { + url = &value[1]; + + if (ngx_strncasecmp(url->data, "http://", 7) != 0) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "invalid URL prefix"); return NGX_CONF_ERROR; } @@ -1284,121 +1305,52 @@ static char *ngx_http_proxy_set_pass(ngx_conf_t *cf, ngx_command_t *cmd, return NGX_CONF_ERROR; } - lcf->upstream->url.len = value[1].len; - if (!(lcf->upstream->url.data = ngx_palloc(cf->pool, value[1].len + 1))) { - return NGX_CONF_ERROR; - } - - ngx_cpystrn(lcf->upstream->url.data, value[1].data, value[1].len + 1); - - value[1].data += 7; - value[1].len -= 7; - - err = ngx_http_proxy_parse_upstream(&value[1], lcf->upstream); - - if (err) { - ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, err); - return NGX_CONF_ERROR; - } - - if (!(host = ngx_palloc(cf->pool, lcf->upstream->host.len + 1))) { - return NGX_CONF_ERROR; - } - - ngx_cpystrn(host, lcf->upstream->host.data, lcf->upstream->host.len + 1); + if (ngx_strncasecmp(url->data + 7, "unix:", 5) == 0) { - /* AF_INET only */ +#if (NGX_HAVE_UNIX_DOMAIN) - addr = inet_addr((char *) host); + ngx_memzero(&unix_upstream, sizeof(ngx_unix_domain_upstream_t)); - if (addr == INADDR_NONE) { - h = gethostbyname((char *) host); + unix_upstream.name = *url; + unix_upstream.url.len = url->len - 7; + unix_upstream.url.data = url->data + 7; + unix_upstream.uri_part = 1; - if (h == NULL || h->h_addr_list[0] == NULL) { - ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "host %s not found", host); + if (!(lcf->peers = ngx_unix_upstream_parse(cf, &unix_upstream))) { return NGX_CONF_ERROR; } - for (i = 0; h->h_addr_list[i] != NULL; i++) { /* void */ } - - /* MP: ngx_shared_palloc() */ - - lcf->peers = ngx_pcalloc(cf->pool, - sizeof(ngx_peers_t) + sizeof(ngx_peer_t) * (i - 1)); - - if (lcf->peers == NULL) { - return NGX_CONF_ERROR; - } - - lcf->peers->number = i; - - /* STUB */ - lcf->peers->max_fails = 1; - lcf->peers->fail_timeout = 60; - - for (i = 0; h->h_addr_list[i] != NULL; i++) { - lcf->peers->peers[i].host.data = host; - lcf->peers->peers[i].host.len = lcf->upstream->host.len; - lcf->peers->peers[i].addr = *(in_addr_t *)(h->h_addr_list[i]); - lcf->peers->peers[i].port = lcf->upstream->port; + lcf->upstream->host_header.len = sizeof("localhost") - 1; + lcf->upstream->host_header.data = (u_char *) "localhost"; + lcf->upstream->uri = unix_upstream.uri; + lcf->upstream->uri_separator = ":"; + lcf->upstream->default_port = 1; - len = INET_ADDRSTRLEN - 1 + 1 + lcf->upstream->port_text.len; - - lcf->peers->peers[i].addr_port_text.data = - ngx_palloc(cf->pool, len); - if (lcf->peers->peers[i].addr_port_text.data == NULL) { - return NGX_CONF_ERROR; - } - - len = ngx_inet_ntop(AF_INET, - &lcf->peers->peers[i].addr, - lcf->peers->peers[i].addr_port_text.data, - len); - - lcf->peers->peers[i].addr_port_text.data[len++] = ':'; - - ngx_memcpy(lcf->peers->peers[i].addr_port_text.data + len, - lcf->upstream->port_text.data, - lcf->upstream->port_text.len); +#else + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "the unix domain sockets are not supported " + "on this platform"); + return NGX_CONF_ERROR; - lcf->peers->peers[i].addr_port_text.len = - len + lcf->upstream->port_text.len; - } +#endif } else { + ngx_memzero(&inet_upstream, sizeof(ngx_inet_upstream_t)); - /* MP: ngx_shared_palloc() */ - - if (!(lcf->peers = ngx_pcalloc(cf->pool, sizeof(ngx_peers_t)))) { - return NGX_CONF_ERROR; - } - - lcf->peers->number = 1; - - lcf->peers->peers[0].host.data = host; - lcf->peers->peers[0].host.len = lcf->upstream->host.len; - lcf->peers->peers[0].addr = addr; - lcf->peers->peers[0].port = lcf->upstream->port; - - len = lcf->upstream->host.len + 1 + lcf->upstream->port_text.len; + inet_upstream.name = *url; + inet_upstream.url.len = url->len - 7; + inet_upstream.url.data = url->data + 7; + inet_upstream.default_port_value = 80; + inet_upstream.uri_part = 1; - lcf->peers->peers[0].addr_port_text.len = len; - - lcf->peers->peers[0].addr_port_text.data = ngx_palloc(cf->pool, len); - if (lcf->peers->peers[0].addr_port_text.data == NULL) { + if (!(lcf->peers = ngx_inet_upstream_parse(cf, &inet_upstream))) { return NGX_CONF_ERROR; } - len = lcf->upstream->host.len; - - ngx_memcpy(lcf->peers->peers[0].addr_port_text.data, - lcf->upstream->host.data, len); - - lcf->peers->peers[0].addr_port_text.data[len++] = ':'; - - ngx_memcpy(lcf->peers->peers[0].addr_port_text.data + len, - lcf->upstream->port_text.data, - lcf->upstream->port_text.len); + lcf->upstream->host_header = inet_upstream.host_header; + lcf->upstream->port_text = inet_upstream.port_text; + lcf->upstream->uri = inet_upstream.uri; + lcf->upstream->uri_separator = ""; } clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); @@ -1410,93 +1362,7 @@ static char *ngx_http_proxy_set_pass(ngx_conf_t *cf, ngx_command_t *cmd, clcf->auto_redirect = 1; } - return NULL; -} - - -static char *ngx_http_proxy_parse_upstream(ngx_str_t *url, - ngx_http_proxy_upstream_conf_t *u) -{ - size_t i; - - if (url->data[0] == ':' || url->data[0] == '/') { - return "invalid upstream URL"; - } - - u->host.data = url->data; - u->host_header.data = url->data; - - for (i = 1; i < url->len; i++) { - if (url->data[i] == ':') { - u->port_text.data = &url->data[i] + 1; - u->host.len = i; - } - - if (url->data[i] == '/') { - u->uri.data = &url->data[i]; - u->uri.len = url->len - i; - u->host_header.len = i; - - if (u->host.len == 0) { - u->host.len = i; - } - - if (u->port_text.data == NULL) { - u->default_port = 1; - u->port = htons(80); - u->port_text.len = 2; - u->port_text.data = (u_char *) "80"; - return NULL; - } - - u->port_text.len = &url->data[i] - u->port_text.data; - - if (u->port_text.len > 0) { - u->port = (in_port_t) ngx_atoi(u->port_text.data, - u->port_text.len); - if (u->port > 0) { - - if (u->port == 80) { - u->default_port = 1; - } - - u->port = htons(u->port); - return NULL; - } - } - - return "invalid port in upstream URL"; - } - } - - if (u->host.len == 0) { - u->host.len = i; - } - - u->host_header.len = i; - - u->uri.data = (u_char *) "/"; - u->uri.len = 1; - - if (u->port_text.data == NULL) { - u->default_port = 1; - u->port = htons(80); - u->port_text.len = 2; - u->port_text.data = (u_char *) "80"; - return NULL; - } - - u->port_text.len = &url->data[i] - u->port_text.data; - - if (u->port_text.len > 0) { - u->port = (in_port_t) ngx_atoi(u->port_text.data, u->port_text.len); - if (u->port > 0) { - u->port = htons(u->port); - return NULL; - } - } - - return "invalid port in upstream URL"; + return NGX_CONF_OK; } diff --git a/src/http/modules/proxy/ngx_http_proxy_handler.h b/src/http/modules/proxy/ngx_http_proxy_handler.h index 8ab88ad54..915ca6219 100644 --- a/src/http/modules/proxy/ngx_http_proxy_handler.h +++ b/src/http/modules/proxy/ngx_http_proxy_handler.h @@ -47,6 +47,8 @@ typedef struct { ngx_str_t port_text; ngx_str_t *location; + char *uri_separator; + in_port_t port; unsigned default_port:1; @@ -131,7 +133,11 @@ typedef struct { ngx_table_elt_t *connection; ngx_table_elt_t *content_type; ngx_table_elt_t *content_length; + +#if (NGX_HTTP_GZIP) ngx_table_elt_t *content_encoding; +#endif + ngx_table_elt_t *last_modified; ngx_table_elt_t *location; ngx_table_elt_t *accept_ranges; diff --git a/src/http/modules/proxy/ngx_http_proxy_header.c b/src/http/modules/proxy/ngx_http_proxy_header.c index cd5deeb9e..78ae6530f 100644 --- a/src/http/modules/proxy/ngx_http_proxy_header.c +++ b/src/http/modules/proxy/ngx_http_proxy_header.c @@ -26,12 +26,7 @@ int ngx_http_proxy_copy_header(ngx_http_proxy_ctx_t *p, part = &headers_in->headers.part; h = part->elts; -#if 0 - h = headers_in->headers.elts; - for (i = 0; i < headers_in->headers.nelts; i++) { -#endif - - for (i = 0 ; /* void */; i++) { + for (i = 0; /* void */; i++) { if (i >= part->nelts) { if (part->next == NULL) { @@ -113,10 +108,12 @@ int ngx_http_proxy_copy_header(ngx_http_proxy_ctx_t *p, continue; } +#if (NGX_HTTP_GZIP) if (&h[i] == headers_in->content_encoding) { r->headers_out.content_encoding = ho; continue; } +#endif if (&h[i] == headers_in->last_modified) { r->headers_out.last_modified = ho; @@ -169,7 +166,8 @@ static int ngx_http_proxy_rewrite_location_header(ngx_http_proxy_ctx_t *p, return NGX_ERROR; } - if (uc->url.len > loc->value.len + if (p->lcf->preserve_host + || uc->url.len > loc->value.len || ngx_rstrncmp(loc->value.data, uc->url.data, uc->url.len) != 0) { diff --git a/src/http/modules/proxy/ngx_http_proxy_upstream.c b/src/http/modules/proxy/ngx_http_proxy_upstream.c index 47d2b17df..4dfd4e6d1 100644 --- a/src/http/modules/proxy/ngx_http_proxy_upstream.c +++ b/src/http/modules/proxy/ngx_http_proxy_upstream.c @@ -14,7 +14,7 @@ static ngx_chain_t *ngx_http_proxy_create_request(ngx_http_proxy_ctx_t *p); -static void ngx_http_proxy_init_upstream(void *data); +static void ngx_http_proxy_init_upstream(ngx_http_request_t *r); static void ngx_http_proxy_reinit_upstream(ngx_http_proxy_ctx_t *p); static void ngx_http_proxy_connect(ngx_http_proxy_ctx_t *p); static void ngx_http_proxy_send_request(ngx_http_proxy_ctx_t *p); @@ -53,9 +53,7 @@ static char connection_close_header[] = "Connection: close" CRLF; int ngx_http_proxy_request_upstream(ngx_http_proxy_ctx_t *p) { int rc; - ngx_temp_file_t *tf; ngx_http_request_t *r; - ngx_http_request_body_t *rb; ngx_http_proxy_upstream_t *u; r = p->request; @@ -75,36 +73,7 @@ int ngx_http_proxy_request_upstream(ngx_http_proxy_ctx_t *p) u->method = r->method; - if (!(rb = ngx_pcalloc(r->pool, sizeof(ngx_http_request_body_t)))) { - return NGX_HTTP_INTERNAL_SERVER_ERROR; - } - r->request_body = rb; - - if (r->headers_in.content_length_n <= 0) { - ngx_http_proxy_init_upstream(p); - return NGX_DONE; - } - - if (!(tf = ngx_pcalloc(r->pool, sizeof(ngx_temp_file_t)))) { - return NGX_HTTP_INTERNAL_SERVER_ERROR; - } - - tf->file.fd = NGX_INVALID_FILE; - tf->file.log = r->connection->log; - tf->path = p->lcf->temp_path; - tf->pool = r->pool; - tf->warn = "a client request body is buffered to a temporary file"; - /* tf->persistent = 0; */ - - rb->handler = ngx_http_proxy_init_upstream; - rb->data = p; - /* rb->bufs = NULL; */ - /* rb->buf = NULL; */ - /* rb->rest = 0; */ - - rb->temp_file = tf; - - rc = ngx_http_read_client_request_body(r); + rc = ngx_http_read_client_request_body(r, ngx_http_proxy_init_upstream); if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { return rc; @@ -428,17 +397,16 @@ static ngx_chain_t *ngx_http_proxy_create_request(ngx_http_proxy_ctx_t *p) } -static void ngx_http_proxy_init_upstream(void *data) +static void ngx_http_proxy_init_upstream(ngx_http_request_t *r) { - ngx_http_proxy_ctx_t *p = data; ngx_chain_t *cl; - ngx_http_request_t *r; + ngx_http_proxy_ctx_t *p; ngx_output_chain_ctx_t *output; ngx_chain_writer_ctx_t *writer; ngx_http_proxy_log_ctx_t *ctx; - r = p->request; + p = ngx_http_get_module_ctx(r, ngx_http_proxy_module); ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "http proxy init upstream, client timer: %d", @@ -502,7 +470,7 @@ static void ngx_http_proxy_init_upstream(void *data) output->pool = r->pool; output->bufs.num = 1; output->tag = (ngx_buf_tag_t) &ngx_http_proxy_module; - output->output_filter = (ngx_output_chain_filter_pt) ngx_chain_writer; + output->output_filter = ngx_chain_writer; if (!(writer = ngx_palloc(r->pool, sizeof(ngx_chain_writer_ctx_t)))) { ngx_http_proxy_finalize_request(p, NGX_HTTP_INTERNAL_SERVER_ERROR); @@ -700,7 +668,7 @@ static void ngx_http_proxy_connect(ngx_http_proxy_ctx_t *p) } p->state->peer = - &p->upstream->peer.peers->peers[p->upstream->peer.cur_peer].addr_port_text; + &p->upstream->peer.peers->peer[p->upstream->peer.cur_peer].name; if (rc == NGX_CONNECT_ERROR) { ngx_http_proxy_next_upstream(p, NGX_HTTP_PROXY_FT_ERROR); @@ -733,7 +701,7 @@ static void ngx_http_proxy_connect(ngx_http_proxy_ctx_t *p) } if (r->request_body->buf) { - if (r->request_body->temp_file->file.fd != NGX_INVALID_FILE) { + if (r->request_body->temp_file) { if (!(output->free = ngx_alloc_chain_link(r->pool))) { ngx_http_proxy_finalize_request(p, @@ -1347,6 +1315,7 @@ static void ngx_http_proxy_send_response(ngx_http_proxy_ctx_t *p) } ep->preread_bufs->buf = p->header_in; ep->preread_bufs->next = NULL; + p->header_in->recycled = 1; ep->preread_size = p->header_in->last - p->header_in->pos; |