comparison src/http/ngx_http_header_filter_module.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 c5c2b2883984
children 9121a0a91f47
comparison
equal deleted inserted replaced
341:183b4761fe5b 342:4276c2f1f434
43 NULL, /* exit master */ 43 NULL, /* exit master */
44 NGX_MODULE_V1_PADDING 44 NGX_MODULE_V1_PADDING
45 }; 45 };
46 46
47 47
48 static char ngx_http_server_string[] = "Server: " NGINX_VER CRLF; 48 static char ngx_http_server_string[] = "Server: nginx" CRLF;
49 static char ngx_http_server_full_string[] = "Server: " NGINX_VER CRLF;
49 50
50 51
51 static ngx_str_t ngx_http_status_lines[] = { 52 static ngx_str_t ngx_http_status_lines[] = {
52 53
53 ngx_string("200 OK"), 54 ngx_string("200 OK"),
235 } 236 }
236 237
237 len += ngx_http_status_lines[status].len; 238 len += ngx_http_status_lines[status].len;
238 } 239 }
239 240
241 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
242
240 if (r->headers_out.server == NULL) { 243 if (r->headers_out.server == NULL) {
241 len += sizeof(ngx_http_server_string) - 1; 244 len += clcf->server_tokens ? sizeof(ngx_http_server_full_string) - 1:
245 sizeof(ngx_http_server_string) - 1;
242 } 246 }
243 247
244 if (r->headers_out.date == NULL) { 248 if (r->headers_out.date == NULL) {
245 len += sizeof("Date: Mon, 28 Sep 1970 06:00:00 GMT" CRLF) - 1; 249 len += sizeof("Date: Mon, 28 Sep 1970 06:00:00 GMT" CRLF) - 1;
246 } 250 }
265 if (r->headers_out.last_modified == NULL 269 if (r->headers_out.last_modified == NULL
266 && r->headers_out.last_modified_time != -1) 270 && r->headers_out.last_modified_time != -1)
267 { 271 {
268 len += sizeof("Last-Modified: Mon, 28 Sep 1970 06:00:00 GMT" CRLF) - 1; 272 len += sizeof("Last-Modified: Mon, 28 Sep 1970 06:00:00 GMT" CRLF) - 1;
269 } 273 }
270
271 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
272 274
273 if (r->headers_out.location 275 if (r->headers_out.location
274 && r->headers_out.location->value.len 276 && r->headers_out.location->value.len
275 && r->headers_out.location->value.data[0] == '/') 277 && r->headers_out.location->value.data[0] == '/')
276 { 278 {
363 ngx_http_status_lines[status].len); 365 ngx_http_status_lines[status].len);
364 } 366 }
365 *b->last++ = CR; *b->last++ = LF; 367 *b->last++ = CR; *b->last++ = LF;
366 368
367 if (r->headers_out.server == NULL) { 369 if (r->headers_out.server == NULL) {
368 b->last = ngx_cpymem(b->last, ngx_http_server_string, 370 if (clcf->server_tokens) {
369 sizeof(ngx_http_server_string) - 1); 371 p = (u_char *) ngx_http_server_full_string;
372 len = sizeof(ngx_http_server_full_string) - 1;
373
374 } else {
375 p = (u_char *) ngx_http_server_string;
376 len = sizeof(ngx_http_server_string) - 1;
377 }
378
379 b->last = ngx_cpymem(b->last, p, len);
370 } 380 }
371 381
372 if (r->headers_out.date == NULL) { 382 if (r->headers_out.date == NULL) {
373 b->last = ngx_cpymem(b->last, "Date: ", sizeof("Date: ") - 1); 383 b->last = ngx_cpymem(b->last, "Date: ", sizeof("Date: ") - 1);
374 b->last = ngx_cpymem(b->last, ngx_cached_http_time.data, 384 b->last = ngx_cpymem(b->last, ngx_cached_http_time.data,