Mercurial > hg > nginx
comparison src/http/ngx_http_special_response.c @ 1592:128ea9efb824
server_tokens
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 22 Oct 2007 10:17:34 +0000 |
parents | cc114c85be0f |
children | e27930ae2b8f |
comparison
equal
deleted
inserted
replaced
1591:135202406b0c | 1592:128ea9efb824 |
---|---|
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 } |