If we received an end of stream, but we ended up getting less than
Content-Length, then do not broadcast EOM, we never got the whole
message.
This is more hardening, to make sure everything is consistent across the
whole stream.
This should be backported up to 2.8.
* EOM was already reported.
*/
if ((h2c->flags & H2_CF_IS_BACK) || !(h2s->flags & H2_SF_TUNNEL_ABRT)) {
- /* htx may be empty if receiving an empty DATA frame. */
- if (!htx_set_eom(htx))
- goto fail;
+ /*
+ * Do not report end of message if we had a
+ * Content-Length, but we got less than that, otherwise
+ * the other mux will consider it complete when it
+ * should not.
+ */
+ if (!(h2s->flags & H2_SF_DATA_CLEN) || !h2s->body_len ||
+ ((h2c->flags & H2_CF_IS_BACK) && (h2s->flags & H2_SF_BODYLESS_RESP))) {
+ /* htx may be empty if receiving an empty DATA frame. */
+ if (!htx_set_eom(htx))
+ goto fail;
+ }
}
}