comparison src/http/ngx_http_header_filter_module.c @ 6449:e5076b96fd01

Reconsidered server_tokens with an empty value. An empty value will be treated as "off".
author Ruslan Ermilov <ru@nginx.com>
date Tue, 22 Mar 2016 15:52:28 +0300
parents 6b72414dfb4f
children 155871d773cc
comparison
equal deleted inserted replaced
6448:4d1d3c2530e0 6449:e5076b96fd01
293 != NGX_OK) 293 != NGX_OK)
294 { 294 {
295 return NGX_ERROR; 295 return NGX_ERROR;
296 } 296 }
297 297
298 if (tokens.len == 3 298 if (tokens.len == 0
299 && ngx_strncmp(tokens.data, "off", 3) == 0) 299 || (tokens.len == 3 && ngx_strncmp(tokens.data, "off", 3) == 0))
300 { 300 {
301 ngx_str_set(&tokens, ngx_http_server_string); 301 ngx_str_set(&tokens, ngx_http_server_string);
302 302
303 } else if (tokens.len) { 303 } else {
304 ngx_str_set(&tokens, ngx_http_server_full_string); 304 ngx_str_set(&tokens, ngx_http_server_full_string);
305 } 305 }
306 } 306 }
307 307
308 len += tokens.len; 308 len += tokens.len;
479 } else { 479 } else {
480 b->last = ngx_sprintf(b->last, "%03ui ", status); 480 b->last = ngx_sprintf(b->last, "%03ui ", status);
481 } 481 }
482 *b->last++ = CR; *b->last++ = LF; 482 *b->last++ = CR; *b->last++ = LF;
483 483
484 if (r->headers_out.server == NULL && tokens.len) { 484 if (r->headers_out.server == NULL) {
485 b->last = ngx_cpymem(b->last, tokens.data, tokens.len); 485 b->last = ngx_cpymem(b->last, tokens.data, tokens.len);
486 } 486 }
487 487
488 if (r->headers_out.date == NULL) { 488 if (r->headers_out.date == NULL) {
489 b->last = ngx_cpymem(b->last, "Date: ", sizeof("Date: ") - 1); 489 b->last = ngx_cpymem(b->last, "Date: ", sizeof("Date: ") - 1);