aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_special_response.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/http/ngx_http_special_response.c')
-rw-r--r--src/http/ngx_http_special_response.c49
1 files changed, 15 insertions, 34 deletions
diff --git a/src/http/ngx_http_special_response.c b/src/http/ngx_http_special_response.c
index 70fdf440d..2771e588c 100644
--- a/src/http/ngx_http_special_response.c
+++ b/src/http/ngx_http_special_response.c
@@ -609,42 +609,26 @@ static ngx_int_t
ngx_http_send_special_response(ngx_http_request_t *r,
ngx_http_core_loc_conf_t *clcf, ngx_uint_t err)
{
+ u_char *tail;
+ size_t len;
ngx_int_t rc;
- ngx_str_t tail, tokens;
ngx_buf_t *b;
ngx_uint_t msie_padding;
ngx_chain_t out[3];
- msie_padding = 0;
-
- if (ngx_http_error_pages[err].len) {
-
- if (clcf->server_tokens == 0) {
- ngx_str_set(&tail, ngx_http_error_tail);
-
- } else if (clcf->server_tokens == 1) {
- ngx_str_set(&tail, ngx_http_error_full_tail);
-
- } else {
- if (ngx_http_complex_value(r, &clcf->server_tokens_value, &tokens)
- != NGX_OK)
- {
- return NGX_ERROR;
- }
-
- if (tokens.len == 0
- || (tokens.len == 3 && ngx_strncmp(tokens.data, "off", 3) == 0))
- {
- ngx_str_set(&tail, ngx_http_error_tail);
+ if (clcf->server_tokens) {
+ len = sizeof(ngx_http_error_full_tail) - 1;
+ tail = ngx_http_error_full_tail;
- } else {
- ngx_str_set(&tail, ngx_http_error_full_tail);
- }
- }
+ } else {
+ len = sizeof(ngx_http_error_tail) - 1;
+ tail = ngx_http_error_tail;
+ }
- r->headers_out.content_length_n = ngx_http_error_pages[err].len
- + tail.len;
+ msie_padding = 0;
+ if (ngx_http_error_pages[err].len) {
+ r->headers_out.content_length_n = ngx_http_error_pages[err].len + len;
if (clcf->msie_padding
&& (r->headers_in.msie || r->headers_in.chrome)
&& r->http_version >= NGX_HTTP_VERSION_10
@@ -661,10 +645,6 @@ ngx_http_send_special_response(ngx_http_request_t *r,
} else {
r->headers_out.content_length_n = 0;
-
-#if (NGX_SUPPRESS_WARN)
- ngx_str_null(&tail);
-#endif
}
if (r->headers_out.content_length) {
@@ -704,8 +684,9 @@ ngx_http_send_special_response(ngx_http_request_t *r,
}
b->memory = 1;
- b->pos = tail.data;
- b->last = tail.data + tail.len;
+
+ b->pos = tail;
+ b->last = tail + len;
out[1].buf = b;
out[1].next = NULL;