diff options
Diffstat (limited to 'src/http')
| -rw-r--r-- | src/http/modules/proxy/ngx_http_proxy_handler.c | 19 | ||||
| -rw-r--r-- | src/http/ngx_http_core_module.c | 25 | ||||
| -rw-r--r-- | src/http/ngx_http_request.c | 1 |
3 files changed, 41 insertions, 4 deletions
diff --git a/src/http/modules/proxy/ngx_http_proxy_handler.c b/src/http/modules/proxy/ngx_http_proxy_handler.c index 87d472c34..16a9ed4bd 100644 --- a/src/http/modules/proxy/ngx_http_proxy_handler.c +++ b/src/http/modules/proxy/ngx_http_proxy_handler.c @@ -742,6 +742,12 @@ static void ngx_http_proxy_send_response(ngx_http_proxy_ctx_t *p) ep->preread_size = p->header_in->last - p->header_in->pos; + /* + * event_proxy would do p->header_in->last += ep->preread_size + * as these bytes were read. + */ + p->header_in->last = p->header_in->pos; + /* STUB */ ep->cachable = 0; p->event_proxy = ep; @@ -806,7 +812,7 @@ static void ngx_http_proxy_process_body(ngx_event_t *ev) } if (ep->upstream_done || ep->upstream_eof || ep->upstream_error) { - ngx_http_proxy_close_connection(c); + ngx_http_proxy_close_connection(p->upstream.connection); p->upstream.connection = NULL; } } @@ -819,7 +825,7 @@ static void ngx_http_proxy_process_body(ngx_event_t *ev) if (ep->downstream_error) { if (!p->cachable && p->upstream.connection) { - ngx_http_proxy_close_connection(c); + ngx_http_proxy_close_connection(p->upstream.connection); p->upstream.connection = NULL; } @@ -1052,7 +1058,9 @@ static void ngx_http_proxy_finalize_request(ngx_http_proxy_ctx_t *p, int rc) p->upstream.connection = NULL; } - if (p->header_sent) { + if (p->header_sent + && (rc == NGX_ERROR || rc >= NGX_HTTP_SPECIAL_RESPONSE)) + { rc = 0; } @@ -1152,7 +1160,12 @@ static void *ngx_http_proxy_create_loc_conf(ngx_conf_t *cf) conf->bufs.num = 10; conf->bufs.size = 4096; conf->max_busy_len = 8192 + 4096; + + + /* CHECK in _init conf->max_temp_size >= conf->bufs.size !!! */ conf->max_temp_file_size = 4096 * 6; + + conf->temp_file_write_size = 4096 * 2; ngx_test_null(conf->temp_path, ngx_pcalloc(cf->pool, sizeof(ngx_path_t)), diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c index 1eee5725f..4e3b43c5e 100644 --- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -207,13 +207,31 @@ void ngx_http_handler(ngx_http_request_t *r) lcx = r->connection->log->data; lcx->action = NULL; + /* STUB */ r->keepalive = 1; + if (r->headers_in.connection) { + if (r->headers_in.connection->value.len == 5 + && ngx_strcasecmp(r->headers_in.connection->value.data, "close") + == 0) + { + r->keepalive = 0; + } + } + +#if 0 + /* TEST STUB */ r->keepalive = 0; +#endif if (r->headers_in.content_length_n > 0) { r->lingering_close = 1; + + } else { + r->lingering_close = 0; } +#if 0 /* TEST STUB */ r->lingering_close = 1; +#endif r->connection->write->event_handler = ngx_http_phase_event_handler; @@ -258,6 +276,11 @@ static void ngx_http_run_phases(ngx_http_request_t *r) { rc = h[r->phase_handler](r); + if (rc == NGX_DONE) { + return; + } + + /* TODO THINK: is it dupliate NGX_DONE ??? */ if (r->closed) { return; } @@ -435,7 +458,7 @@ int ngx_http_internal_redirect(ngx_http_request_t *r, ngx_http_handler(r); - return NGX_OK; + return NGX_DONE; } diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c index fb5bf2c48..a33c8c6ad 100644 --- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c @@ -583,6 +583,7 @@ static void ngx_http_process_request_headers(ngx_event_t *rev) if (ngx_strcasecmp(headers_in[i].name.data, h->key.data) == 0) { *((ngx_table_elt_t **) ((char *) &r->headers_in + headers_in[i].offset)) = h; + break; } } |
