@@ -108,7 +108,7 @@ static const char *method_strings[] =
108108
109109/* ' ', '_', '-' and all alpha-numeric ascii characters are accepted by acceptable_header.
110110 The 'A'-'Z' are lower-cased. */
111- static const unsigned char acceptable_header [256 ] = {
111+ static const char acceptable_header [256 ] = {
112112/* 0 nul 1 soh 2 stx 3 etx 4 eot 5 enq 6 ack 7 bel */
113113 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
114114/* 8 bs 9 ht 10 nl 11 vt 12 np 13 cr 14 so 15 si */
@@ -143,7 +143,7 @@ static const unsigned char acceptable_header[256] = {
143143 'x' , 'y' , 'z' , 0 , 0 , 0 , 0 , 0 };
144144
145145
146- static const int unhex [256 ] =
146+ static const int8_t unhex [256 ] =
147147 {-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1
148148 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1
149149 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1
@@ -155,7 +155,7 @@ static const int unhex[256] =
155155 };
156156
157157
158- static const int normal_url_char [256 ] = {
158+ static const uint8_t normal_url_char [256 ] = {
159159/* 0 nul 1 soh 2 stx 3 etx 4 eot 5 enq 6 ack 7 bel */
160160 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
161161/* 8 bs 9 ht 10 nl 11 vt 12 np 13 cr 14 so 15 si */
@@ -600,7 +600,7 @@ size_t http_parser_execute (http_parser *parser,
600600 if (ch == ' ' && matcher [index ] == '\0' ) {
601601 state = s_req_spaces_before_url ;
602602 } else if (ch == matcher [index ]) {
603- ; // nada
603+ ; /* nada */
604604 } else if (parser -> method == HTTP_CONNECT ) {
605605 if (index == 1 && ch == 'H' ) {
606606 parser -> method = HTTP_CHECKOUT ;
@@ -772,7 +772,7 @@ size_t http_parser_execute (http_parser *parser,
772772
773773 switch (ch ) {
774774 case '?' :
775- break ; // XXX ignore extra '?' ... is this right?
775+ break ; /* XXX ignore extra '?' ... is this right? */
776776 case ' ' :
777777 CALLBACK (url );
778778 state = s_req_http_start ;
@@ -802,7 +802,7 @@ size_t http_parser_execute (http_parser *parser,
802802
803803 switch (ch ) {
804804 case '?' :
805- // allow extra '?' in query string
805+ /* allow extra '?' in query string */
806806 break ;
807807 case ' ' :
808808 CALLBACK (url );
@@ -1264,6 +1264,7 @@ size_t http_parser_execute (http_parser *parser,
12641264 break ;
12651265
12661266 case h_content_length :
1267+ if (ch == ' ' ) break ;
12671268 if (ch < '0' || ch > '9' ) goto error ;
12681269 parser -> content_length *= 10 ;
12691270 parser -> content_length += ch - '0' ;
@@ -1376,7 +1377,7 @@ size_t http_parser_execute (http_parser *parser,
13761377 }
13771378 }
13781379
1379- // Exit, the rest of the connect is in a different protocol.
1380+ /* Exit, the rest of the connect is in a different protocol. */
13801381 if (parser -> upgrade ) {
13811382 CALLBACK2 (message_complete );
13821383 return (p - data );
@@ -1437,7 +1438,7 @@ size_t http_parser_execute (http_parser *parser,
14371438 {
14381439 assert (parser -> flags & F_CHUNKED );
14391440
1440- c = unhex [(int )ch ];
1441+ c = unhex [(unsigned char )ch ];
14411442 if (c == -1 ) goto error ;
14421443 parser -> content_length = c ;
14431444 state = s_chunk_size ;
@@ -1453,7 +1454,7 @@ size_t http_parser_execute (http_parser *parser,
14531454 break ;
14541455 }
14551456
1456- c = unhex [(int )ch ];
1457+ c = unhex [(unsigned char )ch ];
14571458
14581459 if (c == -1 ) {
14591460 if (ch == ';' || ch == ' ' ) {
@@ -1545,6 +1546,7 @@ size_t http_parser_execute (http_parser *parser,
15451546 return len ;
15461547
15471548error :
1549+ parser -> state = s_dead ;
15481550 return (p - data );
15491551}
15501552
0 commit comments