comparison src/http/ngx_http_special_response.c @ 602:c5122335e41d NGINX_0_8_53

nginx 0.8.53 *) Feature: now the "error_page" directive allows to change a status code in a redirect. *) Feature: the "gzip_disable" directive supports special "degradation" mask. *) Bugfix: a socket leak might occurred if file AIO was used. Thanks to Maxim Dounin. *) Bugfix: if the first server had no "listen" directive and there was no explicit default server, then a next server with a "listen" directive became the default server; the bug had appeared in 0.8.21.
author Igor Sysoev <http://sysoev.ru>
date Mon, 18 Oct 2010 00:00:00 +0400
parents c456a023113c
children ce857f6b74a7
comparison
equal deleted inserted replaced
601:b2afd36d87f4 602:c5122335e41d
521 521
522 if (overwrite && overwrite != NGX_HTTP_OK) { 522 if (overwrite && overwrite != NGX_HTTP_OK) {
523 r->expect_tested = 1; 523 r->expect_tested = 1;
524 } 524 }
525 525
526 r->err_status = overwrite; 526 if (overwrite >= 0) {
527 r->err_status = overwrite;
528 }
527 529
528 if (ngx_http_complex_value(r, &err_page->value, &uri) != NGX_OK) { 530 if (ngx_http_complex_value(r, &err_page->value, &uri) != NGX_OK) {
529 return NGX_ERROR; 531 return NGX_ERROR;
530 } 532 }
531 533
554 556
555 if (location == NULL) { 557 if (location == NULL) {
556 return NGX_ERROR; 558 return NGX_ERROR;
557 } 559 }
558 560
559 r->err_status = NGX_HTTP_MOVED_TEMPORARILY; 561 r->err_status = overwrite > 0 ? overwrite : NGX_HTTP_MOVED_TEMPORARILY;
560 562
561 location->hash = 1; 563 location->hash = 1;
562 ngx_str_set(&location->key, "Location"); 564 ngx_str_set(&location->key, "Location");
563 location->value = uri; 565 location->value = uri;
564 566
568 570
569 if (clcf->msie_refresh && r->headers_in.msie) { 571 if (clcf->msie_refresh && r->headers_in.msie) {
570 return ngx_http_send_refresh(r); 572 return ngx_http_send_refresh(r);
571 } 573 }
572 574
573 return ngx_http_send_special_response(r, clcf, NGX_HTTP_MOVED_TEMPORARILY 575 return ngx_http_send_special_response(r, clcf, r->err_status
574 - NGX_HTTP_MOVED_PERMANENTLY 576 - NGX_HTTP_MOVED_PERMANENTLY
575 + NGX_HTTP_LEVEL_200); 577 + NGX_HTTP_LEVEL_200);
576 } 578 }
577 579
578 580