comparison src/http/modules/proxy/ngx_http_proxy_upstream.c @ 22:8b6db3bda591 NGINX_0_1_11

nginx 0.1.11 *) Feature: the worker_priority directive. *) Change: both tcp_nopush and tcp_nodelay directives affect the transferred response. *) Bugfix: nginx did not call initgroups(). Thanks to Andrew Sitnikov and Andrei Nigmatulin. *) Change: now the ngx_http_autoindex_module shows the file size in the bytes. *) Bugfix: the ngx_http_autoindex_module returned the 500 error if the broken symlink was in a directory. *) Bugfix: the files bigger than 4G could not be transferred using sendfile. *) Bugfix: if the backend was resolved to several backends and there was an error while the response waiting then process may got caught in an endless loop. *) Bugfix: the worker process may exit with the "unknown cycle" message when the /dev/poll method was used. *) Bugfix: "close() channel failed" errors. *) Bugfix: the autodetection of the "nobody" and "nogroup" groups. *) Bugfix: the send_lowat directive did not work on Linux. *) Bugfix: the segmentation fault occurred if there was no events section in configuration. *) Bugfix: nginx could not be built on OpenBSD. *) Bugfix: the double slashes in "://" in the URI were converted to ":/".
author Igor Sysoev <http://sysoev.ru>
date Thu, 02 Dec 2004 00:00:00 +0300
parents 6f8b0dc0f8dd
children 7ca9bdc82b3f
comparison
equal deleted inserted replaced
21:4eeb9cfef970 22:8b6db3bda591
526 526
527 static void ngx_http_proxy_reinit_upstream(ngx_http_proxy_ctx_t *p) 527 static void ngx_http_proxy_reinit_upstream(ngx_http_proxy_ctx_t *p)
528 { 528 {
529 ngx_chain_t *cl; 529 ngx_chain_t *cl;
530 ngx_output_chain_ctx_t *output; 530 ngx_output_chain_ctx_t *output;
531 ngx_http_proxy_state_e state;
531 532
532 /* reinit the request chain */ 533 /* reinit the request chain */
533 534
534 for (cl = p->request->request_body->bufs; cl; cl = cl->next) { 535 for (cl = p->request->request_body->bufs; cl; cl = cl->next) {
535 cl->buf->pos = cl->buf->start; 536 cl->buf->pos = cl->buf->start;
558 } 559 }
559 } 560 }
560 561
561 /* add one more state */ 562 /* add one more state */
562 563
564 state = p->state->cache_state;
565
563 if (!(p->state = ngx_push_array(&p->states))) { 566 if (!(p->state = ngx_push_array(&p->states))) {
564 ngx_http_proxy_finalize_request(p, NGX_HTTP_INTERNAL_SERVER_ERROR); 567 ngx_http_proxy_finalize_request(p, NGX_HTTP_INTERNAL_SERVER_ERROR);
565 return; 568 return;
566 } 569 }
570
571 ngx_memzero(p->state, sizeof(ngx_http_proxy_state_t));
572
573 p->state->cache_state = state;
567 574
568 p->status = 0; 575 p->status = 0;
569 p->status_count = 0; 576 p->status_count = 0;
570 } 577 }
571 578
717 output = p->upstream->output_chain_ctx; 724 output = p->upstream->output_chain_ctx;
718 writer = output->filter_ctx; 725 writer = output->filter_ctx;
719 writer->out = NULL; 726 writer->out = NULL;
720 writer->last = &writer->out; 727 writer->last = &writer->out;
721 writer->connection = c; 728 writer->connection = c;
722 writer->limit = OFF_T_MAX_VALUE; 729 writer->limit = 0;
723 730
724 if (p->upstream->peer.tries > 1 && p->request_sent) { 731 if (p->request_sent) {
725 ngx_http_proxy_reinit_upstream(p); 732 ngx_http_proxy_reinit_upstream(p);
726 } 733 }
727 734
728 if (r->request_body->buf) { 735 if (r->request_body->buf) {
729 if (r->request_body->temp_file->file.fd != NGX_INVALID_FILE) { 736 if (r->request_body->temp_file->file.fd != NGX_INVALID_FILE) {
801 808
802 rc = ngx_output_chain(p->upstream->output_chain_ctx, 809 rc = ngx_output_chain(p->upstream->output_chain_ctx,
803 p->request_sent ? NULL: 810 p->request_sent ? NULL:
804 p->request->request_body->bufs); 811 p->request->request_body->bufs);
805 812
813 p->request_sent = 1;
814
806 if (rc == NGX_ERROR) { 815 if (rc == NGX_ERROR) {
807 ngx_http_proxy_next_upstream(p, NGX_HTTP_PROXY_FT_ERROR); 816 ngx_http_proxy_next_upstream(p, NGX_HTTP_PROXY_FT_ERROR);
808 return; 817 return;
809 } 818 }
810
811 p->request_sent = 1;
812 819
813 if (c->write->timer_set) { 820 if (c->write->timer_set) {
814 ngx_del_timer(c->write); 821 ngx_del_timer(c->write);
815 } 822 }
816 823