summaryrefslogtreecommitdiff
path: root/src/h2.c
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2022-03-30 07:58:09 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2022-03-30 07:58:09 -0400
commit8fa30144830b272a9098ad6c8b7c83f3e8d91fd3 (patch)
tree4a4fda84971debfed65dff3d324c322404a82d16 /src/h2.c
parentaa4d9b63c36da1ebbb9582a4502edb62dc314a3e (diff)
downloadlighttpd-git-8fa30144830b272a9098ad6c8b7c83f3e8d91fd3.tar.gz
[core] short-circuit earlier parsing h2 trailers
Diffstat (limited to 'src/h2.c')
-rw-r--r--src/h2.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/h2.c b/src/h2.c
index 3001cf45..8f0921cc 100644
--- a/src/h2.c
+++ b/src/h2.c
@@ -1442,10 +1442,13 @@ h2_recv_headers (connection * const con, uint8_t * const s, uint32_t flen)
h2_parse_headers_frame(r, psrc, alen, trailers);
+ if (__builtin_expect( (trailers), 0))
+ return 1;
+
#if 0 /*(handled in h2_parse_frames() as a connection error)*/
/* not handled here:
* r is invalid if h2_parse_headers_frame() HPACK decode error */
- if (s[3] == H2_FTYPE_PUSH_PROMISE && !trailers) {
+ if (s[3] == H2_FTYPE_PUSH_PROMISE) {
/* Had to process HPACK to keep HPACK tables sync'd with peer but now
* discard the request if PUSH_PROMISE, since not expected, as this code
* is running as a server, not as a client.
@@ -1483,7 +1486,7 @@ h2_recv_headers (connection * const con, uint8_t * const s, uint32_t flen)
* https://github.com/summerwind/h2spec/issues/122
*/
#if 0
- if (400 == r->http_status && !trailers) {
+ if (400 == r->http_status) {
h2_send_rst_stream(r, con, H2_E_PROTOCOL_ERROR);
h2_retire_stream(r, con);
}