Mercurial > hg > nginx-vendor-0-6
comparison src/http/ngx_http_special_response.c @ 378:fc497c1dfb7c NGINX_0_6_33
nginx 0.6.33
*) Feature: now nginx returns the 405 status code for POST method
requesting a static file only if the file exists.
*) Workaround: compatibility with glibc 2.3.
Thanks to Eric Benson and Maxim Dounin.
*) Bugfix: the resolver did not understand big DNS responses.
Thanks to Zyb.
*) Bugfix: in HTTPS mode requests might fail with the "bad write retry"
error.
*) Bugfix: the ngx_http_charset_module did not understand quoted
charset name received from backend.
*) 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: 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.6.32.
*) Bugfix: a full response was returned for request method HEAD while
redirection via an "error_page" directive.
*) Bugfix: if a directory has search only rights and the first index
file was absent, then nginx returned the 500 status code.
*) Bugfix: of recursive error_page for 500 status code.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Thu, 20 Nov 2008 00:00:00 +0300 |
parents | d13234035cad |
children | e9979466be2f |
comparison
equal
deleted
inserted
replaced
377:15c4ba3bc2fa | 378:fc497c1dfb7c |
---|---|
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_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 334 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
336 "http special response: %d, \"%V\"", error, &r->uri); | 335 "http special response: %d, \"%V\"", error, &r->uri); |
337 | |
338 rc = ngx_http_discard_request_body(r); | |
339 | |
340 if (rc == NGX_HTTP_INTERNAL_SERVER_ERROR) { | |
341 error = NGX_HTTP_INTERNAL_SERVER_ERROR; | |
342 } | |
343 | 336 |
344 r->err_status = error; | 337 r->err_status = error; |
345 | 338 |
346 if (r->keepalive != 0) { | 339 if (r->keepalive != 0) { |
347 switch (error) { | 340 switch (error) { |
368 | 361 |
369 r->headers_out.content_type.len = 0; | 362 r->headers_out.content_type.len = 0; |
370 | 363 |
371 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); | 364 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); |
372 | 365 |
373 if (!r->error_page && clcf->error_pages) { | 366 if (!r->error_page && clcf->error_pages && r->uri_changes != 0) { |
374 | 367 |
375 if (clcf->recursive_error_pages == 0) { | 368 if (clcf->recursive_error_pages == 0) { |
376 r->error_page = 1; | 369 r->error_page = 1; |
377 } | 370 } |
378 | 371 |
381 for (i = 0; i < clcf->error_pages->nelts; i++) { | 374 for (i = 0; i < clcf->error_pages->nelts; i++) { |
382 if (err_page[i].status == error) { | 375 if (err_page[i].status == error) { |
383 return ngx_http_send_error_page(r, &err_page[i]); | 376 return ngx_http_send_error_page(r, &err_page[i]); |
384 } | 377 } |
385 } | 378 } |
379 } | |
380 | |
381 if (ngx_http_discard_request_body(r) != NGX_OK) { | |
382 error = NGX_HTTP_INTERNAL_SERVER_ERROR; | |
386 } | 383 } |
387 | 384 |
388 if (clcf->msie_refresh | 385 if (clcf->msie_refresh |
389 && r->headers_in.msie | 386 && r->headers_in.msie |
390 && (error == NGX_HTTP_MOVED_PERMANENTLY | 387 && (error == NGX_HTTP_MOVED_PERMANENTLY |
490 args = &err_page->args; | 487 args = &err_page->args; |
491 } | 488 } |
492 | 489 |
493 if (uri->data[0] == '/') { | 490 if (uri->data[0] == '/') { |
494 | 491 |
495 r->method = NGX_HTTP_GET; | 492 if (r->method != NGX_HTTP_HEAD) { |
496 r->method_name = ngx_http_get_name; | 493 r->method = NGX_HTTP_GET; |
494 r->method_name = ngx_http_get_name; | |
495 } | |
497 | 496 |
498 return ngx_http_internal_redirect(r, uri, args); | 497 return ngx_http_internal_redirect(r, uri, args); |
499 } | 498 } |
500 | 499 |
501 if (uri->data[0] == '@') { | 500 if (uri->data[0] == '@') { |