comparison src/http/ngx_http_parse.c @ 7580:8f55cb5c7e79

Fixed header parsing with ignore_invalid_headers switched off. The parsing was broken when the first character of the header name was invalid. Based on a patch by Alan Kemp.
author Ruslan Ermilov <ru@nginx.com>
date Tue, 15 Oct 2019 14:46:10 +0300
parents 6208c5418c88
children 8989fbd2f89a 38c0898b6df7
comparison
equal deleted inserted replaced
7579:6208c5418c88 7580:8f55cb5c7e79
910 hash = ngx_hash(0, ch); 910 hash = ngx_hash(0, ch);
911 r->lowcase_header[0] = ch; 911 r->lowcase_header[0] = ch;
912 i = 1; 912 i = 1;
913 913
914 } else { 914 } else {
915 hash = 0;
916 i = 0;
915 r->invalid_header = 1; 917 r->invalid_header = 1;
916 } 918 }
917 919
918 break; 920 break;
919 } 921 }
920 922
921 if (ch == '\0') { 923 if (ch == '\0') {
922 return NGX_HTTP_PARSE_INVALID_HEADER; 924 return NGX_HTTP_PARSE_INVALID_HEADER;
923 } 925 }
924 926
927 hash = 0;
928 i = 0;
925 r->invalid_header = 1; 929 r->invalid_header = 1;
926 930
927 break; 931 break;
928 932
929 } 933 }