diff --git a/src/mux_h2.c b/src/mux_h2.c index 3855cb280..5ae2297a0 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -4933,9 +4933,6 @@ static size_t h2s_htx_make_trailers(struct h2s *h2s, struct htx *htx) if (!blk_end) goto end; // end not found yet - if (!hdr) - goto done; - chunk_reset(&outbuf); while (1) { @@ -4980,6 +4977,16 @@ static size_t h2s_htx_make_trailers(struct h2s *h2s, struct htx *htx) } } + if (!hdr) { + /* here we have a problem, we've received an empty trailers + * block followed by an EOM. Because of this we can't send a + * HEADERS frame, so we have to cheat and instead send an empty + * DATA frame conveying the ES flag. + */ + outbuf.area[3] = H2_FT_DATA; + outbuf.area[4] = H2_F_DATA_END_STREAM; + } + /* update the frame's size */ h2_set_frame_size(outbuf.area, outbuf.data - 9);