Mercurial > hg > nginx-vendor-current
comparison src/http/ngx_http_upstream.c @ 146:36af50a5582d NGINX_0_3_20
nginx 0.3.20
*) Bugfix: in SSI handling.
*) Bugfix: the ngx_http_memcached_module did not support the keys in
the "/usr?args" form.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Wed, 11 Jan 2006 00:00:00 +0300 |
parents | 84910468f6de |
children | 73e8476f9142 |
comparison
equal
deleted
inserted
replaced
145:85a84f8da62b | 146:36af50a5582d |
---|---|
556 NGX_HTTP_INTERNAL_SERVER_ERROR); | 556 NGX_HTTP_INTERNAL_SERVER_ERROR); |
557 return; | 557 return; |
558 } | 558 } |
559 } | 559 } |
560 | 560 |
561 if (r->request_body && r->request_body->temp_file && r->main == r) { | 561 if (r->request_body && r->request_body->temp_file && r == r->main) { |
562 | 562 |
563 /* | 563 /* |
564 * the r->request_body->buf can be reused for one request only, | 564 * the r->request_body->buf can be reused for one request only, |
565 * the subrequests should allocate their own temporay bufs | 565 * the subrequests should allocate their own temporay bufs |
566 */ | 566 */ |
693 } | 693 } |
694 | 694 |
695 /* reinit the subrequest's ngx_output_chain() context */ | 695 /* reinit the subrequest's ngx_output_chain() context */ |
696 | 696 |
697 if (r->request_body && r->request_body->temp_file | 697 if (r->request_body && r->request_body->temp_file |
698 && r->main != r && u->output.buf) | 698 && r != r->main && u->output.buf) |
699 { | 699 { |
700 u->output.free = ngx_alloc_chain_link(r->pool); | 700 u->output.free = ngx_alloc_chain_link(r->pool); |
701 if (u->output.free == NULL) { | 701 if (u->output.free == NULL) { |
702 return NGX_ERROR; | 702 return NGX_ERROR; |
703 } | 703 } |
1029 } | 1029 } |
1030 | 1030 |
1031 #endif | 1031 #endif |
1032 } | 1032 } |
1033 | 1033 |
1034 if (u->headers_in.status_n == NGX_HTTP_NOT_FOUND | 1034 if (u->headers_in.status_n == NGX_HTTP_NOT_FOUND) { |
1035 && u->peer.tries > 1 | 1035 |
1036 && u->conf->next_upstream & NGX_HTTP_UPSTREAM_FT_HTTP_404) | 1036 if (u->peer.tries > 1 |
1037 { | 1037 && u->conf->next_upstream & NGX_HTTP_UPSTREAM_FT_HTTP_404) |
1038 ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_HTTP_404); | 1038 { |
1039 return; | 1039 ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_HTTP_404); |
1040 return; | |
1041 } | |
1042 | |
1043 if (u->conf->redirect_404) { | |
1044 rc = (r->err_ctx == NULL) ? 404 : 204; | |
1045 ngx_http_upstream_finalize_request(r, u, rc); | |
1046 return; | |
1047 } | |
1040 } | 1048 } |
1041 | 1049 |
1042 | 1050 |
1043 if (u->headers_in.status_n >= NGX_HTTP_BAD_REQUEST | 1051 if (u->headers_in.status_n >= NGX_HTTP_BAD_REQUEST |
1044 && u->conf->redirect_errors | 1052 && u->conf->redirect_errors |
1045 && r->err_ctx == NULL) | 1053 && r->err_ctx == NULL) |
1046 { | 1054 { |
1047 if (u->headers_in.status_n == NGX_HTTP_NOT_FOUND | |
1048 && u->conf->redirect_404) | |
1049 { | |
1050 ngx_http_upstream_finalize_request(r, u, 404); | |
1051 return; | |
1052 } | |
1053 | |
1054 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | 1055 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
1055 | 1056 |
1056 if (clcf->error_pages) { | 1057 if (clcf->error_pages) { |
1057 | 1058 |
1058 err_page = clcf->error_pages->elts; | 1059 err_page = clcf->error_pages->elts; |
1945 return; | 1946 return; |
1946 } | 1947 } |
1947 | 1948 |
1948 r->connection->log->action = "sending to client"; | 1949 r->connection->log->action = "sending to client"; |
1949 | 1950 |
1950 if (rc == 0 && r->main == r) { | 1951 if (rc == 0 && r == r->main) { |
1951 rc = ngx_http_send_special(r, NGX_HTTP_LAST); | 1952 rc = ngx_http_send_special(r, NGX_HTTP_LAST); |
1952 } | 1953 } |
1953 | 1954 |
1954 ngx_http_finalize_request(r, rc); | 1955 ngx_http_finalize_request(r, rc); |
1955 } | 1956 } |