comparison src/http/ngx_http_special_response.c @ 406:6ebbca3d5ed7 NGINX_0_7_12

nginx 0.7.12 *) Feature: the "server_name" directive supports empty name "". *) Feature: the "gzip_disable" directive supports special "msie6" mask. *) Bugfix: if the "max_fails=0" parameter was used in upstream with several servers, then a worker process exited on a SIGFPE signal. Thanks to Maxim Dounin. *) Bugfix: a request body was dropped while redirection via an "error_page" directive. *) Bugfix: a full response was returned for request method HEAD while redirection via an "error_page" directive. *) Bugfix: the $r->header_in() method did not return value of the "Host", "User-Agent", and "Connection" request header lines; the bug had appeared in 0.7.0.
author Igor Sysoev <http://sysoev.ru>
date Tue, 26 Aug 2008 00:00:00 +0400
parents 349057ecf4d5
children ce4f9ff90bfa
comparison
equal deleted inserted replaced
404:59e324e4d6d3 406:6ebbca3d5ed7
325 325
326 326
327 ngx_int_t 327 ngx_int_t
328 ngx_http_special_response_handler(ngx_http_request_t *r, ngx_int_t error) 328 ngx_http_special_response_handler(ngx_http_request_t *r, ngx_int_t error)
329 { 329 {
330 ngx_int_t rc;
331 ngx_uint_t i, err; 330 ngx_uint_t i, err;
332 ngx_http_err_page_t *err_page; 331 ngx_http_err_page_t *err_page;
333 ngx_http_core_loc_conf_t *clcf; 332 ngx_http_core_loc_conf_t *clcf;
334 333
335 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 334 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
336 "http special response: %d, \"%V?%V\"", 335 "http special response: %d, \"%V?%V\"",
337 error, &r->uri, &r->args); 336 error, &r->uri, &r->args);
338
339 rc = ngx_http_discard_request_body(r);
340
341 if (rc == NGX_HTTP_INTERNAL_SERVER_ERROR) {
342 error = NGX_HTTP_INTERNAL_SERVER_ERROR;
343 }
344 337
345 r->err_status = error; 338 r->err_status = error;
346 339
347 if (r->keepalive) { 340 if (r->keepalive) {
348 switch (error) { 341 switch (error) {
382 for (i = 0; i < clcf->error_pages->nelts; i++) { 375 for (i = 0; i < clcf->error_pages->nelts; i++) {
383 if (err_page[i].status == error) { 376 if (err_page[i].status == error) {
384 return ngx_http_send_error_page(r, &err_page[i]); 377 return ngx_http_send_error_page(r, &err_page[i]);
385 } 378 }
386 } 379 }
380 }
381
382 if (ngx_http_discard_request_body(r) != NGX_OK) {
383 error = NGX_HTTP_INTERNAL_SERVER_ERROR;
387 } 384 }
388 385
389 if (clcf->msie_refresh 386 if (clcf->msie_refresh
390 && r->headers_in.msie 387 && r->headers_in.msie
391 && (error == NGX_HTTP_MOVED_PERMANENTLY 388 && (error == NGX_HTTP_MOVED_PERMANENTLY
491 args = &err_page->args; 488 args = &err_page->args;
492 } 489 }
493 490
494 if (uri->data[0] == '/') { 491 if (uri->data[0] == '/') {
495 492
496 r->method = NGX_HTTP_GET; 493 if (r->method != NGX_HTTP_HEAD) {
497 r->method_name = ngx_http_get_name; 494 r->method = NGX_HTTP_GET;
495 r->method_name = ngx_http_get_name;
496 }
498 497
499 return ngx_http_internal_redirect(r, uri, args); 498 return ngx_http_internal_redirect(r, uri, args);
500 } 499 }
501 500
502 if (uri->data[0] == '@') { 501 if (uri->data[0] == '@') {