comparison src/http/ngx_http_parse.c @ 412:b246022ef454 NGINX_0_7_18

nginx 0.7.18 *) Change: the "underscores_in_headers" directive; now nginx does not allows underscores in a client request header line names. *) Feature: the ngx_http_secure_link_module. *) Feature: the "real_ip_header" directive supports any header. *) Feature: the "log_subrequest" directive. *) Feature: the $realpath_root variable. *) Feature: the "http_502" and "http_504" parameters of the "proxy_next_upstream" directive. *) Bugfix: the "http_503" parameter of the "proxy_next_upstream" or "fastcgi_next_upstream" directives did not work. *) Bugfix: nginx might send a "Transfer-Encoding: chunked" heaer line for HEAD requests. *) Bugfix: now accept threshold depends on worker_connections.
author Igor Sysoev <http://sysoev.ru>
date Mon, 13 Oct 2008 00:00:00 +0400
parents 79c5df00501e
children fd759445d8a8
comparison
equal deleted inserted replaced
411:b453a4324c60 412:b246022ef454
698 return NGX_OK; 698 return NGX_OK;
699 } 699 }
700 700
701 701
702 ngx_int_t 702 ngx_int_t
703 ngx_http_parse_header_line(ngx_http_request_t *r, ngx_buf_t *b) 703 ngx_http_parse_header_line(ngx_http_request_t *r, ngx_buf_t *b,
704 ngx_uint_t allow_underscores)
704 { 705 {
705 u_char c, ch, *p; 706 u_char c, ch, *p;
706 ngx_uint_t hash, i; 707 ngx_uint_t hash, i;
707 enum { 708 enum {
708 sw_start = 0, 709 sw_start = 0,
718 /* the last '\0' is not needed because string is zero terminated */ 719 /* the last '\0' is not needed because string is zero terminated */
719 720
720 static u_char lowcase[] = 721 static u_char lowcase[] =
721 "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" 722 "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
722 "\0\0\0\0\0\0\0\0\0\0\0\0\0-\0\0" "0123456789\0\0\0\0\0\0" 723 "\0\0\0\0\0\0\0\0\0\0\0\0\0-\0\0" "0123456789\0\0\0\0\0\0"
723 "\0abcdefghijklmnopqrstuvwxyz\0\0\0\0_" 724 "\0abcdefghijklmnopqrstuvwxyz\0\0\0\0\0"
724 "\0abcdefghijklmnopqrstuvwxyz\0\0\0\0\0" 725 "\0abcdefghijklmnopqrstuvwxyz\0\0\0\0\0"
725 "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" 726 "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
726 "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" 727 "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
727 "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" 728 "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
728 "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; 729 "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
774 775
775 if (c) { 776 if (c) {
776 hash = ngx_hash(hash, c); 777 hash = ngx_hash(hash, c);
777 r->lowcase_header[i++] = c; 778 r->lowcase_header[i++] = c;
778 i &= (NGX_HTTP_LC_HEADER_LEN - 1); 779 i &= (NGX_HTTP_LC_HEADER_LEN - 1);
780 break;
781 }
782
783 if (ch == '_') {
784 if (allow_underscores) {
785 hash = ngx_hash(hash, ch);
786 r->lowcase_header[i++] = ch;
787 i &= (NGX_HTTP_LC_HEADER_LEN - 1);
788
789 } else {
790 r->invalid_header = 1;
791 }
792
779 break; 793 break;
780 } 794 }
781 795
782 if (ch == ':') { 796 if (ch == ':') {
783 r->header_name_end = p; 797 r->header_name_end = p;