Strengthen hq-interop by silently draining any data following the
request. This ensures that a QCS instance won't be used to convey
multiple requests as this is undefined behavior.
This new check has been merged with the handling of a delayed standalone
FIN. This ensures that FIN is never forgotten, whether it is received
with or without extra data after the request.
This may be backported to stable releases if needed.
/* hq-interop parser does not support buffer wrapping. */
BUG_ON(b_data(b) != b_contig_data(b, 0));
- if (!b_data(b) && fin) {
- if (qcs_http_handle_standalone_fin(qcs, 0))
+ if (unlikely(qcs->sd) || (fin && !data)) {
+ /* Drain any data after the request and handle FIN if present,
+ * including the case where it is set without any payload.
+ */
+ if (fin && qcs_http_handle_standalone_fin(qcs, 0))
return -1;
- return 0;
+ return data;
}
/* skip method */