return (htx->head != -1);
}
+/* Return 1 if the message is empty and there is no parsing/internal error flag
+ * set. Otherwise it return 0.
+ */
+static inline int htx_is_empty_noerr(const struct htx *htx)
+{
+ return (htx_is_empty(htx) && !(htx->flags & (HTX_FL_PARSING_ERROR|HTX_FL_PROCESSING_ERROR)));
+}
+
/* Returns 1 if no more data are expected for the message <htx>. Otherwise it
* returns 0. Note that it is illegal to call this with htx == NULL. This
* function relies on the HTX_FL_EOM flags. It means tunneled data are not
struct htx *buf_htx = NULL;
size_t ret = 0;
- if (htx_is_empty(appctx_htx)) {
+ if (htx_is_empty_noerr(appctx_htx)) {
htx_to_buf(appctx_htx, &appctx->outbuf);
goto out;
}
ret = appctx_htx->data;
buf_htx = htx_from_buf(buf);
- if (b_size(&appctx->outbuf) == b_size(buf) && htx_is_empty(buf_htx) && htx_used_space(appctx_htx) <= count) {
+ if (b_size(&appctx->outbuf) == b_size(buf) && htx_is_empty_noerr(buf_htx) && htx_used_space(appctx_htx) <= count) {
htx_to_buf(buf_htx, buf);
htx_to_buf(appctx_htx, &appctx->outbuf);
b_xfer(buf, &appctx->outbuf, b_data(&appctx->outbuf));
size_t ret = 0;
ret = buf_htx->data;
- if (htx_is_empty(appctx_htx) && buf_htx->data == count) {
+ if (htx_is_empty_noerr(appctx_htx) && buf_htx->data == count) {
htx_to_buf(appctx_htx, &appctx->inbuf);
htx_to_buf(buf_htx, buf);
b_xfer(&appctx->inbuf, buf, b_data(buf));
hc->ops.req_payload(hc);
hc_htx = htxbuf(&hc->req.buf);
- if (htx_is_empty(hc_htx))
+ if (htx_is_empty_noerr(hc_htx))
goto out;
htx = htx_from_buf(outbuf);
- if (htx_is_empty(htx)) {
+ if (htx_is_empty_noerr(htx)) {
/* Here htx_to_buf() will set buffer data to 0 because
* the HTX is empty, and allow us to do an xfer.
*/
goto end; // may be NULL if empty
h2s_htx = htx_from_buf(rxbuf);
- if (htx_is_empty(h2s_htx) && !(h2s_htx->flags & HTX_FL_PARSING_ERROR)) {
+ if (htx_is_empty_noerr(h2s_htx)) {
/* Here htx_to_buf() will set buffer data to 0 because
* the HTX is empty.
*/
/* <buf> is empty and the message is small enough, swap the
* buffers. */
- if (htx_is_empty(buf_htx) && htx_used_space(h2s_htx) <= count) {
+ if (htx_is_empty_noerr(buf_htx) && htx_used_space(h2s_htx) <= count) {
count -= h2s_htx->data;
htx_to_buf(buf_htx, buf);
htx_to_buf(h2s_htx, rxbuf);
*fin = 0;
qcs_htx = htx_from_buf(&qcs->rx.app_buf);
- if (htx_is_empty(qcs_htx)) {
+ if (htx_is_empty_noerr(qcs_htx)) {
/* Set buffer data to 0 as HTX is empty. */
htx_to_buf(qcs_htx, &qcs->rx.app_buf);
goto end;
ret = qcs_htx->data;
cs_htx = htx_from_buf(buf);
- if (htx_is_empty(cs_htx) && htx_used_space(qcs_htx) <= count) {
+ if (htx_is_empty_noerr(cs_htx) && htx_used_space(qcs_htx) <= count) {
/* EOM will be copied to cs_htx via b_xfer(). */
if ((qcs_htx->flags & HTX_FL_EOM) &&
!(qcs->flags & QC_SF_EOI_SUSPENDED)) {