comparison src/http/modules/proxy/ngx_http_proxy_upstream.c @ 177:4db54fdbcbe7

nginx-0.0.1-2003-11-10-20:17:31 import
author Igor Sysoev <igor@sysoev.ru>
date Mon, 10 Nov 2003 17:17:31 +0000
parents c0552e5ab567
children a8ff48d26cca
comparison
equal deleted inserted replaced
176:c0552e5ab567 177:4db54fdbcbe7
303 p->header_in->pos = p->header_in->start; 303 p->header_in->pos = p->header_in->start;
304 p->header_in->last = p->header_in->start; 304 p->header_in->last = p->header_in->start;
305 } 305 }
306 } 306 }
307 307
308 /* add one more state */
309
310 if (!(p->state = ngx_push_array(&p->states))) {
311 ngx_http_proxy_finalize_request(p, NGX_HTTP_INTERNAL_SERVER_ERROR);
312 return;
313 }
314
308 p->status = 0; 315 p->status = 0;
309 p->status_count = 0; 316 p->status_count = 0;
310 } 317 }
311 318
312 319
342 ngx_http_proxy_finalize_request(p, 349 ngx_http_proxy_finalize_request(p,
343 ngx_http_proxy_send_cached_response(p)); 350 ngx_http_proxy_send_cached_response(p));
344 return; 351 return;
345 } 352 }
346 353
354 p->state->status = NGX_HTTP_SERVICE_UNAVAILABLE;
347 ngx_http_proxy_finalize_request(p, NGX_HTTP_SERVICE_UNAVAILABLE); 355 ngx_http_proxy_finalize_request(p, NGX_HTTP_SERVICE_UNAVAILABLE);
348 } 356 }
349 357
350 358
351 static void ngx_http_proxy_connect(ngx_http_proxy_ctx_t *p) 359 static void ngx_http_proxy_connect(ngx_http_proxy_ctx_t *p)
404 r->request_body_hunk->pos = r->request_body_hunk->start; 412 r->request_body_hunk->pos = r->request_body_hunk->start;
405 r->request_body_hunk->last = r->request_body_hunk->start; 413 r->request_body_hunk->last = r->request_body_hunk->start;
406 } 414 }
407 415
408 p->request_sent = 0; 416 p->request_sent = 0;
409
410 if (!(p->state = ngx_push_array(&p->states))) {
411 ngx_http_proxy_finalize_request(p, NGX_HTTP_INTERNAL_SERVER_ERROR);
412 return;
413 }
414 417
415 if (rc == NGX_AGAIN) { 418 if (rc == NGX_AGAIN) {
416 ngx_add_timer(c->write, p->lcf->connect_timeout); 419 ngx_add_timer(c->write, p->lcf->connect_timeout);
417 return; 420 return;
418 } 421 }
634 } 637 }
635 638
636 /* rc == NGX_OK */ 639 /* rc == NGX_OK */
637 640
638 p->upstream->status = p->status; 641 p->upstream->status = p->status;
642 p->state->status = p->status;
639 643
640 if (p->status == NGX_HTTP_INTERNAL_SERVER_ERROR) { 644 if (p->status == NGX_HTTP_INTERNAL_SERVER_ERROR) {
641 645
642 if (p->upstream->peer.tries > 1 646 if (p->upstream->peer.tries > 1
643 && (p->lcf->next_upstream & NGX_HTTP_PROXY_FT_HTTP_500)) 647 && (p->lcf->next_upstream & NGX_HTTP_PROXY_FT_HTTP_500))