comparison src/http/ngx_http_upstream.c @ 494:499474178a11 NGINX_0_7_59

nginx 0.7.59 *) Feature: the "proxy_cache_methods" and "fastcgi_cache_methods" directives. *) Bugfix: socket leak; the bug had appeared in 0.7.25. Thanks to Maxim Dounin. *) Bugfix: a segmentation fault occurred in worker process, if a request had no body and the $request_body variable was used; the bug had appeared in 0.7.58. *) Bugfix: the SSL modules might not built on Solaris and Linux; the bug had appeared in 0.7.58. *) Bugfix: ngx_http_xslt_filter_module responses were not handled by SSI, charset, and gzip filters. *) Bugfix: a "charset" directive did not set a charset to ngx_http_gzip_static_module responses.
author Igor Sysoev <http://sysoev.ru>
date Mon, 25 May 2009 00:00:00 +0400
parents 98143f74eb3d
children f39b9e29530d
comparison
equal deleted inserted replaced
493:d13d7ebf1370 494:499474178a11
327 { 504, NGX_HTTP_UPSTREAM_FT_HTTP_504 }, 327 { 504, NGX_HTTP_UPSTREAM_FT_HTTP_504 },
328 { 404, NGX_HTTP_UPSTREAM_FT_HTTP_404 }, 328 { 404, NGX_HTTP_UPSTREAM_FT_HTTP_404 },
329 { 0, 0 } 329 { 0, 0 }
330 }; 330 };
331 331
332
333 ngx_conf_bitmask_t ngx_http_upstream_cache_method_mask[] = {
334 { ngx_string("GET"), NGX_HTTP_GET},
335 { ngx_string("HEAD"), NGX_HTTP_HEAD },
336 { ngx_string("POST"), NGX_HTTP_POST },
337 { ngx_null_string, 0 }
338 };
339
340
332 void 341 void
333 ngx_http_upstream_init(ngx_http_request_t *r) 342 ngx_http_upstream_init(ngx_http_request_t *r)
334 { 343 {
335 ngx_str_t *host; 344 ngx_str_t *host;
336 ngx_uint_t i; 345 ngx_uint_t i;
530 ngx_http_upstream_cache(ngx_http_request_t *r, ngx_http_upstream_t *u) 539 ngx_http_upstream_cache(ngx_http_request_t *r, ngx_http_upstream_t *u)
531 { 540 {
532 ngx_int_t rc; 541 ngx_int_t rc;
533 ngx_http_cache_t *c; 542 ngx_http_cache_t *c;
534 543
535 if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD))) { 544 if (!(r->method & u->conf->cache_methods)) {
536 return NGX_DECLINED; 545 return NGX_DECLINED;
537 } 546 }
538 547
539 if (r->method & NGX_HTTP_HEAD) { 548 if (r->method & NGX_HTTP_HEAD) {
540 u->method = ngx_http_core_get_method; 549 u->method = ngx_http_core_get_method;
560 569
561 ngx_http_file_cache_create_key(r); 570 ngx_http_file_cache_create_key(r);
562 571
563 u->cacheable = 1; 572 u->cacheable = 1;
564 573
565 c->min_uses = r->upstream->conf->cache_min_uses; 574 c->min_uses = u->conf->cache_min_uses;
566 c->body_start = r->upstream->conf->buffer_size; 575 c->body_start = u->conf->buffer_size;
567 c->file_cache = u->conf->cache->data; 576 c->file_cache = u->conf->cache->data;
568 577
569 rc = ngx_http_file_cache_open(r); 578 rc = ngx_http_file_cache_open(r);
570 579
571 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 580 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
3163 { 3172 {
3164 u_char *p, *last; 3173 u_char *p, *last;
3165 3174
3166 r->headers_out.content_type_len = h->value.len; 3175 r->headers_out.content_type_len = h->value.len;
3167 r->headers_out.content_type = h->value; 3176 r->headers_out.content_type = h->value;
3177 r->headers_out.content_type_lowcase = NULL;
3168 3178
3169 for (p = h->value.data; *p; p++) { 3179 for (p = h->value.data; *p; p++) {
3170 3180
3171 if (*p != ';') { 3181 if (*p != ';') {
3172 continue; 3182 continue;