Mercurial > hg > nginx-quic
comparison src/http/modules/proxy/ngx_http_event_proxy_handler.c @ 77:57c2e18d3572
nginx-0.0.1-2003-04-17-21:59:35 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 17 Apr 2003 17:59:35 +0000 |
parents | 6127d7075471 |
children | eacfdd1c31b9 |
comparison
equal
deleted
inserted
replaced
76:6127d7075471 | 77:57c2e18d3572 |
---|---|
719 ngx_http_request_t *r; | 719 ngx_http_request_t *r; |
720 | 720 |
721 r = p->request; | 721 r = p->request; |
722 | 722 |
723 ngx_test_null(p->header_in, | 723 ngx_test_null(p->header_in, |
724 ngx_create_temp_hunk(r->pool, p->lcf->header_size, 0, 0), | |
725 NGX_ERROR); | |
726 | |
727 #if 0 | |
728 ngx_test_null(p->header_in, | |
724 ngx_create_temp_hunk(r->pool, | 729 ngx_create_temp_hunk(r->pool, |
725 p->lcf->header_size | 730 p->lcf->header_size |
726 - sizeof(ngx_cache_header_t), | 731 - sizeof(ngx_cache_header_t), |
727 sizeof(ngx_cache_header_t), | 732 sizeof(ngx_cache_header_t), |
728 0), | 733 0), |
729 NGX_ERROR); | 734 NGX_ERROR); |
730 | 735 |
731 p->header_in->type = NGX_HUNK_MEMORY|NGX_HUNK_IN_MEMORY; | 736 p->header_in->type = NGX_HUNK_MEMORY|NGX_HUNK_IN_MEMORY; |
737 #endif | |
732 | 738 |
733 #if 0 | 739 #if 0 |
734 ngx_test_null(p->headers_in, | 740 ngx_test_null(p->headers_in, |
735 ngx_palloc(r->pool, sizeof(ngx_http_proxy_headers_in_t)), | 741 ngx_palloc(r->pool, sizeof(ngx_http_proxy_headers_in_t)), |
736 NGX_ERROR); | 742 NGX_ERROR); |
755 | 761 |
756 static int ngx_http_proxy_read_upstream_header(ngx_http_proxy_ctx_t *p) | 762 static int ngx_http_proxy_read_upstream_header(ngx_http_proxy_ctx_t *p) |
757 { | 763 { |
758 int i, n, rc; | 764 int i, n, rc; |
759 ngx_event_t *rev; | 765 ngx_event_t *rev; |
766 ngx_chain_t *temp; | |
760 ngx_table_elt_t *ch, *ph; | 767 ngx_table_elt_t *ch, *ph; |
761 ngx_event_proxy_t *ep; | 768 ngx_event_proxy_t *ep; |
762 ngx_http_request_t *r; | 769 ngx_http_request_t *r; |
763 ngx_http_proxy_log_ctx_t *lcx; | 770 ngx_http_proxy_log_ctx_t *lcx; |
764 | 771 |
844 r->headers_out.status = p->status; | 851 r->headers_out.status = p->status; |
845 | 852 |
846 rc = ngx_http_send_header(r); | 853 rc = ngx_http_send_header(r); |
847 | 854 |
848 #if 1 | 855 #if 1 |
856 #if 0 | |
849 rc = ngx_http_output_filter(r, p->header_in); | 857 rc = ngx_http_output_filter(r, p->header_in); |
858 #endif | |
850 | 859 |
851 ngx_test_null(ep, ngx_pcalloc(r->pool, sizeof(ngx_event_proxy_t)), | 860 ngx_test_null(ep, ngx_pcalloc(r->pool, sizeof(ngx_event_proxy_t)), |
852 NGX_ERROR); | 861 NGX_ERROR); |
853 | 862 |
854 ep->output_filter = (ngx_event_proxy_output_filter_pt) | 863 ep->output_filter = (ngx_event_proxy_output_filter_pt) |
855 ngx_http_output_filter; | 864 ngx_http_output_filter; |
856 ep->output_data = r; | 865 ep->output_data = r; |
857 ep->block_size = p->lcf->block_size; | 866 ep->block_size = p->lcf->block_size; |
858 ep->max_block_size = p->lcf->max_block_size; | 867 ep->max_block_size = p->lcf->max_block_size; |
859 ep->file_block_size = p->lcf->file_block_size; | |
860 ep->upstream = p->connection; | 868 ep->upstream = p->connection; |
861 ep->client = r->connection; | 869 ep->downstream = r->connection; |
862 ep->pool = r->pool; | 870 ep->pool = r->pool; |
863 ep->log = p->log; | 871 ep->log = p->log; |
864 ep->temp_path = p->lcf->temp_path; | 872 ep->temp_path = p->lcf->temp_path; |
865 | 873 |
866 ngx_test_null(ep->temp_file, ngx_palloc(r->pool, sizeof(ngx_file_t)), | 874 ngx_test_null(ep->temp_file, ngx_palloc(r->pool, sizeof(ngx_file_t)), |
869 ep->temp_file->log = p->log; | 877 ep->temp_file->log = p->log; |
870 | 878 |
871 ep->number = 10; | 879 ep->number = 10; |
872 ep->random = 5; | 880 ep->random = 5; |
873 | 881 |
874 ep->max_temp_size = p->lcf->max_temp_file_size; | 882 ep->max_temp_file_size = p->lcf->max_temp_file_size; |
883 ep->temp_file_write_size = p->lcf->temp_file_write_size; | |
875 ep->temp_file_warn = "an upstream response is buffered " | 884 ep->temp_file_warn = "an upstream response is buffered " |
876 "to a temporary file"; | 885 "to a temporary file"; |
886 | |
887 ngx_test_null(ep->preread_hunks, ngx_alloc_chain_entry(r->pool), | |
888 NGX_ERROR); | |
889 ep->preread_hunks->hunk = p->header_in; | |
890 ep->preread_hunks->next = NULL; | |
891 #if 0 | |
892 ep->last_preread_hunk = ep->preread_hunks; | |
893 #endif | |
894 | |
895 ep->preread_size = p->header_in->last - p->header_in->pos; | |
877 | 896 |
878 p->event_proxy = ep; | 897 p->event_proxy = ep; |
879 | 898 |
880 lcx = p->log->data; | 899 lcx = p->log->data; |
881 lcx->action = "reading an upstream"; | 900 lcx->action = "reading an upstream"; |
1098 } | 1117 } |
1099 | 1118 |
1100 | 1119 |
1101 static int ngx_http_proxy_write_upstream_body(ngx_http_proxy_ctx_t *p) | 1120 static int ngx_http_proxy_write_upstream_body(ngx_http_proxy_ctx_t *p) |
1102 { | 1121 { |
1103 return ngx_event_proxy_write_to_client(p->event_proxy); | 1122 return ngx_event_proxy_write_to_downstream(p->event_proxy); |
1104 } | 1123 } |
1105 | 1124 |
1106 | 1125 |
1107 #if 0 | 1126 #if 0 |
1108 static int ngx_http_proxy_read_upstream_body(ngx_event_t *rev) | 1127 static int ngx_http_proxy_read_upstream_body(ngx_event_t *rev) |
1760 /* STUB */ | 1779 /* STUB */ |
1761 conf->conn_pool_size = 16384; | 1780 conf->conn_pool_size = 16384; |
1762 conf->connect_timeout = 10000; | 1781 conf->connect_timeout = 10000; |
1763 conf->send_timeout = 10000; | 1782 conf->send_timeout = 10000; |
1764 conf->read_timeout = 10000; | 1783 conf->read_timeout = 10000; |
1765 conf->header_size = 1024; | 1784 conf->header_size = 2048; |
1766 | 1785 |
1767 #if 0 | 1786 #if 1 |
1768 conf->block_size = 4096; | 1787 conf->block_size = 4096; |
1769 conf->max_block_size = 4096 * 3; | 1788 conf->max_block_size = 4096 * 3; |
1770 conf->max_temp_file_size = 4096 * 5; | 1789 conf->max_temp_file_size = 4096 * 5; |
1771 conf->file_block_size = 4096 * 2; | 1790 conf->temp_file_write_size = 4096 * 2; |
1772 #else | 1791 #else |
1773 conf->block_size = 2048; | 1792 conf->block_size = 2048; |
1774 conf->max_block_size = 4096 * 6; | 1793 conf->max_block_size = 4096 * 6; |
1775 conf->max_temp_file_size = 4096 * 5; | 1794 conf->max_temp_file_size = 4096 * 5; |
1776 conf->file_block_size = 4096 * 5; | 1795 conf->temp_file_write_size = 4096 * 5; |
1777 #endif | 1796 #endif |
1778 | 1797 |
1779 ngx_test_null(conf->temp_path, ngx_pcalloc(pool, sizeof(ngx_path_t)), NULL); | 1798 ngx_test_null(conf->temp_path, ngx_pcalloc(pool, sizeof(ngx_path_t)), NULL); |
1780 | 1799 |
1781 conf->temp_path->name.data = "temp"; | 1800 conf->temp_path->name.data = "temp"; |