2021-04-27 20:03:36 +02:00
|
|
|
Upstream: no
|
|
|
|
Patch from NodeJS's vendored version:
|
|
|
|
https://github.com/nodejs/node/commit/fc70ce08f5818a286fb5899a1bc3aff5965a745e
|
|
|
|
|
srcpkgs/h*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
for p in ${template%/template}/patches/*; do
sed -i '
\,^[+-][+-][+-] /dev/null,b
/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
s,^[*][*][*] ,&a/,
/^--- /{
s,\(^--- \)\(./\)*,\1a/,
s,[.][Oo][Rr][Ii][Gg]\([ /]\),\1,
s/[.][Oo][Rr][Ii][Gg]$//
s/[.]patched[.]\([^.]\)/.\1/
h
}
/^+++ -/{
g
s/^--- a/+++ b/
b
}
s,\(^+++ \)\(./\)*,\1b/,
' "$p"
done
sed -i '/^patch_args=/d' $template
done
```
2021-06-19 05:03:21 +02:00
|
|
|
--- a/http_parser.c
|
|
|
|
+++ b/http_parser.c
|
2021-04-27 20:03:36 +02:00
|
|
|
@@ -1344,6 +1344,13 @@ size_t http_parser_execute (http_parser *parser,
|
|
|
|
} else if (parser->index == sizeof(TRANSFER_ENCODING)-2) {
|
|
|
|
parser->header_state = h_transfer_encoding;
|
|
|
|
parser->uses_transfer_encoding = 1;
|
|
|
|
+
|
|
|
|
+ /* Multiple `Transfer-Encoding` headers should be treated as
|
|
|
|
+ * one, but with values separate by a comma.
|
|
|
|
+ *
|
|
|
|
+ * See: https://tools.ietf.org/html/rfc7230#section-3.2.2
|
|
|
|
+ */
|
|
|
|
+ parser->flags &= ~F_CHUNKED;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
srcpkgs/h*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
for p in ${template%/template}/patches/*; do
sed -i '
\,^[+-][+-][+-] /dev/null,b
/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
s,^[*][*][*] ,&a/,
/^--- /{
s,\(^--- \)\(./\)*,\1a/,
s,[.][Oo][Rr][Ii][Gg]\([ /]\),\1,
s/[.][Oo][Rr][Ii][Gg]$//
s/[.]patched[.]\([^.]\)/.\1/
h
}
/^+++ -/{
g
s/^--- a/+++ b/
b
}
s,\(^+++ \)\(./\)*,\1b/,
' "$p"
done
sed -i '/^patch_args=/d' $template
done
```
2021-06-19 05:03:21 +02:00
|
|
|
--- a/test.c
|
|
|
|
+++ b/test.c
|
2021-04-27 20:03:36 +02:00
|
|
|
@@ -2154,6 +2154,32 @@ const struct message responses[] =
|
|
|
|
,.body= "2\r\nOK\r\n0\r\n\r\n"
|
|
|
|
,.num_chunks_complete= 0
|
|
|
|
}
|
|
|
|
+#define HTTP_200_DUPLICATE_TE_NOT_LAST_CHUNKED 30
|
|
|
|
+, {.name= "HTTP 200 response with `chunked` and duplicate Transfer-Encoding"
|
|
|
|
+ ,.type= HTTP_RESPONSE
|
|
|
|
+ ,.raw= "HTTP/1.1 200 OK\r\n"
|
|
|
|
+ "Transfer-Encoding: chunked\r\n"
|
|
|
|
+ "Transfer-Encoding: identity\r\n"
|
|
|
|
+ "\r\n"
|
|
|
|
+ "2\r\n"
|
|
|
|
+ "OK\r\n"
|
|
|
|
+ "0\r\n"
|
|
|
|
+ "\r\n"
|
|
|
|
+ ,.should_keep_alive= FALSE
|
|
|
|
+ ,.message_complete_on_eof= TRUE
|
|
|
|
+ ,.http_major= 1
|
|
|
|
+ ,.http_minor= 1
|
|
|
|
+ ,.status_code= 200
|
|
|
|
+ ,.response_status= "OK"
|
|
|
|
+ ,.content_length= -1
|
|
|
|
+ ,.num_headers= 2
|
|
|
|
+ ,.headers=
|
|
|
|
+ { { "Transfer-Encoding", "chunked" }
|
|
|
|
+ , { "Transfer-Encoding", "identity" }
|
|
|
|
+ }
|
|
|
|
+ ,.body= "2\r\nOK\r\n0\r\n\r\n"
|
|
|
|
+ ,.num_chunks_complete= 0
|
|
|
|
+ }
|
|
|
|
};
|
|
|
|
|
|
|
|
/* strnlen() is a POSIX.2008 addition. Can't rely on it being available so
|
|
|
|
|