Mercurial > hg > nginx-vendor-0-7
comparison src/http/ngx_http_upstream.c @ 502:89dc5654117c NGINX_0_7_63
nginx 0.7.63
*) Security: now "/../" are disabled in "Destination" request header
line.
*) Change: minimum supported OpenSSL version is 0.9.7.
*) Change: the "ask" parameter of the "ssl_verify_client" directive was
changed to the "optional" parameter and now it checks a client
certificate if it was offered.
Thanks to Brice Figureau.
*) Feature: now the "-V" switch shows TLS SNI support.
*) Feature: the $ssl_client_verify variable.
Thanks to Brice Figureau.
*) Feature: the "ssl_crl" directive.
Thanks to Brice Figureau.
*) Bugfix: the $ssl_client_cert variable usage corrupted memory; the
bug had appeared in 0.7.7.
Thanks to Sergey Zhuravlev.
*) Feature: now the start cache loader runs in a separate process; this
should improve large caches handling.
*) Feature: now temporary files and permanent storage area may reside
at different file systems.
*) Bugfix: nginx counted incorrectly disk cache size.
*) Change: now directive "gzip_disable msie6" does not disable gzipping
for MSIE 6.0 SV1.
*) Bugfix: nginx always added "Vary: Accept-Encoding" response header
line, if both "gzip_static" and "gzip_vary" were on.
*) Feature: the "proxy" parameter of the "geo" directive.
*) Feature: the ngx_http_geoip_module.
*) Feature: the "limit_rate_after" directive.
Thanks to Ivan Debnar.
*) Feature: the "limit_req_log_level" and "limit_conn_log_level"
directives.
*) Bugfix: now "limit_req" directive conforms to the leaky bucket
algorithm.
Thanks to Maxim Dounin.
*) Bugfix: in ngx_http_limit_req_module.
Thanks to Maxim Dounin.
*) Bugfix: now nginx allows underscores in a request method.
*) Bugfix: "proxy_pass_header" and "fastcgi_pass_header" directives did
not pass to a client the "X-Accel-Redirect", "X-Accel-Limit-Rate",
"X-Accel-Buffering", and "X-Accel-Charset" lines from backend
response header.
Thanks to Maxim Dounin.
*) Bugfix: in handling "Last-Modified" and "Accept-Ranges" backend
response header lines; the bug had appeared in 0.7.44.
Thanks to Maxim Dounin.
*) Feature: the "image_filter_transparency" directive.
*) Feature: the "image_filter" directive supports variables for setting
size.
*) Bugfix: in PNG alpha-channel support in the
ngx_http_image_filter_module.
*) Bugfix: in transparency support in the ngx_http_image_filter_module.
*) Feature: now several "perl_modules" directives may be used.
*) Bugfix: ngx_http_perl_module responses did not work in subrequests.
*) Bugfix: nginx sent '\0' in a "Location" response header line on
MKCOL request.
Thanks to Xie Zhenye.
*) Bugfix: an "error_page" directive did not redirect a 413 error; the
bug had appeared in 0.6.10.
*) Bugfix: in memory allocation error handling.
Thanks to Maxim Dounin and Kirill A. Korinskiy.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 26 Oct 2009 00:00:00 +0300 |
parents | ed3d382670c7 |
children | b9fdcaf2062b |
comparison
equal
deleted
inserted
replaced
501:dc87c92181c7 | 502:89dc5654117c |
---|---|
228 ngx_http_upstream_copy_header_line, 0, 0 }, | 228 ngx_http_upstream_copy_header_line, 0, 0 }, |
229 | 229 |
230 { ngx_string("X-Accel-Redirect"), | 230 { ngx_string("X-Accel-Redirect"), |
231 ngx_http_upstream_process_header_line, | 231 ngx_http_upstream_process_header_line, |
232 offsetof(ngx_http_upstream_headers_in_t, x_accel_redirect), | 232 offsetof(ngx_http_upstream_headers_in_t, x_accel_redirect), |
233 ngx_http_upstream_ignore_header_line, 0, 0 }, | 233 ngx_http_upstream_copy_header_line, 0, 0 }, |
234 | 234 |
235 { ngx_string("X-Accel-Limit-Rate"), | 235 { ngx_string("X-Accel-Limit-Rate"), |
236 ngx_http_upstream_process_limit_rate, 0, | 236 ngx_http_upstream_process_limit_rate, 0, |
237 ngx_http_upstream_ignore_header_line, 0, 0 }, | 237 ngx_http_upstream_copy_header_line, 0, 0 }, |
238 | 238 |
239 { ngx_string("X-Accel-Buffering"), | 239 { ngx_string("X-Accel-Buffering"), |
240 ngx_http_upstream_process_buffering, 0, | 240 ngx_http_upstream_process_buffering, 0, |
241 ngx_http_upstream_ignore_header_line, 0, 0 }, | 241 ngx_http_upstream_copy_header_line, 0, 0 }, |
242 | 242 |
243 { ngx_string("X-Accel-Charset"), | 243 { ngx_string("X-Accel-Charset"), |
244 ngx_http_upstream_process_charset, 0, | 244 ngx_http_upstream_process_charset, 0, |
245 ngx_http_upstream_ignore_header_line, 0, 0 }, | 245 ngx_http_upstream_copy_header_line, 0, 0 }, |
246 | 246 |
247 #if (NGX_HTTP_GZIP) | 247 #if (NGX_HTTP_GZIP) |
248 { ngx_string("Content-Encoding"), | 248 { ngx_string("Content-Encoding"), |
249 ngx_http_upstream_process_header_line, | 249 ngx_http_upstream_process_header_line, |
250 offsetof(ngx_http_upstream_headers_in_t, content_encoding), | 250 offsetof(ngx_http_upstream_headers_in_t, content_encoding), |
352 { ngx_string("POST"), NGX_HTTP_POST }, | 352 { ngx_string("POST"), NGX_HTTP_POST }, |
353 { ngx_null_string, 0 } | 353 { ngx_null_string, 0 } |
354 }; | 354 }; |
355 | 355 |
356 | 356 |
357 ngx_int_t | |
358 ngx_http_upstream_create(ngx_http_request_t *r) | |
359 { | |
360 ngx_http_upstream_t *u; | |
361 | |
362 u = r->upstream; | |
363 | |
364 if (u && u->cleanup) { | |
365 ngx_http_upstream_cleanup(r); | |
366 *u->cleanup = NULL; | |
367 } | |
368 | |
369 u = ngx_pcalloc(r->pool, sizeof(ngx_http_upstream_t)); | |
370 if (u == NULL) { | |
371 return NGX_ERROR; | |
372 } | |
373 | |
374 r->upstream = u; | |
375 | |
376 u->peer.log = r->connection->log; | |
377 u->peer.log_error = NGX_ERROR_ERR; | |
378 #if (NGX_THREADS) | |
379 u->peer.lock = &r->connection->lock; | |
380 #endif | |
381 | |
382 return NGX_OK; | |
383 } | |
384 | |
385 | |
357 void | 386 void |
358 ngx_http_upstream_init(ngx_http_request_t *r) | 387 ngx_http_upstream_init(ngx_http_request_t *r) |
359 { | 388 { |
360 ngx_str_t *host; | 389 ngx_str_t *host; |
361 ngx_uint_t i; | 390 ngx_uint_t i; |
1731 } | 1760 } |
1732 | 1761 |
1733 uri = &u->headers_in.x_accel_redirect->value; | 1762 uri = &u->headers_in.x_accel_redirect->value; |
1734 args.len = 0; | 1763 args.len = 0; |
1735 args.data = NULL; | 1764 args.data = NULL; |
1736 flags = 0; | 1765 flags = NGX_HTTP_LOG_UNSAFE; |
1737 | 1766 |
1738 if (ngx_http_parse_unsafe_uri(r, uri, &args, &flags) != NGX_OK) { | 1767 if (ngx_http_parse_unsafe_uri(r, uri, &args, &flags) != NGX_OK) { |
1739 ngx_http_finalize_request(r, NGX_HTTP_NOT_FOUND); | 1768 ngx_http_finalize_request(r, NGX_HTTP_NOT_FOUND); |
1740 return NGX_DONE; | 1769 return NGX_DONE; |
1741 } | 1770 } |
2031 | 2060 |
2032 if (valid) { | 2061 if (valid) { |
2033 r->cache->last_modified = r->headers_out.last_modified_time; | 2062 r->cache->last_modified = r->headers_out.last_modified_time; |
2034 r->cache->date = now; | 2063 r->cache->date = now; |
2035 r->cache->body_start = (u_short) (u->buffer.pos - u->buffer.start); | 2064 r->cache->body_start = (u_short) (u->buffer.pos - u->buffer.start); |
2036 | |
2037 if (r->headers_out.content_length_n != -1) { | |
2038 r->cache->length = r->cache->body_start | |
2039 + r->headers_out.content_length_n; | |
2040 } | |
2041 | 2065 |
2042 ngx_http_file_cache_set_header(r, u->buffer.start); | 2066 ngx_http_file_cache_set_header(r, u->buffer.start); |
2043 | 2067 |
2044 } else { | 2068 } else { |
2045 u->cacheable = 0; | 2069 u->cacheable = 0; |
2614 ext.access = u->conf->store_access; | 2638 ext.access = u->conf->store_access; |
2615 ext.path_access = u->conf->store_access; | 2639 ext.path_access = u->conf->store_access; |
2616 ext.time = -1; | 2640 ext.time = -1; |
2617 ext.create_path = 1; | 2641 ext.create_path = 1; |
2618 ext.delete_file = 1; | 2642 ext.delete_file = 1; |
2619 ext.log_rename_error = 1; | |
2620 ext.log = r->connection->log; | 2643 ext.log = r->connection->log; |
2621 | 2644 |
2622 if (u->headers_in.last_modified) { | 2645 if (u->headers_in.last_modified) { |
2623 | 2646 |
2624 lm = ngx_http_parse_time(u->headers_in.last_modified->value.data, | 2647 lm = ngx_http_parse_time(u->headers_in.last_modified->value.data, |
2641 { | 2664 { |
2642 return; | 2665 return; |
2643 } | 2666 } |
2644 } | 2667 } |
2645 | 2668 |
2669 path.len--; | |
2670 | |
2646 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 2671 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
2647 "upstream stores \"%s\" to \"%s\"", | 2672 "upstream stores \"%s\" to \"%s\"", |
2648 tf->file.name.data, path.data); | 2673 tf->file.name.data, path.data); |
2649 | 2674 |
2650 (void) ngx_ext_rename_file(&tf->file.name, &path, &ext); | 2675 (void) ngx_ext_rename_file(&tf->file.name, &path, &ext); |
2862 u->pipe->temp_file->file.fd); | 2887 u->pipe->temp_file->file.fd); |
2863 } | 2888 } |
2864 | 2889 |
2865 #if (NGX_HTTP_CACHE) | 2890 #if (NGX_HTTP_CACHE) |
2866 | 2891 |
2867 if (u->cacheable) { | 2892 if (u->cacheable && r->cache) { |
2868 time_t valid; | 2893 time_t valid; |
2869 | 2894 |
2870 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 2895 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
2871 "http upstream cache fd: %d", | 2896 "http upstream cache fd: %d", |
2872 r->cache->file.fd); | 2897 r->cache->file.fd); |
2896 return; | 2921 return; |
2897 } | 2922 } |
2898 | 2923 |
2899 r->connection->log->action = "sending to client"; | 2924 r->connection->log->action = "sending to client"; |
2900 | 2925 |
2901 if (rc == 0 && r == r->main && !r->post_action) { | 2926 if (rc == 0) { |
2902 rc = ngx_http_send_special(r, NGX_HTTP_LAST); | 2927 rc = ngx_http_send_special(r, NGX_HTTP_LAST); |
2903 } | 2928 } |
2904 | 2929 |
2905 ngx_http_finalize_request(r, rc); | 2930 ngx_http_finalize_request(r, rc); |
2906 } | 2931 } |
3309 return NGX_ERROR; | 3334 return NGX_ERROR; |
3310 } | 3335 } |
3311 | 3336 |
3312 *ho = *h; | 3337 *ho = *h; |
3313 | 3338 |
3339 r->headers_out.last_modified = ho; | |
3340 | |
3314 #if (NGX_HTTP_CACHE) | 3341 #if (NGX_HTTP_CACHE) |
3315 | 3342 |
3316 if (r->upstream->cacheable) { | 3343 if (r->upstream->cacheable) { |
3317 r->headers_out.last_modified = ho; | |
3318 r->headers_out.last_modified_time = ngx_http_parse_time(h->value.data, | 3344 r->headers_out.last_modified_time = ngx_http_parse_time(h->value.data, |
3319 h->value.len); | 3345 h->value.len); |
3320 } | 3346 } |
3321 | 3347 |
3322 #endif | 3348 #endif |
3435 if (ho == NULL) { | 3461 if (ho == NULL) { |
3436 return NGX_ERROR; | 3462 return NGX_ERROR; |
3437 } | 3463 } |
3438 | 3464 |
3439 *ho = *h; | 3465 *ho = *h; |
3466 | |
3467 r->headers_out.accept_ranges = ho; | |
3440 | 3468 |
3441 return NGX_OK; | 3469 return NGX_OK; |
3442 } | 3470 } |
3443 | 3471 |
3444 | 3472 |
4272 | 4300 |
4273 if (ngx_array_init(&umcf->upstreams, cf->pool, 4, | 4301 if (ngx_array_init(&umcf->upstreams, cf->pool, 4, |
4274 sizeof(ngx_http_upstream_srv_conf_t *)) | 4302 sizeof(ngx_http_upstream_srv_conf_t *)) |
4275 != NGX_OK) | 4303 != NGX_OK) |
4276 { | 4304 { |
4277 return NGX_CONF_ERROR; | 4305 return NULL; |
4278 } | 4306 } |
4279 | 4307 |
4280 return umcf; | 4308 return umcf; |
4281 } | 4309 } |
4282 | 4310 |