#define SF_BC_MARK 0x01000000 /* need to set specific mark on backend/srv conn upon connect */
#define SF_BC_TOS 0x02000000 /* need to set specific tos on backend/srv conn upon connect */
#define SF_RULE_FYIELD 0x04000000 /* s->current_rule set because of forced yield */
+/* unused: 0x08000000 */
+#define SF_TXN_NONE 0x00000000 /* No transaction allocated */
+#define SF_TXN_HTTP 0x10000000 /* HTTP transaction allocated */
+#define SF_TXN_MASK 0x10000000 /* mask to get the transaction type */
/* 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
} else if (isteq(name, ist("strm.x"))) {
ptr = (!s || !may_access(s)) ? NULL : &s->conn_exp; size = sizeof(s->conn_exp);
} else if (isteq(name, ist("txn.f"))) {
- ptr = (!s || !may_access(s)) ? NULL : &s->txn.http->flags; size = sizeof(s->txn.http->flags);
+ ptr = (!s || !may_access(s) || (s->flags & SF_TXN_MASK) != SF_TXN_HTTP) ? NULL : &s->txn.http->flags;
+ size = sizeof(s->txn.http->flags);
} else if (isteq(name, ist("req.f"))) {
ptr = (!s || !may_access(s)) ? NULL : &s->req.flags; size = sizeof(s->req.flags);
} else if (isteq(name, ist("res.f"))) {
struct http_txn *txn;
struct stconn *sc = s->scf;
+ if ((s->flags & SF_TXN_MASK) != SF_TXN_NONE)
+ return NULL;
+
txn = pool_alloc(pool_head_http_txn);
if (!txn)
return NULL;
txn->auth.method = HTTP_AUTH_UNKNOWN;
+ s->flags |= SF_TXN_HTTP;
+
/* here we don't want to re-initialize s->vars_txn and s->vars_reqres
* variable lists, because they were already initialized upon stream
* creation in stream_new(), and thus may already contain some variables
pool_free(pool_head_http_txn, txn);
s->txn.http = NULL;
+ s->flags &= ~SF_TXN_MASK;
}
if (likely(s)) {
be = s->be;
- txn = s->txn.http;
+ txn = (((s->flags & SF_TXN_MASK) == SF_TXN_HTTP) ? s->txn.http : NULL);
be_conn = sc_conn(s->scb);
status = (txn ? txn->status : 0);
s_flags = s->flags;
if (oc->flags & CF_STREAMER)
send_flag |= CO_SFL_STREAMER;
- if (s->txn.http && s->txn.http->flags & TX_L7_RETRY && !b_data(&s->txn.http->l7_buffer)) {
+ if ((s->flags & SF_TXN_MASK) == SF_TXN_HTTP && (s->txn.http->flags & TX_L7_RETRY) && !b_data(&s->txn.http->l7_buffer)) {
/* If we want to be able to do L7 retries, copy
* the data we're about to send, so that we are able
* to resend them if needed
hlua_ctx_destroy(s->hlua[1]);
s->hlua[0] = s->hlua[1] = NULL;
- if (s->txn.http)
+ if ((s->flags & SF_TXN_MASK) == SF_TXN_HTTP)
http_destroy_txn(s);
/* ensure the client-side transport layer is destroyed */
if (!(s->flags & SF_FINST_MASK))
s->flags |= SF_FINST_R;
- if (s->txn.http)
+ if ((s->flags & SF_TXN_MASK) == SF_TXN_HTTP)
s->txn.http->status = 500;
s->req.analysers &= AN_REQ_FLT_END;
s->req.analyse_exp = TICK_ETERNITY;
s->req.analysers |= AN_REQ_WAIT_HTTP|AN_REQ_HTTP_PROCESS_FE;
- if (unlikely(!s->txn.http && !http_create_txn(s)))
+ if (unlikely((s->flags & SF_TXN_MASK) != SF_TXN_HTTP && !http_create_txn(s)))
return 0;
conn = sc_conn(sc);
}
/* this data may be no longer valid, clear it */
- if (s->txn.http)
+ if ((s->flags & SF_TXN_MASK) == SF_TXN_HTTP)
memset(&s->txn.http->auth, 0, sizeof(s->txn.http->auth));
/* 1a: Check for low level timeouts if needed. We just set a flag on
stream_process_counters(s);
- if (s->txn.http && s->txn.http->status) {
+ if ((s->flags & SF_TXN_MASK) == SF_TXN_HTTP && s->txn.http->status) {
int n;
n = s->txn.http->status / 100;
" age=%s)\n",
human_time(ns_to_sec(now_ns) - ns_to_sec(request_ts), 1));
- if (strm->txn.http) {
+ if ((strm->flags & SF_TXN_MASK) == SF_TXN_HTTP) {
chunk_appendf(buf,
"%s txn=%p flags=0x%x meth=%d status=%d req.st=%s rsp.st=%s req.f=0x%02x rsp.f=0x%02x", pfx,
strm->txn.http, strm->txn.http->flags,
if (task_in_rq(curr_strm->task))
chunk_appendf(&trash, " run(nice=%d)", curr_strm->task->nice);
- if ((ctx->flags & CLI_SHOWSESS_F_DUMP_URI) && curr_strm->txn.http && curr_strm->txn.http->uri)
+ if ((ctx->flags & CLI_SHOWSESS_F_DUMP_URI) &&
+ (curr_strm->flags & SF_TXN_MASK) == SF_TXN_HTTP &&
+ curr_strm->txn.http->uri)
chunk_appendf(&trash, " uri=\"%s\"",
HA_ANON_CLI(curr_strm->txn.http->uri));