comparison src/http/ngx_http_special_response.c @ 342:4276c2f1f434 NGINX_0_6_15

nginx 0.6.15 *) Feature: cygwin compatibility. Thanks to Vladimir Kutakov. *) Feature: the "merge_slashes" directive. *) Feature: the "gzip_vary" directive. *) Feature: the "server_tokens" directive. *) Bugfix: nginx did not unescape URI in the "include" SSI command. *) Bugfix: the segmentation fault was occurred on start or while reconfiguration if variable was used in the "charset" or "source_charset" directives. *) Bugfix: nginx returned the 400 response on requests like "GET http://www.domain.com HTTP/1.0". Thanks to James Oakley. *) Bugfix: if request with request body was redirected using the "error_page" directive, then nginx tried to read the request body again; bug appeared in 0.6.7. *) Bugfix: a segmentation fault occurred in worker process if no server_name was explicitly defined for server processing request; bug appeared in 0.6.7.
author Igor Sysoev <http://sysoev.ru>
date Mon, 22 Oct 2007 00:00:00 +0400
parents 9fc4ab6673f9
children eae74a780a84
comparison
equal deleted inserted replaced
341:183b4761fe5b 342:4276c2f1f434
8 #include <ngx_core.h> 8 #include <ngx_core.h>
9 #include <ngx_http.h> 9 #include <ngx_http.h>
10 #include <nginx.h> 10 #include <nginx.h>
11 11
12 12
13 static u_char error_full_tail[] =
14 "<hr><center>" NGINX_VER "</center>" CRLF
15 "</body>" CRLF
16 "</html>" CRLF
17 ;
18
19
13 static u_char error_tail[] = 20 static u_char error_tail[] =
14 "<hr><center>" NGINX_VER "</center>" CRLF 21 "<hr><center>nginx</center>" CRLF
15 "</body>" CRLF 22 "</body>" CRLF
16 "</html>" CRLF 23 "</html>" CRLF
17 ; 24 ;
18 25
19 26
469 msie_padding = 0; 476 msie_padding = 0;
470 477
471 if (!r->zero_body) { 478 if (!r->zero_body) {
472 if (error_pages[err].len) { 479 if (error_pages[err].len) {
473 r->headers_out.content_length_n = error_pages[err].len 480 r->headers_out.content_length_n = error_pages[err].len
474 + sizeof(error_tail) - 1; 481 + (clcf->server_tokens ? sizeof(error_full_tail) - 1:
482 sizeof(error_tail) - 1);
475 483
476 if (clcf->msie_padding 484 if (clcf->msie_padding
477 && r->headers_in.msie 485 && r->headers_in.msie
478 && r->http_version >= NGX_HTTP_VERSION_10 486 && r->http_version >= NGX_HTTP_VERSION_10
479 && error >= NGX_HTTP_BAD_REQUEST 487 && error >= NGX_HTTP_BAD_REQUEST
566 if (b == NULL) { 574 if (b == NULL) {
567 return NGX_ERROR; 575 return NGX_ERROR;
568 } 576 }
569 577
570 b->memory = 1; 578 b->memory = 1;
571 b->pos = error_tail; 579
572 b->last = error_tail + sizeof(error_tail) - 1; 580 if (clcf->server_tokens) {
581 b->pos = error_full_tail;
582 b->last = error_full_tail + sizeof(error_full_tail) - 1;
583 } else {
584 b->pos = error_tail;
585 b->last = error_tail + sizeof(error_tail) - 1;
586 }
573 587
574 cl->next = ngx_alloc_chain_link(r->pool); 588 cl->next = ngx_alloc_chain_link(r->pool);
575 if (cl->next == NULL) { 589 if (cl->next == NULL) {
576 return NGX_ERROR; 590 return NGX_ERROR;
577 } 591 }