comparison src/http/modules/proxy/ngx_http_proxy_upstream.c @ 174:ea464a6c0581

nginx-0.0.1-2003-11-05-01:12:39 import
author Igor Sysoev <igor@sysoev.ru>
date Tue, 04 Nov 2003 22:12:39 +0000
parents caa57ddf6d77
children e92c2c647c57
comparison
equal deleted inserted replaced
173:4fb2a2cff023 174:ea464a6c0581
298 } else { 298 } else {
299 p->header_in->pos = p->header_in->start; 299 p->header_in->pos = p->header_in->start;
300 p->header_in->last = p->header_in->start; 300 p->header_in->last = p->header_in->start;
301 } 301 }
302 } 302 }
303
304 p->status = 0;
305 p->status_count = 0;
303 } 306 }
304 307
305 308
306 static void ngx_http_proxy_connect(ngx_http_proxy_ctx_t *p) 309 static void ngx_http_proxy_connect(ngx_http_proxy_ctx_t *p)
307 { 310 {
554 557
555 if (n == NGX_ERROR || n == 0) { 558 if (n == NGX_ERROR || n == 0) {
556 ngx_http_proxy_next_upstream(p, NGX_HTTP_PROXY_FT_ERROR); 559 ngx_http_proxy_next_upstream(p, NGX_HTTP_PROXY_FT_ERROR);
557 return; 560 return;
558 } 561 }
562
563 p->valid_header_in = 0;
559 564
560 p->upstream->peer.cached = 0; 565 p->upstream->peer.cached = 0;
561 566
562 rc = ngx_http_proxy_parse_status_line(p); 567 rc = ngx_http_proxy_parse_status_line(p);
563 568
809 static void ngx_http_proxy_send_response(ngx_http_proxy_ctx_t *p) 814 static void ngx_http_proxy_send_response(ngx_http_proxy_ctx_t *p)
810 { 815 {
811 int rc; 816 int rc;
812 ngx_event_pipe_t *ep; 817 ngx_event_pipe_t *ep;
813 ngx_http_request_t *r; 818 ngx_http_request_t *r;
814 ngx_http_cache_file_t *header; 819 ngx_http_cache_header_t *header;
815 ngx_http_core_loc_conf_t *clcf; 820 ngx_http_core_loc_conf_t *clcf;
816 821
817 r = p->request; 822 r = p->request;
818 823
819 r->headers_out.status = p->upstream->status; 824 r->headers_out.status = p->upstream->status;
834 839
835 rc = ngx_http_send_header(r); 840 rc = ngx_http_send_header(r);
836 841
837 p->header_sent = 1; 842 p->header_sent = 1;
838 843
839 if (p->cache) { 844 if (p->cachable) {
840 header = (ngx_http_cache_file_t *) p->header_in->start; 845 header = (ngx_http_cache_header_t *) p->header_in->start;
841 846
842 /* STUB */ 847 header->expires = p->cache->ctx.expires;
843 header->header.expires = 0; 848 header->last_modified = p->cache->ctx.last_modified;
844 header->header.last_modified = 0; 849 header->date = p->cache->ctx.date;
845 850 /* TODO: r->headers_out.content_length_n == -1 */
846 header->header.length = r->headers_out.content_length_n; 851 header->length = r->headers_out.content_length_n;
852
847 header->key_len = p->cache->ctx.key.len; 853 header->key_len = p->cache->ctx.key.len;
848 ngx_memcpy(&header->key, p->cache->ctx.key.data, header->key_len); 854 ngx_memcpy(&header->key, p->cache->ctx.key.data, header->key_len);
849 header->key[header->key_len] = LF; 855 header->key[header->key_len] = LF;
850 } 856 }
851 857