summaryrefslogtreecommitdiffstats
path: root/third-party/llhttp/src/http.c
diff options
context:
space:
mode:
Diffstat (limited to 'third-party/llhttp/src/http.c')
-rw-r--r--third-party/llhttp/src/http.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/third-party/llhttp/src/http.c b/third-party/llhttp/src/http.c
index 3a66044..1ab91a5 100644
--- a/third-party/llhttp/src/http.c
+++ b/third-party/llhttp/src/http.c
@@ -39,13 +39,33 @@ int llhttp__after_headers_complete(llhttp_t* parser, const char* p,
int hasBody;
hasBody = parser->flags & F_CHUNKED || parser->content_length > 0;
- if (parser->upgrade && (parser->method == HTTP_CONNECT ||
- (parser->flags & F_SKIPBODY) || !hasBody)) {
+ if (
+ (parser->upgrade && (parser->method == HTTP_CONNECT ||
+ (parser->flags & F_SKIPBODY) || !hasBody)) ||
+ /* See RFC 2616 section 4.4 - 1xx e.g. Continue */
+ (parser->type == HTTP_RESPONSE && parser->status_code == 101)
+ ) {
/* Exit, the rest of the message is in a different protocol. */
return 1;
}
- if (parser->flags & F_SKIPBODY) {
+ if (parser->type == HTTP_RESPONSE && parser->status_code == 100) {
+ /* No body, restart as the message is complete */
+ return 0;
+ }
+
+ /* See RFC 2616 section 4.4 */
+ if (
+ parser->flags & F_SKIPBODY || /* response to a HEAD request */
+ (
+ parser->type == HTTP_RESPONSE && (
+ parser->status_code == 102 || /* Processing */
+ parser->status_code == 103 || /* Early Hints */
+ parser->status_code == 204 || /* No Content */
+ parser->status_code == 304 /* Not Modified */
+ )
+ )
+ ) {
return 0;
} else if (parser->flags & F_CHUNKED) {
/* chunked encoding - ignore Content-Length header, prepare for a chunk */