Mercurial > hg > nginx-quic
comparison src/http/modules/proxy/ngx_http_proxy_handler.c @ 154:eac26585476e
nginx-0.0.1-2003-10-22-11:05:29 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 22 Oct 2003 07:05:29 +0000 |
parents | c71aeb75c071 |
children | 46eb23d9471d |
comparison
equal
deleted
inserted
replaced
153:c71aeb75c071 | 154:eac26585476e |
---|---|
408 0, 0); | 408 0, 0); |
409 if (p->header_in == NULL) { | 409 if (p->header_in == NULL) { |
410 ngx_http_proxy_finalize_request(p, NGX_HTTP_INTERNAL_SERVER_ERROR); | 410 ngx_http_proxy_finalize_request(p, NGX_HTTP_INTERNAL_SERVER_ERROR); |
411 return; | 411 return; |
412 } | 412 } |
413 p->header_in->tag = (ngx_hunk_tag_t) &ngx_http_proxy_module; | |
413 } | 414 } |
414 | 415 |
415 n = ngx_http_proxy_read_upstream_header(p); | 416 n = ngx_http_proxy_read_upstream_header(p); |
416 | 417 |
417 if (n == NGX_ERROR) { | 418 if (n == NGX_ERROR) { |
710 | 711 |
711 ep->input_filter = ngx_event_pipe_copy_input_filter; | 712 ep->input_filter = ngx_event_pipe_copy_input_filter; |
712 ep->output_filter = (ngx_event_pipe_output_filter_pt) | 713 ep->output_filter = (ngx_event_pipe_output_filter_pt) |
713 ngx_http_output_filter; | 714 ngx_http_output_filter; |
714 ep->output_ctx = r; | 715 ep->output_ctx = r; |
716 ep->tag = (ngx_hunk_tag_t) &ngx_http_proxy_module; | |
715 ep->bufs = p->lcf->bufs; | 717 ep->bufs = p->lcf->bufs; |
716 ep->max_busy_len = p->lcf->max_busy_len; | 718 ep->max_busy_len = p->lcf->max_busy_len; |
717 ep->upstream = p->upstream.connection; | 719 ep->upstream = p->upstream.connection; |
718 ep->downstream = r->connection; | 720 ep->downstream = r->connection; |
719 ep->pool = r->pool; | 721 ep->pool = r->pool; |
720 ep->log = r->connection->log; | 722 ep->log = r->connection->log; |
721 ep->temp_path = p->lcf->temp_path; | 723 ep->temp_path = p->lcf->temp_path; |
722 | 724 |
723 ep->temp_file = ngx_palloc(r->pool, sizeof(ngx_file_t)); | 725 ep->temp_file = ngx_pcalloc(r->pool, sizeof(ngx_file_t)); |
724 if (ep->temp_file == NULL) { | 726 if (ep->temp_file == NULL) { |
725 ngx_http_proxy_finalize_request(p, 0); | 727 ngx_http_proxy_finalize_request(p, 0); |
726 return; | 728 return; |
727 } | 729 } |
728 | 730 |
748 * event_pipe would do p->header_in->last += ep->preread_size | 750 * event_pipe would do p->header_in->last += ep->preread_size |
749 * as though these bytes were read. | 751 * as though these bytes were read. |
750 */ | 752 */ |
751 p->header_in->last = p->header_in->pos; | 753 p->header_in->last = p->header_in->pos; |
752 | 754 |
753 /* STUB */ ep->cachable = 1; | 755 /* STUB */ ep->cachable = 0; |
754 #if 0 | 756 |
755 ep->max_temp_file_size = 1000000000; | 757 if (p->lcf->cyclic_temp_file) { |
756 #endif | 758 |
759 /* | |
760 * we need to disable the use of sendfile() if we use cyclic temp file | |
761 * because the writing a new data can interfere with sendfile | |
762 * that uses the same kernel file pages | |
763 */ | |
764 | |
765 ep->cyclic_temp_file = 1; | |
766 r->sendfile = 0; | |
767 | |
768 } else { | |
769 ep->cyclic_temp_file = 0; | |
770 r->sendfile = 1; | |
771 } | |
757 | 772 |
758 p->event_pipe = ep; | 773 p->event_pipe = ep; |
759 | 774 |
760 #if 0 | 775 #if 0 |
761 lcx = p->log->data; | 776 lcx = p->log->data; |
1160 conf->connect_timeout = 30000; | 1175 conf->connect_timeout = 30000; |
1161 conf->send_timeout = 30000; | 1176 conf->send_timeout = 30000; |
1162 conf->header_size = 4096; | 1177 conf->header_size = 4096; |
1163 conf->read_timeout = 30000; | 1178 conf->read_timeout = 30000; |
1164 | 1179 |
1165 conf->bufs.num = 10; | 1180 conf->bufs.num = 5; |
1166 conf->bufs.size = 4096; | 1181 conf->bufs.size = 4096; |
1167 conf->max_busy_len = 8192; | 1182 conf->max_busy_len = 8192; |
1168 | 1183 |
1169 | 1184 |
1170 /* CHECK in _init conf->max_temp_size >= conf->bufs.size !!! */ | 1185 /* CHECK in _init conf->max_temp_size >= conf->bufs.size !!! */ |
1171 conf->max_temp_file_size = 4096 * 6; | 1186 conf->max_temp_file_size = 4096 * 3; |
1172 | 1187 |
1173 | 1188 |
1174 conf->temp_file_write_size = 4096 * 1; | 1189 conf->temp_file_write_size = 4096 * 2; |
1190 conf->cyclic_temp_file= 1; | |
1175 | 1191 |
1176 ngx_test_null(conf->temp_path, ngx_pcalloc(cf->pool, sizeof(ngx_path_t)), | 1192 ngx_test_null(conf->temp_path, ngx_pcalloc(cf->pool, sizeof(ngx_path_t)), |
1177 NULL); | 1193 NULL); |
1178 | 1194 |
1179 conf->temp_path->name.data = "temp"; | 1195 conf->temp_path->name.data = "temp"; |