Mercurial > hg > nginx-quic
comparison src/http/ngx_http_parse.c @ 2256:8c17cfe63d2c
underscores_in_headers
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 24 Sep 2008 14:02:50 +0000 |
parents | c53038422c02 |
children | d311b7f6a403 |
comparison
equal
deleted
inserted
replaced
2255:fb7995c7bdd9 | 2256:8c17cfe63d2c |
---|---|
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; |