comparison src/http/ngx_http_header_filter_module.c @ 70:8ad297c88dcb NGINX_0_1_35

nginx 0.1.35 *) Feature: the "working_directory" directive. *) Feature: the "port_in_redirect" directive. *) Bugfix: the segmentation fault was occurred if the backend response header was in several packets; bug appeared in 0.1.29. *) Bugfix: if more than 10 servers were configured or some server did not use the "listen" directive, then the segmentation fault was occurred on the start. *) Bugfix: the segmentation fault might occur if the response was bigger than the temporary file. *) Bugfix: nginx returned the 400 response on requests like "GET http://www.domain.com/uri HTTP/1.0"; bug appeared in 0.1.28.
author Igor Sysoev <http://sysoev.ru>
date Tue, 07 Jun 2005 00:00:00 +0400
parents 818201e5a553
children 71c46860eb55
comparison
equal deleted inserted replaced
69:cce7ea52608c 70:8ad297c88dcb
256 && r->headers_out.last_modified_time != -1) 256 && r->headers_out.last_modified_time != -1)
257 { 257 {
258 len += sizeof("Last-Modified: Mon, 28 Sep 1970 06:00:00 GMT" CRLF) - 1; 258 len += sizeof("Last-Modified: Mon, 28 Sep 1970 06:00:00 GMT" CRLF) - 1;
259 } 259 }
260 260
261 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
262
261 if (r->headers_out.location 263 if (r->headers_out.location
262 && r->headers_out.location->value.len 264 && r->headers_out.location->value.len
263 && r->headers_out.location->value.data[0] == '/') 265 && r->headers_out.location->value.data[0] == '/')
264 { 266 {
265 r->headers_out.location->hash = 0; 267 r->headers_out.location->hash = 0;
268 if (r->connection->ssl) { 270 if (r->connection->ssl) {
269 len += sizeof("Location: https://") - 1 271 len += sizeof("Location: https://") - 1
270 + r->server_name.len 272 + r->server_name.len
271 + r->headers_out.location->value.len + 2; 273 + r->headers_out.location->value.len + 2;
272 274
273 if (r->port != 443) { 275 if (clcf->port_in_redirect && r->port != 443) {
274 len += r->port_text->len; 276 len += r->port_text->len;
275 } 277 }
276 278
277 } else 279 } else
278 #endif 280 #endif
279 { 281 {
280 len += sizeof("Location: http://") - 1 282 len += sizeof("Location: http://") - 1
281 + r->server_name.len 283 + r->server_name.len
282 + r->headers_out.location->value.len + 2; 284 + r->headers_out.location->value.len + 2;
283 285
284 if (r->port != 80) { 286 if (clcf->port_in_redirect && r->port != 80) {
285 len += r->port_text->len; 287 len += r->port_text->len;
286 } 288 }
287 } 289 }
288 } 290 }
289 291
290 if (r->chunked) { 292 if (r->chunked) {
291 len += sizeof("Transfer-Encoding: chunked" CRLF) - 1; 293 len += sizeof("Transfer-Encoding: chunked" CRLF) - 1;
292 } 294 }
293
294 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
295 295
296 if (r->keepalive) { 296 if (r->keepalive) {
297 len += sizeof("Connection: keep-alive" CRLF) - 1; 297 len += sizeof("Connection: keep-alive" CRLF) - 1;
298 298
299 /* 299 /*
423 423
424 *b->last++ = ':'; *b->last++ = '/'; *b->last++ = '/'; 424 *b->last++ = ':'; *b->last++ = '/'; *b->last++ = '/';
425 b->last = ngx_cpymem(b->last, r->server_name.data, 425 b->last = ngx_cpymem(b->last, r->server_name.data,
426 r->server_name.len); 426 r->server_name.len);
427 427
428 if (clcf->port_in_redirect) {
428 #if (NGX_HTTP_SSL) 429 #if (NGX_HTTP_SSL)
429 if (r->connection->ssl) { 430 if (r->connection->ssl) {
430 if (r->port != 443) { 431 if (r->port != 443) {
431 b->last = ngx_cpymem(b->last, r->port_text->data, 432 b->last = ngx_cpymem(b->last, r->port_text->data,
432 r->port_text->len); 433 r->port_text->len);
433 } 434 }
434 } else 435 } else
435 #endif 436 #endif
436 { 437 {
437 if (r->port != 80) { 438 if (r->port != 80) {
438 b->last = ngx_cpymem(b->last, r->port_text->data, 439 b->last = ngx_cpymem(b->last, r->port_text->data,
439 r->port_text->len); 440 r->port_text->len);
441 }
440 } 442 }
441 } 443 }
442 444
443 b->last = ngx_cpymem(b->last, r->headers_out.location->value.data, 445 b->last = ngx_cpymem(b->last, r->headers_out.location->value.data,
444 r->headers_out.location->value.len); 446 r->headers_out.location->value.len);