HTTP/0.9 transcoder is minimal. In particular, it did not checked if the
HTX payload length was unknown. In this case, the stream shutdown is the
normal termination signal. As this condition was not reported to the
MUX, the stream would be closed via a RESET_STREAM during the stream
shut callback invokation.
Fix this by properly inspecting HTX response line prior to generating
the HTTP/0.9 response. If flag HTX_SL_F_XFER_LEN is not set, correctly
convert it to QCS flag QC_SF_UNKNOWN_PL_LENGTH. This ensures that MUX
will use a FIN signal instead of a RESET_STREAM frame when shut is
called by the upper stream layer.
This procedure is already implemented by HTTP/3 transcoder.
This bug was detected with haterm, because contrary to httpterm the
latter does not honour Connection keep-alive header in case of HTTP/1.0.
Thus connection close mode is used and no content-length is added.
This must be backported up to 2.8.
/* only body is transferred on HTTP/0.9 */
case HTX_BLK_RES_SL:
/* only body is transferred on HTTP/0.9 */
case HTX_BLK_RES_SL:
+ sl = htx_get_blk_ptr(htx, blk);
+ if (!(sl->flags & HTX_SL_F_XFER_LEN))
+ qcs->flags |= QC_SF_UNKNOWN_PL_LENGTH;
+ htx_remove_blk(htx, blk);
+ total += bsize;
+ count -= bsize;
+ break;
+
case HTX_BLK_TLR:
case HTX_BLK_EOT:
default:
case HTX_BLK_TLR:
case HTX_BLK_EOT:
default: