File tree 2 files changed +10
-4
lines changed
2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ do { \
115
115
FOR ##_mark = NULL ; \
116
116
} \
117
117
} while (0 )
118
-
118
+
119
119
/* Run the data callback FOR and consume the current byte */
120
120
#define CALLBACK_DATA (FOR ) \
121
121
CALLBACK_DATA_(FOR, p - FOR##_mark, p - data + 1)
@@ -1389,7 +1389,7 @@ size_t http_parser_execute (http_parser *parser,
1389
1389
}
1390
1390
1391
1391
c = LOWER (ch );
1392
-
1392
+
1393
1393
switch (parser -> header_state ) {
1394
1394
case h_upgrade :
1395
1395
parser -> flags |= F_UPGRADE ;
@@ -1410,8 +1410,13 @@ size_t http_parser_execute (http_parser *parser,
1410
1410
SET_ERRNO (HPE_INVALID_CONTENT_LENGTH );
1411
1411
goto error ;
1412
1412
}
1413
+ if (parser -> set_content_length > 0 ) {
1414
+ SET_ERRNO (HPE_INVALID_CONTENT_LENGTH );
1415
+ goto error ;
1416
+ }
1413
1417
1414
1418
parser -> content_length = ch - '0' ;
1419
+ parser -> set_content_length = 1 ;
1415
1420
break ;
1416
1421
1417
1422
case h_connection :
@@ -1449,7 +1454,7 @@ size_t http_parser_execute (http_parser *parser,
1449
1454
}
1450
1455
1451
1456
c = LOWER (ch );
1452
-
1457
+
1453
1458
switch (parser -> header_state ) {
1454
1459
case h_general :
1455
1460
break ;
Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ enum flags
141
141
142
142
143
143
/* Map for errno-related constants
144
- *
144
+ *
145
145
* The provided argument should be a macro that takes 2 arguments.
146
146
*/
147
147
#define HTTP_ERRNO_MAP (XX ) \
@@ -214,6 +214,7 @@ struct http_parser {
214
214
215
215
uint32_t nread ; /* # bytes read in various scenarios */
216
216
uint64_t content_length ; /* # bytes in body (0 if no Content-Length header) */
217
+ unsigned char set_content_length ;
217
218
218
219
/** READ-ONLY **/
219
220
unsigned short http_major ;
You can’t perform that action at this time.
0 commit comments