[nginx] Upstream: ngx_http_upstream_finalize_request(NGX_ERROR) ...
Maxim Dounin
mdounin at mdounin.ru
Thu Jul 25 11:58:50 UTC 2013
details: http://hg.nginx.org/nginx/rev/a489c31c9783
branches:
changeset: 5295:a489c31c9783
user: Maxim Dounin <mdounin at mdounin.ru>
date: Thu Jul 25 14:56:13 2013 +0400
description:
Upstream: ngx_http_upstream_finalize_request(NGX_ERROR) on errors.
Previously, ngx_http_upstream_finalize_request(0) was used in most
cases after errors. While with current code there is no difference,
use of NGX_ERROR allows to pass a bit more information into
ngx_http_upstream_finalize_request().
diffstat:
src/http/ngx_http_upstream.c | 50 ++++++++++++++++++++++----------------------
1 files changed, 25 insertions(+), 25 deletions(-)
diffs (225 lines):
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
@@ -2144,7 +2144,7 @@ ngx_http_upstream_send_response(ngx_http
r->limit_rate = 0;
if (u->input_filter_init(u->input_filter_ctx) == NGX_ERROR) {
- ngx_http_upstream_finalize_request(r, u, 0);
+ ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
return;
}
@@ -2158,7 +2158,7 @@ ngx_http_upstream_send_response(ngx_http
{
ngx_connection_error(c, ngx_socket_errno,
"setsockopt(TCP_NODELAY) failed");
- ngx_http_upstream_finalize_request(r, u, 0);
+ ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
return;
}
@@ -2173,7 +2173,7 @@ ngx_http_upstream_send_response(ngx_http
u->state->response_length += n;
if (u->input_filter(u->input_filter_ctx, n) == NGX_ERROR) {
- ngx_http_upstream_finalize_request(r, u, 0);
+ ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
return;
}
@@ -2184,7 +2184,7 @@ ngx_http_upstream_send_response(ngx_http
u->buffer.last = u->buffer.start;
if (ngx_http_send_special(r, NGX_HTTP_FLUSH) == NGX_ERROR) {
- ngx_http_upstream_finalize_request(r, u, 0);
+ ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
return;
}
@@ -2208,7 +2208,7 @@ ngx_http_upstream_send_response(ngx_http
switch (ngx_http_test_predicates(r, u->conf->no_cache)) {
case NGX_ERROR:
- ngx_http_upstream_finalize_request(r, u, 0);
+ ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
return;
case NGX_DECLINED:
@@ -2224,7 +2224,7 @@ ngx_http_upstream_send_response(ngx_http
r->cache->file_cache = u->conf->cache->data;
if (ngx_http_file_cache_create(r) != NGX_OK) {
- ngx_http_upstream_finalize_request(r, u, 0);
+ ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
return;
}
}
@@ -2285,7 +2285,7 @@ ngx_http_upstream_send_response(ngx_http
p->temp_file = ngx_pcalloc(r->pool, sizeof(ngx_temp_file_t));
if (p->temp_file == NULL) {
- ngx_http_upstream_finalize_request(r, u, 0);
+ ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
return;
}
@@ -2308,7 +2308,7 @@ ngx_http_upstream_send_response(ngx_http
p->preread_bufs = ngx_alloc_chain_link(r->pool);
if (p->preread_bufs == NULL) {
- ngx_http_upstream_finalize_request(r, u, 0);
+ ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
return;
}
@@ -2322,7 +2322,7 @@ ngx_http_upstream_send_response(ngx_http
p->buf_to_file = ngx_calloc_buf(r->pool);
if (p->buf_to_file == NULL) {
- ngx_http_upstream_finalize_request(r, u, 0);
+ ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
return;
}
@@ -2370,7 +2370,7 @@ ngx_http_upstream_send_response(ngx_http
if (u->input_filter_init
&& u->input_filter_init(p->input_ctx) != NGX_OK)
{
- ngx_http_upstream_finalize_request(r, u, 0);
+ ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
return;
}
@@ -2412,7 +2412,7 @@ ngx_http_upstream_upgrade(ngx_http_reque
{
ngx_connection_error(c, ngx_socket_errno,
"setsockopt(TCP_NODELAY) failed");
- ngx_http_upstream_finalize_request(r, u, 0);
+ ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
return;
}
@@ -2428,7 +2428,7 @@ ngx_http_upstream_upgrade(ngx_http_reque
{
ngx_connection_error(u->peer.connection, ngx_socket_errno,
"setsockopt(TCP_NODELAY) failed");
- ngx_http_upstream_finalize_request(r, u, 0);
+ ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
return;
}
@@ -2437,7 +2437,7 @@ ngx_http_upstream_upgrade(ngx_http_reque
}
if (ngx_http_send_special(r, NGX_HTTP_FLUSH) == NGX_ERROR) {
- ngx_http_upstream_finalize_request(r, u, 0);
+ ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
return;
}
@@ -2537,7 +2537,7 @@ ngx_http_upstream_process_upgraded(ngx_h
if (b->start == NULL) {
b->start = ngx_palloc(r->pool, u->conf->buffer_size);
if (b->start == NULL) {
- ngx_http_upstream_finalize_request(r, u, 0);
+ ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
return;
}
@@ -2560,7 +2560,7 @@ ngx_http_upstream_process_upgraded(ngx_h
n = dst->send(dst, b->pos, size);
if (n == NGX_ERROR) {
- ngx_http_upstream_finalize_request(r, u, 0);
+ ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
return;
}
@@ -2615,7 +2615,7 @@ ngx_http_upstream_process_upgraded(ngx_h
if (ngx_handle_write_event(upstream->write, u->conf->send_lowat)
!= NGX_OK)
{
- ngx_http_upstream_finalize_request(r, u, 0);
+ ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
return;
}
@@ -2627,7 +2627,7 @@ ngx_http_upstream_process_upgraded(ngx_h
}
if (ngx_handle_read_event(upstream->read, 0) != NGX_OK) {
- ngx_http_upstream_finalize_request(r, u, 0);
+ ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
return;
}
@@ -2641,12 +2641,12 @@ ngx_http_upstream_process_upgraded(ngx_h
if (ngx_handle_write_event(downstream->write, clcf->send_lowat)
!= NGX_OK)
{
- ngx_http_upstream_finalize_request(r, u, 0);
+ ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
return;
}
if (ngx_handle_read_event(downstream->read, 0) != NGX_OK) {
- ngx_http_upstream_finalize_request(r, u, 0);
+ ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
return;
}
@@ -2737,7 +2737,7 @@ ngx_http_upstream_process_non_buffered_r
rc = ngx_http_output_filter(r, u->out_bufs);
if (rc == NGX_ERROR) {
- ngx_http_upstream_finalize_request(r, u, 0);
+ ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
return;
}
@@ -2774,7 +2774,7 @@ ngx_http_upstream_process_non_buffered_r
u->state->response_length += n;
if (u->input_filter(u->input_filter_ctx, n) == NGX_ERROR) {
- ngx_http_upstream_finalize_request(r, u, 0);
+ ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
return;
}
}
@@ -2793,7 +2793,7 @@ ngx_http_upstream_process_non_buffered_r
if (ngx_handle_write_event(downstream->write, clcf->send_lowat)
!= NGX_OK)
{
- ngx_http_upstream_finalize_request(r, u, 0);
+ ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
return;
}
}
@@ -2806,7 +2806,7 @@ ngx_http_upstream_process_non_buffered_r
}
if (ngx_handle_read_event(upstream->read, 0) != NGX_OK) {
- ngx_http_upstream_finalize_request(r, u, 0);
+ ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
return;
}
@@ -2897,7 +2897,7 @@ ngx_http_upstream_process_downstream(ngx
ngx_add_timer(wev, p->send_timeout);
if (ngx_handle_write_event(wev, p->send_lowat) != NGX_OK) {
- ngx_http_upstream_finalize_request(r, u, 0);
+ ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
}
return;
@@ -2922,7 +2922,7 @@ ngx_http_upstream_process_downstream(ngx
"http downstream delayed");
if (ngx_handle_write_event(wev, p->send_lowat) != NGX_OK) {
- ngx_http_upstream_finalize_request(r, u, 0);
+ ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
}
return;
More information about the nginx-devel
mailing list