comparison src/http/ngx_http_core_module.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
1528 1528
1529 1529
1530 void * 1530 void *
1531 ngx_http_test_content_type(ngx_http_request_t *r, ngx_hash_t *types_hash) 1531 ngx_http_test_content_type(ngx_http_request_t *r, ngx_hash_t *types_hash)
1532 { 1532 {
1533 u_char c, *p; 1533 u_char c, *lowcase;
1534 ngx_uint_t i, hash; 1534 size_t len;
1535 ngx_uint_t i, hash;
1535 1536
1536 if (r->headers_out.content_type.len == 0) { 1537 if (r->headers_out.content_type.len == 0) {
1537 return NULL; 1538 return NULL;
1538 } 1539 }
1539 1540
1541 len = r->headers_out.content_type_len;
1542
1540 if (r->headers_out.content_type_lowcase == NULL) { 1543 if (r->headers_out.content_type_lowcase == NULL) {
1541 1544
1542 p = ngx_pnalloc(r->pool, r->headers_out.content_type_len); 1545 lowcase = ngx_pnalloc(r->pool, len);
1543 1546 if (lowcase == NULL) {
1544 if (p == NULL) {
1545 return NULL; 1547 return NULL;
1546 } 1548 }
1547 1549
1548 r->headers_out.content_type_lowcase = p; 1550 r->headers_out.content_type_lowcase = lowcase;
1549 1551
1550 hash = 0; 1552 hash = 0;
1551 1553
1552 for (i = 0; i < r->headers_out.content_type_len; i++) { 1554 for (i = 0; i < len; i++) {
1553 c = ngx_tolower(r->headers_out.content_type.data[i]); 1555 c = ngx_tolower(r->headers_out.content_type.data[i]);
1554 hash = ngx_hash(hash, c); 1556 hash = ngx_hash(hash, c);
1555 *p++ = c; 1557 lowcase[i] = c;
1556 } 1558 }
1557 1559
1558 r->headers_out.content_type_hash = hash; 1560 r->headers_out.content_type_hash = hash;
1559 } 1561 }
1560 1562
1561 return ngx_hash_find(types_hash, 1563 return ngx_hash_find(types_hash, r->headers_out.content_type_hash,
1562 r->headers_out.content_type_hash, 1564 r->headers_out.content_type_lowcase, len);
1563 r->headers_out.content_type_lowcase,
1564 r->headers_out.content_type_len);
1565 } 1565 }
1566 1566
1567 1567
1568 ngx_int_t 1568 ngx_int_t
1569 ngx_http_set_content_type(ngx_http_request_t *r) 1569 ngx_http_set_content_type(ngx_http_request_t *r)