#define HTX_FL_PROCESSING_ERROR 0x00000002 /* Set when a processing error occurred */
#define HTX_FL_FRAGMENTED 0x00000004 /* Set when the HTX buffer is fragmented */
#define HTX_FL_UNORDERED 0x00000008 /* Set when the HTX buffer are not ordered */
-#define HTX_FL_EOM 0x00000010 /* Set when end-of-message is reached from the HTTP point of view */
+#define HTX_FL_HAS_EOM 0x00000010 /* Set when end-of-message is reached from the HTTP point of view */
/* This function is used to report flags in debugging tools. Please reflect
* below any single-bit flag addition above in the same order via the
_(0);
/* flags */
_(HTX_FL_PARSING_ERROR, _(HTX_FL_PROCESSING_ERROR,
- _(HTX_FL_FRAGMENTED, _(HTX_FL_UNORDERED, _(HTX_FL_EOM)))));
+ _(HTX_FL_FRAGMENTED, _(HTX_FL_UNORDERED, _(HTX_FL_HAS_EOM)))));
/* epilogue */
_(~0U);
return buf;
/* Returns 1 if 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
- * considered here.
+ * function relies on the HTX_FL_HAS_EOM flags. It means tunneled data are
+ * not considered here.
*/
static inline int htx_expect_more(const struct htx *htx)
{
- return !(htx->flags & HTX_FL_EOM);
+ return !(htx->flags & HTX_FL_HAS_EOM);
}
/* Set EOM flag in <htx>. This function must always be called to report the end
return 0;
}
- htx->flags |= HTX_FL_EOM;
+ htx->flags |= HTX_FL_HAS_EOM;
return 1;
}
sl = http_get_stline(htx);
if (s->txn.http->meth != HTTP_METH_HEAD && sl &&
(msg->flags & (HTTP_MSGF_XFER_LEN|HTTP_MSGF_CNT_LEN|HTTP_MSGF_TE_CHNK)) == HTTP_MSGF_XFER_LEN &&
- (htx->flags & HTX_FL_EOM)) {
+ (htx->flags & HTX_FL_HAS_EOM)) {
struct htx_blk * blk;
char *end;
size_t len = 0;
comp_type = NULL;
/* compress only if body size is >= than the min size */
- if (((msg->flags & HTTP_MSGF_CNT_LEN) || (htx->flags & HTX_FL_EOM)) &&
+ if (((msg->flags & HTTP_MSGF_CNT_LEN) || (htx->flags & HTX_FL_HAS_EOM)) &&
((s->be->comp && (comp_minsize = s->be->comp->minsize_req)) ||
(strm_fe(s)->comp && (comp_minsize = strm_fe(s)->comp->minsize_req)))) {
/* small requests should not be compressed */
switch (type) {
case HTX_BLK_DATA:
/* it is the last data block */
- last = ((!next && (htx->flags & HTX_FL_EOM)) || (next && htx_get_blk_type(next) != HTX_BLK_DATA));
+ last = ((!next && (htx->flags & HTX_FL_HAS_EOM)) || (next && htx_get_blk_type(next) != HTX_BLK_DATA));
v = htx_get_blk_value(htx, blk);
v = istadv(v, offset);
if (v.len > len) {
goto fail;
/* compress only if body size is >= than the min size */
- if (((msg->flags & HTTP_MSGF_CNT_LEN) || (htx->flags & HTX_FL_EOM)) &&
+ if (((msg->flags & HTTP_MSGF_CNT_LEN) || (htx->flags & HTX_FL_HAS_EOM)) &&
((s->be->comp && (comp_minsize = s->be->comp->minsize_res)) ||
(strm_fe(s)->comp && (comp_minsize = strm_fe(s)->comp->minsize_res)))) {
/* small responses should not be compressed */
*fin = 0;
htx = htx_from_buf(buf);
/* EOM is saved here, useful if 0-copy is performed with HTX buf. */
- eom = htx->flags & HTX_FL_EOM;
+ eom = htx->flags & HTX_FL_HAS_EOM;
while (count && !htx_is_empty(htx) && qcc_stream_can_send(qcs) && ret >= 0) {
idx = htx_get_head(htx);
* which results in transfers reported as prematurely aborted (cL--).
*/
#if 0
- if (unlikely((htx->flags & HTX_FL_EOM) && htx_is_empty(htx)) &&
+ if (unlikely((htx->flags & HTX_FL_HAS_EOM) && htx_is_empty(htx)) &&
!qcs_is_close_remote(qcs)) {
/* Generate a STOP_SENDING if full response transferred before
* receiving the full request.
/* The message was fully consumed and no more data are expected
* (EOM flag set).
*/
- if (htx_is_empty(htx) && (htx->flags & HTX_FL_EOM)) {
+ if (htx_is_empty(htx) && (htx->flags & HTX_FL_HAS_EOM)) {
http_ctx->flags |= APPLET_REQ_RECV;
stop = 1;
}
/* The message was fully consumed and no more data are expected
* (EOM flag set).
*/
- if (htx_is_empty(htx) && (htx->flags & HTX_FL_EOM)) {
+ if (htx_is_empty(htx) && (htx->flags & HTX_FL_HAS_EOM)) {
http_ctx->flags |= APPLET_REQ_RECV;
len = 0;
}
MAY_LJMP(check_args(L, 1, "set_eom"));
msg = MAY_LJMP(hlua_checkhttpmsg(L, 1));
htx = htxbuf(&msg->chn->buf);
- htx->flags &= ~HTX_FL_EOM;
+ htx->flags &= ~HTX_FL_HAS_EOM;
return 0;
}
*fin = 0;
htx = htx_from_buf(buf);
/* EOM is saved here, useful if 0-copy is performed with HTX buf. */
- eom = htx->flags & HTX_FL_EOM;
+ eom = htx->flags & HTX_FL_HAS_EOM;
while (count && !htx_is_empty(htx) && qcc_stream_can_send(qcs)) {
/* Not implemented : QUIC on backend side */
* in case we previously disabled it, otherwise we might cause
* the client to delay further data.
*/
- if ((sess->listener && (sess->listener->bind_conf->options & BC_O_NOQUICKACK)) && !(htx->flags & HTX_FL_EOM))
+ if ((sess->listener && (sess->listener->bind_conf->options & BC_O_NOQUICKACK)) && !(htx->flags & HTX_FL_HAS_EOM))
conn_set_quickack(cli_conn, 1);
/*************************************************************
else {
c_adv(req, htx->data - co_data(req));
if ((global.tune.options & GTUNE_USE_FAST_FWD) && (msg->flags & HTTP_MSGF_XFER_LEN) &&
- (!(msg->flags & HTTP_MSGF_CONN_UPG) || (htx->flags & HTX_FL_EOM)))
+ (!(msg->flags & HTTP_MSGF_CONN_UPG) || (htx->flags & HTX_FL_HAS_EOM)))
channel_htx_forward_forever(req, htx);
}
* in HTTP_MSG_ENDING state. Then if all data was marked to be
* forwarded, set the state to HTTP_MSG_DONE.
*/
- if (!(htx->flags & HTX_FL_EOM))
+ if (!(htx->flags & HTX_FL_HAS_EOM))
goto missing_data_or_waiting;
msg->msg_state = HTTP_MSG_ENDING;
* in HTTP_MSG_ENDING state. Then if all data was marked to be
* forwarded, set the state to HTTP_MSG_DONE.
*/
- if (!(htx->flags & HTX_FL_EOM))
+ if (!(htx->flags & HTX_FL_HAS_EOM))
goto missing_data_or_waiting;
msg->msg_state = HTTP_MSG_ENDING;
/* Now we're are waiting for the payload. We just need to know if all
* data have been received or if the buffer is full.
*/
- if ((htx->flags & HTX_FL_EOM) || htx_get_tail_type(htx) > HTX_BLK_DATA)
+ if ((htx->flags & HTX_FL_HAS_EOM) || htx_get_tail_type(htx) > HTX_BLK_DATA)
goto end; /* all data received */
if (bytes) {
goto out;
}
- if (htx->flags & HTX_FL_EOM) { /* check if a body need to be added */
+ if (htx->flags & HTX_FL_HAS_EOM) { /* check if a body need to be added */
appctx->st0 = HTTPCLIENT_S_RES_STLINE;
applet_set_eoi(appctx);
goto out; /* we need to leave the IO handler once we wrote the request */
htx = htxbuf(outbuf);
- /* if the request contains the HTX_FL_EOM, we finished the request part. */
- if (htx->flags & HTX_FL_EOM) {
+ /* if the request contains the HTX_FL_HAS_EOM, we finished the request part. */
+ if (htx->flags & HTX_FL_HAS_EOM) {
appctx->st0 = HTTPCLIENT_S_RES_STLINE;
applet_set_eoi(appctx);
goto out; /* we need to leave the IO handler once we wrote the request */
/* if there is no HTX data anymore and the EOM flag is
* set, leave (no body) */
- if (htx_is_empty(htx) && htx->flags & HTX_FL_EOM)
+ if (htx_is_empty(htx) && htx->flags & HTX_FL_HAS_EOM)
appctx->st0 = HTTPCLIENT_S_RES_END;
else
appctx->st0 = HTTPCLIENT_S_RES_HDR;
/* if there is no HTX data anymore and the EOM flag is
* set, leave (no body) */
- if (htx_is_empty(htx) && htx->flags & HTX_FL_EOM) {
+ if (htx_is_empty(htx) && htx->flags & HTX_FL_HAS_EOM) {
appctx->st0 = HTTPCLIENT_S_RES_END;
} else {
appctx->st0 = HTTPCLIENT_S_RES_BODY;
hc->ops.res_payload(hc);
/* if not finished, should be called again */
- if ((htx_is_empty(htx) && (htx->flags & HTX_FL_EOM))) {
+ if ((htx_is_empty(htx) && (htx->flags & HTX_FL_HAS_EOM))) {
appctx->st0 = HTTPCLIENT_S_RES_END;
htx_to_buf(htx, inbuf);
break;
if (!htx)
return 0;
- smp->data.u.sint = !!(htx->flags & HTX_FL_EOM);
+ smp->data.u.sint = !!(htx->flags & HTX_FL_HAS_EOM);
smp->data.type = SMP_T_BOOL;
smp->flags = SMP_F_VOLATILE | SMP_F_MAY_CHANGE;
return 1;
/* Everything was copied, transfer terminal HTX flags too */
if (!blk) {
- dst->flags |= (src->flags & (HTX_FL_EOM|HTX_FL_PARSING_ERROR|HTX_FL_PROCESSING_ERROR));
+ dst->flags |= (src->flags & (HTX_FL_HAS_EOM|HTX_FL_PARSING_ERROR|HTX_FL_PROCESSING_ERROR));
if (!(flags & HTX_XFER_KEEP_SRC_BLKS))
src->flags = 0;
}
if (unlikely(size <= 0xFFFF && size == count && b_size(mbuf) == b_size(buf) &&
htx_nbblks(htx) == 1 && type == HTX_BLK_DATA)) {
void *old_area = mbuf->area;
- int eom = (htx->flags & HTX_FL_EOM);
+ int eom = (htx->flags & HTX_FL_HAS_EOM);
/* Last block of the message: Reserve the size for the empty stdin record */
if (eom)
TRACE_PROTO("sending stding data", FCGI_EV_TX_RECORD|FCGI_EV_TX_STDIN, fconn->conn, fstrm, htx, (size_t[]){size});
v = htx_get_blk_value(htx, blk);
- if (htx_is_unique_blk(htx, blk) && (htx->flags & HTX_FL_EOM))
+ if (htx_is_unique_blk(htx, blk) && (htx->flags & HTX_FL_HAS_EOM))
extra_bytes = FCGI_RECORD_HEADER_SZ; /* Last block of the message */
if (v.len > count) {
b_add(mbuf, outbuf.data);
/* Send the empty stding here to finish the message */
- if (htx_is_empty(htx) && (htx->flags & HTX_FL_EOM)) {
+ if (htx_is_empty(htx) && (htx->flags & HTX_FL_HAS_EOM)) {
empty_stdin:
TRACE_PROTO("sending FCGI STDIN record", FCGI_EV_TX_RECORD|FCGI_EV_TX_STDIN, fconn->conn, fstrm, htx);
if (!fcgi_strm_send_empty_stdin(fconn, fstrm)) {
* full. Otherwise, the request is invalid.
*/
sl = http_get_stline(htx);
- if (!sl || (!(sl->flags & HTX_SL_F_CLEN) && !(htx->flags & HTX_FL_EOM))) {
+ if (!sl || (!(sl->flags & HTX_SL_F_CLEN) && !(htx->flags & HTX_FL_HAS_EOM))) {
htx->flags |= HTX_FL_PARSING_ERROR;
fcgi_strm_error(fstrm);
goto done;
if (!ret)
goto done;
}
- if (htx_is_unique_blk(htx, blk) && (htx->flags & HTX_FL_EOM)) {
+ if (htx_is_unique_blk(htx, blk) && (htx->flags & HTX_FL_HAS_EOM)) {
TRACE_PROTO("sending FCGI STDIN record", FCGI_EV_TX_RECORD|FCGI_EV_TX_STDIN, fconn->conn, fstrm, htx);
ret = fcgi_strm_send_empty_stdin(fconn, fstrm);
if (!ret)
break;
case HTX_BLK_EOT:
- if (htx_is_unique_blk(htx, blk) && (htx->flags & HTX_FL_EOM)) {
+ if (htx_is_unique_blk(htx, blk) && (htx->flags & HTX_FL_HAS_EOM)) {
TRACE_PROTO("sending FCGI STDIN record", FCGI_EV_TX_RECORD|FCGI_EV_TX_STDIN, fconn->conn, fstrm, htx);
ret = fcgi_strm_send_empty_stdin(fconn, fstrm);
if (!ret)
TRACE_STATE("force close mode (T-E + HTTP/1.0)", H1_EV_TX_DATA|H1_EV_TX_HDRS, h1s->h1c->conn, h1s);
}
else if ((h1m->flags & H1_MF_CLEN) && h1m->body_len != 0 &&
- htx_is_unique_blk(htx, blk) && (htx->flags & HTX_FL_EOM) &&
+ htx_is_unique_blk(htx, blk) && (htx->flags & HTX_FL_HAS_EOM) &&
(!(h1m->flags & H1_MF_RESP) || !(h1s->flags & H1S_F_BODYLESS_RESP))) {
/* C-L but no data for non-bodyless response or for a request: force close */
h1s->flags = (h1s->flags & ~H1S_F_WANT_MSK) | H1S_F_WANT_CLO;
TRACE_STATE("1xx response xferred", H1_EV_TX_DATA|H1_EV_TX_HDRS, h1c->conn, h1s);
}
else if (htx_is_unique_blk(htx, blk) &&
- ((htx->flags & HTX_FL_EOM) || ((h1m->flags & H1_MF_CLEN) && !h1m->curr_len))) {
+ ((htx->flags & HTX_FL_HAS_EOM) || ((h1m->flags & H1_MF_CLEN) && !h1m->curr_len))) {
/* EOM flag is set and it is the last block or there is no
* payload. It cannot be removed now. We must emit the end of
* the message first to be sure the output buffer is not full.
}
else if (!chunk_memcat(&outbuf, "\r\n", 2))
goto full;
- h1m->state = ((htx->flags & HTX_FL_EOM) ? H1_MSG_DONE : H1_MSG_TRAILERS);
+ h1m->state = ((htx->flags & HTX_FL_HAS_EOM) ? H1_MSG_DONE : H1_MSG_TRAILERS);
}
else {
if (!chunk_memcat(&outbuf, "\r\n", 2))
htx_get_blk_value(htx, blk).len == count &&
b_size(&h1c->obuf) == b_size(buf)) {
void *old_area;
- int eom = (htx->flags & HTX_FL_EOM);
+ int eom = (htx->flags & HTX_FL_HAS_EOM);
old_area = h1c->obuf.area;
h1c->obuf.area = buf->area;
/* Get the maximum amount of data we can xferred */
vlen = count;
}
- else if (htx_is_unique_blk(htx, blk) && (htx->flags & HTX_FL_EOM)) {
+ else if (htx_is_unique_blk(htx, blk) && (htx->flags & HTX_FL_HAS_EOM)) {
/* It is the last block of this message. After this one,
* only tunneled data may be forwarded. */
TRACE_DEVEL("last message block", H1_EV_TX_DATA|H1_EV_TX_BODY, h1c->conn, h1s);
/* Response already closed: add END_STREAM */
es_now = 1;
}
- else if ((htx->flags & HTX_FL_EOM) && htx_is_empty(htx) && h2s->status >= 200) {
+ else if ((htx->flags & HTX_FL_HAS_EOM) && htx_is_empty(htx) && h2s->status >= 200) {
/* EOM+empty: we may need to add END_STREAM except for 1xx
* responses and tunneled response.
*/
/* Request already closed: add END_STREAM */
es_now = 1;
}
- if ((htx->flags & HTX_FL_EOM) && htx_is_empty(htx)) {
+ if ((htx->flags & HTX_FL_HAS_EOM) && htx_is_empty(htx)) {
/* EOM+empty: we may need to add END_STREAM (except for CONNECT
* request)
*/
goto end;
}
- if (htx->flags & HTX_FL_EOM) {
+ if (htx->flags & HTX_FL_HAS_EOM) {
/* EOM+empty: we may need to add END_STREAM (except for tunneled
* message)
*/
total += fsize;
if (fsize == bsize) {
htx_remove_blk(htx, blk);
- if ((htx->flags & HTX_FL_EOM) && htx_is_empty(htx)) {
+ if ((htx->flags & HTX_FL_HAS_EOM) && htx_is_empty(htx)) {
/* EOM+empty: we may need to add END_STREAM (except for tunneled
* message)
*/
if (fsize != bsize)
goto skip_data;
- if (!(htx->flags & HTX_FL_EOM) || !htx_is_unique_blk(htx, blk))
+ if (!(htx->flags & HTX_FL_HAS_EOM) || !htx_is_unique_blk(htx, blk))
goto skip_data;
h2s->flags &= ~H2_SF_MORE_HTX_DATA;
cs_htx = htx_from_buf(buf);
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) &&
+ if ((qcs_htx->flags & HTX_FL_HAS_EOM) &&
!(qcs->flags & QC_SF_EOI_SUSPENDED)) {
*fin = 1;
}
BUG_ON(qcs_htx->flags & HTX_FL_PARSING_ERROR);
/* EOM was copied to cs_htx if all data were copied. */
- if (cs_htx->flags & HTX_FL_EOM) {
+ if (cs_htx->flags & HTX_FL_HAS_EOM) {
if (!(qcs->flags & QC_SF_EOI_SUSPENDED))
*fin = 1;
}
struct htx_blk *blk;
/* we need more data */
- if (!(htx->flags & HTX_FL_EOM)) {
+ if (!(htx->flags & HTX_FL_HAS_EOM)) {
/* check if we can receive more */
if (applet_fl_test(appctx, APPCTX_FL_INBLK_FULL)) {
ctx->st_code = STAT_STATUS_EXCD;
TRACE_ENTER(CHK_EV_TCPCHK_EXP, check);
- last_read |= (!htx_free_data_space(htx) || (htx->flags & HTX_FL_EOM));
+ last_read |= (!htx_free_data_space(htx) || (htx->flags & HTX_FL_HAS_EOM));
if (htx->flags & HTX_FL_PARSING_ERROR) {
TRACE_ERROR("invalid response", CHK_EV_TCPCHK_EXP|CHK_EV_TCPCHK_ERR, check);