{
if (s->be->errmsg[msgnum].str)
return &s->be->errmsg[msgnum];
- else if (s->fe->errmsg[msgnum].str)
- return &s->fe->errmsg[msgnum];
+ else if (strm_sess(s)->fe->errmsg[msgnum].str)
+ return &strm_sess(s)->fe->errmsg[msgnum];
else
return &http_err_chunks[msgnum];
}
}
/* search for the algo in the backend in priority or the frontend */
- if ((s->be->comp && (comp_algo_back = s->be->comp->algos)) || (s->fe->comp && (comp_algo_back = s->fe->comp->algos))) {
+ if ((s->be->comp && (comp_algo_back = s->be->comp->algos)) || (strm_sess(s)->fe->comp && (comp_algo_back = strm_sess(s)->fe->comp->algos))) {
int best_q = 0;
ctx.idx = 0;
/* remove all occurrences of the header when "compression offload" is set */
if (s->comp_algo) {
- if ((s->be->comp && s->be->comp->offload) || (s->fe->comp && s->fe->comp->offload)) {
+ if ((s->be->comp && s->be->comp->offload) || (strm_sess(s)->fe->comp && strm_sess(s)->fe->comp->offload)) {
http_remove_header2(msg, &txn->hdr_idx, &ctx);
ctx.idx = 0;
while (http_find_header2("Accept-Encoding", 15, req->p, &txn->hdr_idx, &ctx)) {
}
/* identity is implicit does not require headers */
- if ((s->be->comp && (comp_algo_back = s->be->comp->algos)) || (s->fe->comp && (comp_algo_back = s->fe->comp->algos))) {
+ if ((s->be->comp && (comp_algo_back = s->be->comp->algos)) || (strm_sess(s)->fe->comp && (comp_algo_back = strm_sess(s)->fe->comp->algos))) {
for (comp_algo = comp_algo_back; comp_algo; comp_algo = comp_algo->next) {
if (comp_algo->cfg_name_len == 8 && memcmp(comp_algo->cfg_name, "identity", 8) == 0) {
s->comp_algo = comp_algo;
goto fail;
if ((s->be->comp && (comp_type = s->be->comp->types)) ||
- (s->fe->comp && (comp_type = s->fe->comp->types))) {
+ (strm_sess(s)->fe->comp && (comp_type = strm_sess(s)->fe->comp->types))) {
for (; comp_type; comp_type = comp_type->next) {
if (ctx.vlen >= comp_type->name_len &&
strncasecmp(ctx.line+ctx.val, comp_type->name, comp_type->name_len) == 0)
}
}
else { /* no content-type header */
- if ((s->be->comp && s->be->comp->types) || (s->fe->comp && s->fe->comp->types))
+ if ((s->be->comp && s->be->comp->types) || (strm_sess(s)->fe->comp && strm_sess(s)->fe->comp->types))
goto fail; /* a content-type was required */
}
void http_adjust_conn_mode(struct stream *s, struct http_txn *txn, struct http_msg *msg)
{
+ struct proxy *fe = strm_sess(s)->fe;
int tmp = TX_CON_WANT_KAL;
- if (!((s->fe->options2|s->be->options2) & PR_O2_FAKE_KA)) {
- if ((s->fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_TUN ||
+ if (!((fe->options2|s->be->options2) & PR_O2_FAKE_KA)) {
+ if ((fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_TUN ||
(s->be->options & PR_O_HTTP_MODE) == PR_O_HTTP_TUN)
tmp = TX_CON_WANT_TUN;
- if ((s->fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL ||
+ if ((fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL ||
(s->be->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL)
tmp = TX_CON_WANT_TUN;
}
- if ((s->fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_SCL ||
+ if ((fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_SCL ||
(s->be->options & PR_O_HTTP_MODE) == PR_O_HTTP_SCL) {
/* option httpclose + server_close => forceclose */
- if ((s->fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL ||
+ if ((fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL ||
(s->be->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL)
tmp = TX_CON_WANT_CLO;
else
tmp = TX_CON_WANT_SCL;
}
- if ((s->fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_FCL ||
+ if ((fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_FCL ||
(s->be->options & PR_O_HTTP_MODE) == PR_O_HTTP_FCL)
tmp = TX_CON_WANT_CLO;
int to_del = 0;
if ((msg->flags & HTTP_MSGF_VER_11) ||
((txn->flags & TX_CON_WANT_MSK) >= TX_CON_WANT_SCL &&
- !((s->fe->options2|s->be->options2) & PR_O2_FAKE_KA)))
+ !((fe->options2|s->be->options2) & PR_O2_FAKE_KA)))
to_del |= 2; /* remove "keep-alive" */
if (!(msg->flags & HTTP_MSGF_VER_11))
to_del |= 1; /* remove "close" */
((txn->flags & TX_HDR_CONN_CLO) || /* "connection: close" */
(!(msg->flags & HTTP_MSGF_VER_11) && !(txn->flags & TX_HDR_CONN_KAL)) || /* no "connection: k-a" in 1.0 */
!(msg->flags & HTTP_MSGF_XFER_LEN) || /* no length known => close */
- s->fe->state == PR_STSTOPPED)) /* frontend is stopping */
+ fe->state == PR_STSTOPPED)) /* frontend is stopping */
txn->flags = (txn->flags & ~TX_CON_WANT_MSK) | TX_CON_WANT_CLO;
}
if (unlikely(msg->msg_state == HTTP_MSG_ERROR)) {
stream_inc_http_req_ctr(s);
stream_inc_http_err_ctr(s);
- proxy_inc_fe_req_ctr(s->fe);
+ proxy_inc_fe_req_ctr(sess->fe);
goto return_bad_req;
}
*/
stream_inc_http_req_ctr(s);
stream_inc_http_err_ctr(s);
- proxy_inc_fe_req_ctr(s->fe);
+ proxy_inc_fe_req_ctr(sess->fe);
if (msg->err_pos < 0)
msg->err_pos = req->buf->i;
goto return_bad_req;
/* we cannot return any message on error */
if (msg->err_pos >= 0) {
- http_capture_bad_message(&s->fe->invalid_req, s, msg, msg->msg_state, s->fe);
+ http_capture_bad_message(&sess->fe->invalid_req, s, msg, msg->msg_state, sess->fe);
stream_inc_http_err_ctr(s);
}
req->analysers = 0;
stream_inc_http_req_ctr(s);
- proxy_inc_fe_req_ctr(s->fe);
- s->fe->fe_counters.failed_req++;
+ proxy_inc_fe_req_ctr(sess->fe);
+ sess->fe->fe_counters.failed_req++;
if (sess->listener->counters)
sess->listener->counters->failed_req++;
/* read timeout : give up with an error message. */
if (msg->err_pos >= 0) {
- http_capture_bad_message(&s->fe->invalid_req, s, msg, msg->msg_state, s->fe);
+ http_capture_bad_message(&sess->fe->invalid_req, s, msg, msg->msg_state, sess->fe);
stream_inc_http_err_ctr(s);
}
txn->status = 408;
req->analysers = 0;
stream_inc_http_req_ctr(s);
- proxy_inc_fe_req_ctr(s->fe);
- s->fe->fe_counters.failed_req++;
+ proxy_inc_fe_req_ctr(sess->fe);
+ sess->fe->fe_counters.failed_req++;
if (sess->listener->counters)
sess->listener->counters->failed_req++;
goto failed_keep_alive;
if (msg->err_pos >= 0)
- http_capture_bad_message(&s->fe->invalid_req, s, msg, msg->msg_state, s->fe);
+ http_capture_bad_message(&sess->fe->invalid_req, s, msg, msg->msg_state, sess->fe);
txn->status = 400;
stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_400));
msg->msg_state = HTTP_MSG_ERROR;
stream_inc_http_err_ctr(s);
stream_inc_http_req_ctr(s);
- proxy_inc_fe_req_ctr(s->fe);
- s->fe->fe_counters.failed_req++;
+ proxy_inc_fe_req_ctr(sess->fe);
+ sess->fe->fe_counters.failed_req++;
if (sess->listener->counters)
sess->listener->counters->failed_req++;
*/
stream_inc_http_req_ctr(s);
- proxy_inc_fe_req_ctr(s->fe); /* one more valid request for this FE */
+ proxy_inc_fe_req_ctr(sess->fe); /* one more valid request for this FE */
if (txn->flags & TX_WAIT_NEXT_RQ) {
/* kill the pending keep-alive timeout */
* to block on that, so we have to capture it now.
*/
if (unlikely(msg->err_pos >= 0))
- http_capture_bad_message(&s->fe->invalid_req, s, msg, msg->msg_state, s->fe);
+ http_capture_bad_message(&sess->fe->invalid_req, s, msg, msg->msg_state, sess->fe);
/*
* 1: identify the method
* We have to do this for every request which gets in, because
* the monitor-uri is defined by the frontend.
*/
- if (unlikely((s->fe->monitor_uri_len != 0) &&
- (s->fe->monitor_uri_len == msg->sl.rq.u_l) &&
+ if (unlikely((sess->fe->monitor_uri_len != 0) &&
+ (sess->fe->monitor_uri_len == msg->sl.rq.u_l) &&
!memcmp(req->buf->p + msg->sl.rq.u,
- s->fe->monitor_uri,
- s->fe->monitor_uri_len))) {
+ sess->fe->monitor_uri,
+ sess->fe->monitor_uri_len))) {
/*
* We have found the monitor URI
*/
struct acl_cond *cond;
s->flags |= SF_MONITOR;
- s->fe->fe_counters.intercepted_req++;
+ sess->fe->fe_counters.intercepted_req++;
/* Check if we want to fail this monitor request or not */
- list_for_each_entry(cond, &s->fe->mon_fail_cond, list) {
- int ret = acl_exec_cond(cond, s->fe, s, txn, SMP_OPT_DIR_REQ|SMP_OPT_FINAL);
+ list_for_each_entry(cond, &sess->fe->mon_fail_cond, list) {
+ int ret = acl_exec_cond(cond, sess->fe, s, txn, SMP_OPT_DIR_REQ|SMP_OPT_FINAL);
ret = acl_pass(ret);
if (cond->pol == ACL_COND_UNLESS)
* a proxied connection, which covers both "scheme://location" and
* CONNECT ip:port.
*/
- if ((s->fe->options2 & PR_O2_USE_PXHDR) &&
+ if ((sess->fe->options2 & PR_O2_USE_PXHDR) &&
req->buf->p[msg->sl.rq.u] != '/' && req->buf->p[msg->sl.rq.u] != '*')
txn->flags |= TX_USE_PX_CONN;
/* 5: we may need to capture headers */
if (unlikely((s->logs.logwait & LW_REQHDR) && txn->req.cap))
capture_headers(req->buf->p, &txn->hdr_idx,
- txn->req.cap, s->fe->req_cap);
+ txn->req.cap, sess->fe->req_cap);
/* 6: determine the transfer-length.
* According to RFC2616 #4.4, amended by the HTTPbis working group,
* time.
*/
if (!(txn->flags & TX_HDR_CONN_PRS) ||
- ((s->fe->options & PR_O_HTTP_MODE) != (s->be->options & PR_O_HTTP_MODE)))
+ ((sess->fe->options & PR_O_HTTP_MODE) != (s->be->options & PR_O_HTTP_MODE)))
http_adjust_conn_mode(s, txn, msg);
/* end of job, return OK */
/* we detected a parsing error. We want to archive this request
* in the dedicated proxy area for later troubleshooting.
*/
- http_capture_bad_message(&s->fe->invalid_req, s, msg, msg->msg_state, s->fe);
+ http_capture_bad_message(&sess->fe->invalid_req, s, msg, msg->msg_state, sess->fe);
}
txn->req.msg_state = HTTP_MSG_ERROR;
txn->status = 400;
stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_400));
- s->fe->fe_counters.failed_req++;
+ sess->fe->fe_counters.failed_req++;
if (sess->listener->counters)
sess->listener->counters->failed_req++;
t->data_arg[STKTABLE_DT_HTTP_REQ_RATE].u, 1);
stkctr_set_flags(&s->stkctr[http_req_trk_idx(rule->action)], STKCTR_TRACK_CONTENT);
- if (s->fe != s->be)
+ if (strm_sess(s)->fe != s->be)
stkctr_set_flags(&s->stkctr[http_req_trk_idx(rule->action)], STKCTR_TRACK_BACKEND);
}
}
/* Proceed with the stats now. */
if (unlikely(objt_applet(s->target) == &http_stats_applet)) {
/* process the stats request now */
- if (s->fe == s->be) /* report it if the request was intercepted by the frontend */
- s->fe->fe_counters.intercepted_req++;
+ if (sess->fe == s->be) /* report it if the request was intercepted by the frontend */
+ sess->fe->fe_counters.intercepted_req++;
if (!(s->flags & SF_ERR_MASK)) // this is not really an error but it is
s->flags |= SF_ERR_LOCAL; // to mark that it comes from the proxy
s->flags |= SF_FINST_R;
/* we may want to compress the stats page */
- if (s->fe->comp || s->be->comp)
+ if (sess->fe->comp || s->be->comp)
select_compression_request_header(s, req->buf);
/* enable the minimally required analyzers to handle keep-alive and compression on the HTTP response */
if (!req->analyse_exp)
req->analyse_exp = tick_add(now_ms, 0);
stream_inc_http_err_ctr(s);
- s->fe->fe_counters.denied_req++;
- if (s->fe != s->be)
+ sess->fe->fe_counters.denied_req++;
+ if (sess->fe != s->be)
s->be->be_counters.denied_req++;
if (sess->listener->counters)
sess->listener->counters->denied_req++;
s->logs.tv_request = now;
stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_403));
stream_inc_http_err_ctr(s);
- s->fe->fe_counters.denied_req++;
- if (s->fe != s->be)
+ sess->fe->fe_counters.denied_req++;
+ if (sess->fe != s->be)
s->be->be_counters.denied_req++;
if (sess->listener->counters)
sess->listener->counters->denied_req++;
/* we detected a parsing error. We want to archive this request
* in the dedicated proxy area for later troubleshooting.
*/
- http_capture_bad_message(&s->fe->invalid_req, s, msg, msg->msg_state, s->fe);
+ http_capture_bad_message(&sess->fe->invalid_req, s, msg, msg->msg_state, sess->fe);
}
txn->req.msg_state = HTTP_MSG_ERROR;
txn->status = 400;
stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_400));
- s->fe->fe_counters.failed_req++;
+ sess->fe->fe_counters.failed_req++;
if (sess->listener->counters)
sess->listener->counters->failed_req++;
req->buf->i,
req->analysers);
- if (s->fe->comp || s->be->comp)
+ if (sess->fe->comp || s->be->comp)
select_compression_request_header(s, req->buf);
/*
* the fields will stay coherent and the URI will not move.
* This should only be performed in the backend.
*/
- if ((s->be->cookie_name || s->be->appsession_name || s->fe->capture_name)
+ if ((s->be->cookie_name || s->be->appsession_name || sess->fe->capture_name)
&& !(txn->flags & (TX_CLDENY|TX_CLTARPIT)))
manage_client_side_cookies(s, req);
/* add unique-id if "header-unique-id" is specified */
- if (!LIST_ISEMPTY(&s->fe->format_unique_id)) {
+ if (!LIST_ISEMPTY(&sess->fe->format_unique_id)) {
if ((s->unique_id = pool_alloc2(pool2_uniqueid)) == NULL)
goto return_bad_req;
s->unique_id[0] = '\0';
- build_logline(s, s->unique_id, UNIQUEID_LEN, &s->fe->format_unique_id);
+ build_logline(s, s->unique_id, UNIQUEID_LEN, &sess->fe->format_unique_id);
}
- if (s->fe->header_unique_id && s->unique_id) {
- chunk_printf(&trash, "%s: %s", s->fe->header_unique_id, s->unique_id);
+ if (sess->fe->header_unique_id && s->unique_id) {
+ chunk_printf(&trash, "%s: %s", sess->fe->header_unique_id, s->unique_id);
if (trash.len < 0)
goto return_bad_req;
if (unlikely(http_header_add_tail2(&txn->req, &txn->hdr_idx, trash.str, trash.len) < 0))
* 9: add X-Forwarded-For if either the frontend or the backend
* asks for it.
*/
- if ((s->fe->options | s->be->options) & PR_O_FWDFOR) {
+ if ((sess->fe->options | s->be->options) & PR_O_FWDFOR) {
struct hdr_ctx ctx = { .idx = 0 };
- if (!((s->fe->options | s->be->options) & PR_O_FF_ALWAYS) &&
- http_find_header2(s->be->fwdfor_hdr_len ? s->be->fwdfor_hdr_name : s->fe->fwdfor_hdr_name,
- s->be->fwdfor_hdr_len ? s->be->fwdfor_hdr_len : s->fe->fwdfor_hdr_len,
+ if (!((sess->fe->options | s->be->options) & PR_O_FF_ALWAYS) &&
+ http_find_header2(s->be->fwdfor_hdr_len ? s->be->fwdfor_hdr_name : sess->fe->fwdfor_hdr_name,
+ s->be->fwdfor_hdr_len ? s->be->fwdfor_hdr_len : sess->fe->fwdfor_hdr_len,
req->buf->p, &txn->hdr_idx, &ctx)) {
/* The header is set to be added only if none is present
* and we found it, so don't do anything.
/* Add an X-Forwarded-For header unless the source IP is
* in the 'except' network range.
*/
- if ((!s->fe->except_mask.s_addr ||
- (((struct sockaddr_in *)&cli_conn->addr.from)->sin_addr.s_addr & s->fe->except_mask.s_addr)
- != s->fe->except_net.s_addr) &&
+ if ((!sess->fe->except_mask.s_addr ||
+ (((struct sockaddr_in *)&cli_conn->addr.from)->sin_addr.s_addr & sess->fe->except_mask.s_addr)
+ != sess->fe->except_net.s_addr) &&
(!s->be->except_mask.s_addr ||
(((struct sockaddr_in *)&cli_conn->addr.from)->sin_addr.s_addr & s->be->except_mask.s_addr)
!= s->be->except_net.s_addr)) {
len = s->be->fwdfor_hdr_len;
memcpy(trash.str, s->be->fwdfor_hdr_name, len);
} else {
- len = s->fe->fwdfor_hdr_len;
- memcpy(trash.str, s->fe->fwdfor_hdr_name, len);
+ len = sess->fe->fwdfor_hdr_len;
+ memcpy(trash.str, sess->fe->fwdfor_hdr_name, len);
}
len += snprintf(trash.str + len, trash.size - len, ": %d.%d.%d.%d", pn[0], pn[1], pn[2], pn[3]);
len = s->be->fwdfor_hdr_len;
memcpy(trash.str, s->be->fwdfor_hdr_name, len);
} else {
- len = s->fe->fwdfor_hdr_len;
- memcpy(trash.str, s->fe->fwdfor_hdr_name, len);
+ len = sess->fe->fwdfor_hdr_len;
+ memcpy(trash.str, sess->fe->fwdfor_hdr_name, len);
}
len += snprintf(trash.str + len, trash.size - len, ": %s", pn);
* 10: add X-Original-To if either the frontend or the backend
* asks for it.
*/
- if ((s->fe->options | s->be->options) & PR_O_ORGTO) {
+ if ((sess->fe->options | s->be->options) & PR_O_ORGTO) {
/* FIXME: don't know if IPv6 can handle that case too. */
if (cli_conn && cli_conn->addr.from.ss_family == AF_INET) {
conn_get_to_addr(cli_conn);
if (cli_conn->addr.to.ss_family == AF_INET &&
- ((!s->fe->except_mask_to.s_addr ||
- (((struct sockaddr_in *)&cli_conn->addr.to)->sin_addr.s_addr & s->fe->except_mask_to.s_addr)
- != s->fe->except_to.s_addr) &&
+ ((!sess->fe->except_mask_to.s_addr ||
+ (((struct sockaddr_in *)&cli_conn->addr.to)->sin_addr.s_addr & sess->fe->except_mask_to.s_addr)
+ != sess->fe->except_to.s_addr) &&
(!s->be->except_mask_to.s_addr ||
(((struct sockaddr_in *)&cli_conn->addr.to)->sin_addr.s_addr & s->be->except_mask_to.s_addr)
!= s->be->except_to.s_addr))) {
len = s->be->orgto_hdr_len;
memcpy(trash.str, s->be->orgto_hdr_name, len);
} else {
- len = s->fe->orgto_hdr_len;
- memcpy(trash.str, s->fe->orgto_hdr_name, len);
+ len = sess->fe->orgto_hdr_len;
+ memcpy(trash.str, sess->fe->orgto_hdr_name, len);
}
len += snprintf(trash.str + len, trash.size - len, ": %d.%d.%d.%d", pn[0], pn[1], pn[2], pn[3]);
*/
if (!(txn->flags & TX_HDR_CONN_UPG) &&
(((txn->flags & TX_CON_WANT_MSK) != TX_CON_WANT_TUN) ||
- ((s->fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL ||
+ ((sess->fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL ||
(s->be->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL))) {
unsigned int want_flags = 0;
if (msg->flags & HTTP_MSGF_VER_11) {
if (((txn->flags & TX_CON_WANT_MSK) >= TX_CON_WANT_SCL ||
- ((s->fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL ||
+ ((sess->fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL ||
(s->be->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL)) &&
- !((s->fe->options2|s->be->options2) & PR_O2_FAKE_KA))
+ !((sess->fe->options2|s->be->options2) & PR_O2_FAKE_KA))
want_flags |= TX_CON_CLO_SET;
} else {
if (((txn->flags & TX_CON_WANT_MSK) == TX_CON_WANT_KAL &&
- ((s->fe->options & PR_O_HTTP_MODE) != PR_O_HTTP_PCL &&
+ ((sess->fe->options & PR_O_HTTP_MODE) != PR_O_HTTP_PCL &&
(s->be->options & PR_O_HTTP_MODE) != PR_O_HTTP_PCL)) ||
- ((s->fe->options2|s->be->options2) & PR_O2_FAKE_KA))
+ ((sess->fe->options2|s->be->options2) & PR_O2_FAKE_KA))
want_flags |= TX_CON_KAL_SET;
}
/* we detected a parsing error. We want to archive this request
* in the dedicated proxy area for later troubleshooting.
*/
- http_capture_bad_message(&s->fe->invalid_req, s, msg, msg->msg_state, s->fe);
+ http_capture_bad_message(&sess->fe->invalid_req, s, msg, msg->msg_state, sess->fe);
}
txn->req.msg_state = HTTP_MSG_ERROR;
req->analysers = 0;
stream_int_retnclose(&s->si[0], http_error_message(s, HTTP_ERR_400));
- s->fe->fe_counters.failed_req++;
+ sess->fe->fe_counters.failed_req++;
if (sess->listener->counters)
sess->listener->counters->failed_req++;
return_err_msg:
req->analysers = 0;
- s->fe->fe_counters.failed_req++;
+ sess->fe->fe_counters.failed_req++;
if (sess->listener->counters)
sess->listener->counters->failed_req++;
return 0;
void http_end_txn_clean_session(struct stream *s)
{
int prev_status = s->txn.status;
+ struct proxy *fe = strm_sess(s)->fe;
/* FIXME: We need a more portable way of releasing a backend's and a
* server's connections. We need a safer way to reinitialize buffer
if (n < 1 || n > 5)
n = 0;
- if (s->fe->mode == PR_MODE_HTTP) {
- s->fe->fe_counters.p.http.rsp[n]++;
+ if (fe->mode == PR_MODE_HTTP) {
+ fe->fe_counters.p.http.rsp[n]++;
if (s->comp_algo && (s->flags & SF_COMP_READY))
- s->fe->fe_counters.p.http.comp_rsp++;
+ fe->fe_counters.p.http.comp_rsp++;
}
if ((s->flags & SF_BE_ASSIGNED) &&
(s->be->mode == PR_MODE_HTTP)) {
s->logs.bytes_out -= s->res.buf->i;
/* let's do a final log if we need it */
- if (!LIST_ISEMPTY(&s->fe->logformat) && s->logs.logwait &&
+ if (!LIST_ISEMPTY(&fe->logformat) && s->logs.logwait &&
!(s->flags & SF_MONITOR) &&
- (!(s->fe->options & PR_O_NULLNOLOG) || s->req.total)) {
+ (!(fe->options & PR_O_NULLNOLOG) || s->req.total)) {
s->do_log(s);
}
s->txn.flags |= TX_PREFER_LAST;
}
- if (s->fe->options2 & PR_O2_INDEPSTR)
+ if (fe->options2 & PR_O2_INDEPSTR)
s->si[1].flags |= SI_FL_INDEP_STR;
- if (s->fe->options2 & PR_O2_NODELAY) {
+ if (fe->options2 & PR_O2_NODELAY) {
s->req.flags |= CF_NEVER_WAIT;
s->res.flags |= CF_NEVER_WAIT;
}
else if (ret < 0) {
stream_inc_http_err_ctr(s);
if (msg->err_pos >= 0)
- http_capture_bad_message(&s->fe->invalid_req, s, msg, HTTP_MSG_CHUNK_SIZE, s->be);
+ http_capture_bad_message(&sess->fe->invalid_req, s, msg, HTTP_MSG_CHUNK_SIZE, s->be);
goto return_bad_req;
}
/* otherwise we're in HTTP_MSG_DATA or HTTP_MSG_TRAILERS state */
else if (ret < 0) {
stream_inc_http_err_ctr(s);
if (msg->err_pos >= 0)
- http_capture_bad_message(&s->fe->invalid_req, s, msg, HTTP_MSG_CHUNK_CRLF, s->be);
+ http_capture_bad_message(&sess->fe->invalid_req, s, msg, HTTP_MSG_CHUNK_CRLF, s->be);
goto return_bad_req;
}
/* we're in MSG_CHUNK_SIZE now */
else if (ret < 0) {
stream_inc_http_err_ctr(s);
if (msg->err_pos >= 0)
- http_capture_bad_message(&s->fe->invalid_req, s, msg, HTTP_MSG_TRAILERS, s->be);
+ http_capture_bad_message(&sess->fe->invalid_req, s, msg, HTTP_MSG_TRAILERS, s->be);
goto return_bad_req;
}
/* we're in HTTP_MSG_DONE now */
goto aborted_xfer;
}
if (msg->err_pos >= 0)
- http_capture_bad_message(&s->fe->invalid_req, s, msg, old_state, s->be);
+ http_capture_bad_message(&sess->fe->invalid_req, s, msg, old_state, s->be);
goto return_bad_req;
}
return 1;
s->flags |= SF_FINST_D;
}
- s->fe->fe_counters.cli_aborts++;
+ sess->fe->fe_counters.cli_aborts++;
s->be->be_counters.cli_aborts++;
if (objt_server(s->target))
objt_server(s->target)->counters.cli_aborts++;
return 0;
return_bad_req: /* let's centralize all bad requests */
- s->fe->fe_counters.failed_req++;
+ sess->fe->fe_counters.failed_req++;
if (sess->listener->counters)
sess->listener->counters->failed_req++;
req->analysers = 0;
s->res.analysers = 0; /* we're in data phase, we want to abort both directions */
- s->fe->fe_counters.srv_aborts++;
+ sess->fe->fe_counters.srv_aborts++;
s->be->be_counters.srv_aborts++;
if (objt_server(s->target))
objt_server(s->target)->counters.srv_aborts++;
*/
int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
{
+ struct session *sess = s->sess;
struct http_txn *txn = &s->txn;
struct http_msg *msg = &txn->rsp;
struct hdr_ctx ctx;
*/
hdr_response_bad:
if (msg->msg_state == HTTP_MSG_ERROR || msg->err_pos >= 0)
- http_capture_bad_message(&s->be->invalid_rep, s, msg, msg->msg_state, s->fe);
+ http_capture_bad_message(&s->be->invalid_rep, s, msg, msg->msg_state, sess->fe);
s->be->be_counters.failed_resp++;
if (objt_server(s->target)) {
/* read error */
else if (rep->flags & CF_READ_ERROR) {
if (msg->err_pos >= 0)
- http_capture_bad_message(&s->be->invalid_rep, s, msg, msg->msg_state, s->fe);
+ http_capture_bad_message(&s->be->invalid_rep, s, msg, msg->msg_state, sess->fe);
else if (txn->flags & TX_NOT_FIRST)
goto abort_keep_alive;
/* read timeout : return a 504 to the client. */
else if (rep->flags & CF_READ_TIMEOUT) {
if (msg->err_pos >= 0)
- http_capture_bad_message(&s->be->invalid_rep, s, msg, msg->msg_state, s->fe);
+ http_capture_bad_message(&s->be->invalid_rep, s, msg, msg->msg_state, sess->fe);
else if (txn->flags & TX_NOT_FIRST)
goto abort_keep_alive;
/* client abort with an abortonclose */
else if ((rep->flags & CF_SHUTR) && ((s->req.flags & (CF_SHUTR|CF_SHUTW)) == (CF_SHUTR|CF_SHUTW))) {
- s->fe->fe_counters.cli_aborts++;
+ sess->fe->fe_counters.cli_aborts++;
s->be->be_counters.cli_aborts++;
if (objt_server(s->target))
objt_server(s->target)->counters.cli_aborts++;
/* close from server, capture the response if the server has started to respond */
else if (rep->flags & CF_SHUTR) {
if (msg->msg_state >= HTTP_MSG_RPVER || msg->err_pos >= 0)
- http_capture_bad_message(&s->be->invalid_rep, s, msg, msg->msg_state, s->fe);
+ http_capture_bad_message(&s->be->invalid_rep, s, msg, msg->msg_state, sess->fe);
else if (txn->flags & TX_NOT_FIRST)
goto abort_keep_alive;
/* write error to client (we don't send any message then) */
else if (rep->flags & CF_WRITE_ERROR) {
if (msg->err_pos >= 0)
- http_capture_bad_message(&s->be->invalid_rep, s, msg, msg->msg_state, s->fe);
+ http_capture_bad_message(&s->be->invalid_rep, s, msg, msg->msg_state, sess->fe);
else if (txn->flags & TX_NOT_FIRST)
goto abort_keep_alive;
*/
if (unlikely(msg->err_pos >= 0))
- http_capture_bad_message(&s->be->invalid_rep, s, msg, msg->msg_state, s->fe);
+ http_capture_bad_message(&s->be->invalid_rep, s, msg, msg->msg_state, sess->fe);
/*
* 1: get the status code
s->logs.logwait &= ~LW_RESP;
if (unlikely((s->logs.logwait & LW_RSPHDR) && txn->rsp.cap))
capture_headers(rep->buf->p, &txn->hdr_idx,
- txn->rsp.cap, s->fe->rsp_cap);
+ txn->rsp.cap, sess->fe->rsp_cap);
/* 4: determine the transfer-length.
* According to RFC2616 #4.4, amended by the HTTPbis working group,
msg->body_len = msg->chunk_len = cl;
}
- if (s->fe->comp || s->be->comp)
+ if (sess->fe->comp || s->be->comp)
select_compression_response_header(s, rep->buf);
skip_content_length:
}
else if ((txn->status >= 200) && !(txn->flags & TX_HDR_CONN_PRS) &&
((txn->flags & TX_CON_WANT_MSK) != TX_CON_WANT_TUN ||
- ((s->fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL ||
+ ((sess->fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL ||
(s->be->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL))) {
int to_del = 0;
/* this situation happens when combining pretend-keepalive with httpclose. */
if ((txn->flags & TX_CON_WANT_MSK) == TX_CON_WANT_KAL &&
- ((s->fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL ||
+ ((sess->fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL ||
(s->be->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL))
txn->flags = (txn->flags & ~TX_CON_WANT_MSK) | TX_CON_WANT_CLO;
* pointer and the ->fe rule list. If it doesn't match, I initialize
* the loop with the ->be.
*/
- if (s->current_rule_list == &s->fe->http_res_rules)
- cur_proxy = s->fe;
+ if (s->current_rule_list == &sess->fe->http_res_rules)
+ cur_proxy = sess->fe;
else
cur_proxy = s->be;
while (1) {
objt_server(s->target)->counters.failed_secu++;
s->be->be_counters.denied_resp++;
- s->fe->fe_counters.denied_resp++;
+ sess->fe->fe_counters.denied_resp++;
if (sess->listener->counters)
sess->listener->counters->denied_resp++;
}
/* check whether we're already working on the frontend */
- if (cur_proxy == s->fe)
+ if (cur_proxy == sess->fe)
break;
- cur_proxy = s->fe;
+ cur_proxy = sess->fe;
}
/* After this point, this anayzer can't return yield, so we can
/*
* Now check for a server cookie.
*/
- if (s->be->cookie_name || s->be->appsession_name || s->fe->capture_name ||
+ if (s->be->cookie_name || s->be->appsession_name || sess->fe->capture_name ||
(s->be->options & PR_O_CHK_CACHE))
manage_server_side_cookies(s, rep);
objt_server(s->target)->counters.failed_secu++;
s->be->be_counters.denied_resp++;
- s->fe->fe_counters.denied_resp++;
+ sess->fe->fe_counters.denied_resp++;
if (sess->listener->counters)
sess->listener->counters->denied_resp++;
*/
if ((txn->status != 101) && !(txn->flags & TX_HDR_CONN_UPG) &&
(((txn->flags & TX_CON_WANT_MSK) != TX_CON_WANT_TUN) ||
- ((s->fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL ||
+ ((sess->fe->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL ||
(s->be->options & PR_O_HTTP_MODE) == PR_O_HTTP_PCL))) {
unsigned int want_flags = 0;
* bytes from the server, then this is the right moment. We have
* to temporarily assign bytes_out to log what we currently have.
*/
- if (!LIST_ISEMPTY(&s->fe->logformat) && !(s->logs.logwait & LW_BYTES)) {
+ if (!LIST_ISEMPTY(&sess->fe->logformat) && !(s->logs.logwait & LW_BYTES)) {
s->logs.t_close = s->logs.t_data; /* to get a valid end date */
s->logs.bytes_out = txn->rsp.eoh;
s->do_log(s);
*/
int http_response_forward_body(struct stream *s, struct channel *res, int an_bit)
{
+ struct session *sess = s->sess;
struct http_txn *txn = &s->txn;
struct http_msg *msg = &s->txn.rsp;
static struct buffer *tmpbuf = &buf_empty;
goto missing_data;
else if (ret < 0) {
if (msg->err_pos >= 0)
- http_capture_bad_message(&s->be->invalid_rep, s, msg, HTTP_MSG_CHUNK_CRLF, s->fe);
+ http_capture_bad_message(&s->be->invalid_rep, s, msg, HTTP_MSG_CHUNK_CRLF, sess->fe);
goto return_bad_res;
}
/* we're in MSG_CHUNK_SIZE now, fall through */
goto missing_data;
else if (ret < 0) {
if (msg->err_pos >= 0)
- http_capture_bad_message(&s->be->invalid_rep, s, msg, HTTP_MSG_CHUNK_SIZE, s->fe);
+ http_capture_bad_message(&s->be->invalid_rep, s, msg, HTTP_MSG_CHUNK_SIZE, sess->fe);
goto return_bad_res;
}
/* otherwise we're in HTTP_MSG_DATA or HTTP_MSG_TRAILERS state */
goto missing_data;
else if (ret < 0) {
if (msg->err_pos >= 0)
- http_capture_bad_message(&s->be->invalid_rep, s, msg, HTTP_MSG_TRAILERS, s->fe);
+ http_capture_bad_message(&s->be->invalid_rep, s, msg, HTTP_MSG_TRAILERS, sess->fe);
goto return_bad_res;
}
/* we're in HTTP_MSG_DONE now, fall through */
goto aborted_xfer;
}
if (msg->err_pos >= 0)
- http_capture_bad_message(&s->be->invalid_rep, s, msg, ret, s->fe);
+ http_capture_bad_message(&s->be->invalid_rep, s, msg, ret, sess->fe);
goto return_bad_res;
}
return 1;
res->analysers = 0;
s->req.analysers = 0; /* we're in data phase, we want to abort both directions */
- s->fe->fe_counters.cli_aborts++;
+ sess->fe->fe_counters.cli_aborts++;
s->be->be_counters.cli_aborts++;
if (objt_server(s->target))
objt_server(s->target)->counters.cli_aborts++;
* FIXME: should we return an HTTP/500 here so that
* the admin knows there's a problem ?
*/
- if (s->be != s->fe)
+ if (s->be != strm_sess(s)->fe)
break;
/* Swithing Proxy */
* FIXME: should we return an HTTP/500 here so that
* the admin knows there's a problem ?
*/
- if (s->be != s->fe)
+ if (s->be != strm_sess(s)->fe)
break;
/* Swithing Proxy */
void manage_client_side_cookies(struct stream *s, struct channel *req)
{
struct http_txn *txn = &s->txn;
+ struct session *sess = s->sess;
int preserve_hdr;
int cur_idx, old_idx;
char *hdr_beg, *hdr_end, *hdr_next, *del_from;
* can only capture one. Also as an optimisation, we ignore
* cookies shorter than the declared name.
*/
- if (s->fe->capture_name != NULL && txn->cli_cookie == NULL &&
- (val_end - att_beg >= s->fe->capture_namelen) &&
- memcmp(att_beg, s->fe->capture_name, s->fe->capture_namelen) == 0) {
+ if (sess->fe->capture_name != NULL && txn->cli_cookie == NULL &&
+ (val_end - att_beg >= sess->fe->capture_namelen) &&
+ memcmp(att_beg, sess->fe->capture_name, sess->fe->capture_namelen) == 0) {
int log_len = val_end - att_beg;
if ((txn->cli_cookie = pool_alloc2(pool2_capture)) == NULL) {
Alert("HTTP logging : out of memory.\n");
} else {
- if (log_len > s->fe->capture_len)
- log_len = s->fe->capture_len;
+ if (log_len > sess->fe->capture_len)
+ log_len = sess->fe->capture_len;
memcpy(txn->cli_cookie, att_beg, log_len);
txn->cli_cookie[log_len] = 0;
}
void manage_server_side_cookies(struct stream *s, struct channel *res)
{
struct http_txn *txn = &s->txn;
+ struct session *sess = s->sess;
struct server *srv;
int is_cookie2;
int cur_idx, old_idx, delta;
*/
if (s->be->cookie_name == NULL &&
s->be->appsession_name == NULL &&
- s->fe->capture_name == NULL)
+ sess->fe->capture_name == NULL)
return;
/* OK so now we know we have to process this response cookie.
* can only capture one. Also as an optimisation, we ignore
* cookies shorter than the declared name.
*/
- if (s->fe->capture_name != NULL &&
+ if (sess->fe->capture_name != NULL &&
txn->srv_cookie == NULL &&
- (val_end - att_beg >= s->fe->capture_namelen) &&
- memcmp(att_beg, s->fe->capture_name, s->fe->capture_namelen) == 0) {
+ (val_end - att_beg >= sess->fe->capture_namelen) &&
+ memcmp(att_beg, sess->fe->capture_name, sess->fe->capture_namelen) == 0) {
int log_len = val_end - att_beg;
if ((txn->srv_cookie = pool_alloc2(pool2_capture)) == NULL) {
Alert("HTTP logging : out of memory.\n");
}
else {
- if (log_len > s->fe->capture_len)
- log_len = s->fe->capture_len;
+ if (log_len > sess->fe->capture_len)
+ log_len = sess->fe->capture_len;
memcpy(txn->srv_cookie, att_beg, log_len);
txn->srv_cookie[log_len] = 0;
}
void http_init_txn(struct stream *s)
{
struct http_txn *txn = &s->txn;
- struct proxy *fe = s->fe;
+ struct proxy *fe = strm_sess(s)->fe;
txn->flags = 0;
txn->status = -1;
void http_end_txn(struct stream *s)
{
struct http_txn *txn = &s->txn;
+ struct proxy *fe = strm_sess(s)->fe;
/* release any possible compression context */
if (s->flags & SF_COMP_READY)
if (txn->req.cap) {
struct cap_hdr *h;
- for (h = s->fe->req_cap; h; h = h->next)
+ for (h = fe->req_cap; h; h = h->next)
pool_free2(h->pool, txn->req.cap[h->index]);
- memset(txn->req.cap, 0, s->fe->nb_req_cap * sizeof(void *));
+ memset(txn->req.cap, 0, fe->nb_req_cap * sizeof(void *));
}
if (txn->rsp.cap) {
struct cap_hdr *h;
- for (h = s->fe->rsp_cap; h; h = h->next)
+ for (h = fe->rsp_cap; h; h = h->next)
pool_free2(h->pool, txn->rsp.cap[h->index]);
- memset(txn->rsp.cap, 0, s->fe->nb_rsp_cap * sizeof(void *));
+ memset(txn->rsp.cap, 0, fe->nb_rsp_cap * sizeof(void *));
}
}
*/
s->current_rule_list = NULL;
- s->be = s->fe;
- s->logs.logwait = s->fe->to_log;
+ s->be = strm_sess(s)->fe;
+ s->logs.logwait = strm_sess(s)->fe->to_log;
s->logs.level = 0;
stream_del_srv_conn(s);
s->target = NULL;
if (unlikely(s->res.buf->i))
s->res.buf->i = 0;
- s->req.rto = s->fe->timeout.client;
+ s->req.rto = strm_sess(s)->fe->timeout.client;
s->req.wto = TICK_ETERNITY;
s->res.rto = TICK_ETERNITY;
- s->res.wto = s->fe->timeout.client;
+ s->res.wto = strm_sess(s)->fe->timeout.client;
s->req.rex = TICK_ETERNITY;
s->req.wex = TICK_ETERNITY;
smp_fetch_capture_header_req(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
- struct proxy *fe = l4->fe;
+ struct proxy *fe = strm_sess(l4)->fe;
struct http_txn *txn = l7;
int idx;
smp_fetch_capture_header_res(struct proxy *px, struct stream *l4, void *l7, unsigned int opt,
const struct arg *args, struct sample *smp, const char *kw, void *private)
{
- struct proxy *fe = l4->fe;
+ struct proxy *fe = strm_sess(l4)->fe;
struct http_txn *txn = l7;
int idx;
goto out_free_stream;
s->sess->listener = l;
- s->fe = p;
+ s->sess->fe = p;
s->si[0].flags = SI_FL_NONE;
s->si[1].flags = SI_FL_ISBACK;
end = date2str_log(trash.str + trash.len, &tm, &(s->logs.accept_date), trash.size - trash.len);
trash.len = end - trash.str;
if (sess->listener->name)
- chunk_appendf(&trash, "] %s/%s", s->fe->id, sess->listener->name);
+ chunk_appendf(&trash, "] %s/%s", sess->fe->id, sess->listener->name);
else
- chunk_appendf(&trash, "] %s/%d", s->fe->id, sess->listener->luid);
+ chunk_appendf(&trash, "] %s/%d", sess->fe->id, sess->listener->luid);
}
/* This function kills an existing embryonic stream. It stops the connection's
unsigned int log = s->logs.logwait;
const char *err_msg;
- if (s->fe->options2 & PR_O2_LOGERRORS)
+ if (sess->fe->options2 & PR_O2_LOGERRORS)
level = LOG_ERR;
- if (log && (s->fe->options & PR_O_NULLNOLOG)) {
+ if (log && (sess->fe->options & PR_O_NULLNOLOG)) {
/* with "option dontlognull", we don't log connections with no transfer */
if (!conn->err_code ||
conn->err_code == CO_ER_PRX_EMPTY || conn->err_code == CO_ER_PRX_ABORT ||
prepare_mini_sess_log_prefix(s);
err_msg = conn_err_code_str(conn);
if (err_msg)
- send_log(s->fe, level, "%s: %s\n", trash.str, err_msg);
+ send_log(sess->fe, level, "%s: %s\n", trash.str, err_msg);
else
- send_log(s->fe, level, "%s: unknown connection error (code=%d flags=%08x)\n",
+ send_log(sess->fe, level, "%s: unknown connection error (code=%d flags=%08x)\n",
trash.str, conn->err_code, conn->flags);
}
conn_force_close(conn);
conn_free(conn);
- s->fe->feconn--;
+ sess->fe->feconn--;
stream_store_counters(s);
if (!(sess->listener->options & LI_O_UNLIMITED))
if (!LIST_ISEMPTY(&global_listener_queue))
dequeue_all_listeners(&global_listener_queue);
- if (!LIST_ISEMPTY(&s->fe->listener_queue) &&
- (!s->fe->fe_sps_lim || freq_ctr_remain(&s->fe->fe_sess_per_sec, s->fe->fe_sps_lim, 0) > 0))
- dequeue_all_listeners(&s->fe->listener_queue);
+ if (!LIST_ISEMPTY(&sess->fe->listener_queue) &&
+ (!sess->fe->fe_sps_lim || freq_ctr_remain(&sess->fe->fe_sess_per_sec, sess->fe->fe_sps_lim, 0) > 0))
+ dequeue_all_listeners(&sess->fe->listener_queue);
task_delete(s->task);
task_free(s->task);
{
struct session *sess = s->sess;
struct listener *l = sess->listener;
- struct proxy *p = s->fe;
+ struct proxy *p = sess->fe;
struct http_txn *txn;
struct task *t = s->task;
struct connection *conn = __objt_conn(s->target);
* This changes later when switching rules are executed or
* when the default backend is assigned.
*/
- s->be = s->fe;
+ s->be = sess->fe;
s->comp_algo = NULL;
s->req.buf = s->res.buf = NULL;
*/
si_attach_conn(&s->si[0], conn);
- if (likely(s->fe->options2 & PR_O2_INDEPSTR))
+ if (likely(sess->fe->options2 & PR_O2_INDEPSTR))
s->si[0].flags |= SI_FL_INDEP_STR;
/* pre-initialize the other side's stream interface to an INIT state. The
si_reset(&s->si[1]);
si_detach(&s->si[1]);
- if (likely(s->fe->options2 & PR_O2_INDEPSTR))
+ if (likely(sess->fe->options2 & PR_O2_INDEPSTR))
s->si[1].flags |= SI_FL_INDEP_STR;
stream_init_srv_conn(s);
s->res.flags |= CF_ISRESP;
s->res.analysers = 0;
- if (s->fe->options2 & PR_O2_NODELAY) {
+ if (sess->fe->options2 & PR_O2_NODELAY) {
s->req.flags |= CF_NEVER_WAIT;
s->res.flags |= CF_NEVER_WAIT;
}
static void stream_free(struct stream *s)
{
struct http_txn *txn = &s->txn;
- struct proxy *fe = s->fe;
+ struct proxy *fe = strm_sess(s)->fe;
struct bref *bref, *back;
struct connection *cli_conn = objt_conn(s->si[0].end);
int i;
bytes = s->req.total - s->logs.bytes_in;
s->logs.bytes_in = s->req.total;
if (bytes) {
- s->fe->fe_counters.bytes_in += bytes;
+ sess->fe->fe_counters.bytes_in += bytes;
s->be->be_counters.bytes_in += bytes;
bytes = s->res.total - s->logs.bytes_out;
s->logs.bytes_out = s->res.total;
if (bytes) {
- s->fe->fe_counters.bytes_out += bytes;
+ sess->fe->fe_counters.bytes_out += bytes;
s->be->be_counters.bytes_out += bytes;
if (s->be->mode == PR_MODE_TCP) { /* let's allow immediate data connection in this case */
/* if the user wants to log as soon as possible, without counting
* bytes from the server, then this is the right moment. */
- if (!LIST_ISEMPTY(&s->fe->logformat) && !(s->logs.logwait & LW_BYTES)) {
+ if (!LIST_ISEMPTY(&strm_sess(s)->fe->logformat) && !(s->logs.logwait & LW_BYTES)) {
s->logs.t_close = s->logs.t_connect; /* to get a valid end date */
s->do_log(s);
}
rep->flags |= CF_READ_DONTWAIT; /* a single read is enough to get response headers */
}
- rep->analysers |= s->fe->fe_rsp_ana | s->be->be_rsp_ana;
+ rep->analysers |= strm_sess(s)->fe->fe_rsp_ana | s->be->be_rsp_ana;
rep->flags |= CF_READ_ATTACHED; /* producer is now attached */
if (req->flags & CF_WAKE_CONNECT) {
req->flags |= CF_WAKE_ONCE;
if (!(s->flags & SF_FINST_MASK)) {
if (s->si[1].state < SI_ST_REQ) {
- s->fe->fe_counters.failed_req++;
+ strm_sess(s)->fe->fe_counters.failed_req++;
if (strm_sess(s)->listener->counters)
strm_sess(s)->listener->counters->failed_req++;
static int process_switching_rules(struct stream *s, struct channel *req, int an_bit)
{
struct persist_rule *prst_rule;
+ struct proxy *fe = strm_sess(s)->fe;
req->analysers &= ~an_bit;
req->analyse_exp = TICK_ETERNITY;
if (!(s->flags & SF_BE_ASSIGNED)) {
struct switching_rule *rule;
- list_for_each_entry(rule, &s->fe->switching_rules, list) {
+ list_for_each_entry(rule, &fe->switching_rules, list) {
int ret = 1;
if (rule->cond) {
- ret = acl_exec_cond(rule->cond, s->fe, s, &s->txn, SMP_OPT_DIR_REQ|SMP_OPT_FINAL);
+ ret = acl_exec_cond(rule->cond, fe, s, &s->txn, SMP_OPT_DIR_REQ|SMP_OPT_FINAL);
ret = acl_pass(ret);
if (rule->cond->pol == ACL_COND_UNLESS)
ret = !ret;
* backend if any.
*/
if (!(s->flags & SF_BE_ASSIGNED))
- if (!stream_set_backend(s, s->fe->defbe.be ? s->fe->defbe.be : s->be))
+ if (!stream_set_backend(s, fe->defbe.be ? fe->defbe.be : s->be))
goto sw_failed;
}
/* we don't want to run the TCP or HTTP filters again if the backend has not changed */
- if (s->fe == s->be) {
+ if (fe == s->be) {
s->req.analysers &= ~AN_REQ_INSPECT_BE;
s->req.analysers &= ~AN_REQ_HTTP_PROCESS_BE;
}
stream_int_report_error(si_f);
if (!(req->analysers) && !(res->analysers)) {
s->be->be_counters.cli_aborts++;
- s->fe->fe_counters.cli_aborts++;
+ sess->fe->fe_counters.cli_aborts++;
if (srv)
srv->counters.cli_aborts++;
if (!(s->flags & SF_ERR_MASK))
srv->counters.failed_resp++;
if (!(req->analysers) && !(res->analysers)) {
s->be->be_counters.srv_aborts++;
- s->fe->fe_counters.srv_aborts++;
+ sess->fe->fe_counters.srv_aborts++;
if (srv)
srv->counters.srv_aborts++;
if (!(s->flags & SF_ERR_MASK))
}
if (ana_list & AN_REQ_HTTP_PROCESS_FE) {
- if (!http_process_req_common(s, req, AN_REQ_HTTP_PROCESS_FE, s->fe))
+ if (!http_process_req_common(s, req, AN_REQ_HTTP_PROCESS_FE, sess->fe))
break;
UPDATE_ANALYSERS(req->analysers, ana_list, ana_back, AN_REQ_HTTP_PROCESS_FE);
}
req->analysers = 0;
if (req->flags & CF_READ_ERROR) {
s->be->be_counters.cli_aborts++;
- s->fe->fe_counters.cli_aborts++;
+ sess->fe->fe_counters.cli_aborts++;
if (srv)
srv->counters.cli_aborts++;
s->flags |= SF_ERR_CLICL;
}
else if (req->flags & CF_READ_TIMEOUT) {
s->be->be_counters.cli_aborts++;
- s->fe->fe_counters.cli_aborts++;
+ sess->fe->fe_counters.cli_aborts++;
if (srv)
srv->counters.cli_aborts++;
s->flags |= SF_ERR_CLITO;
}
else if (req->flags & CF_WRITE_ERROR) {
s->be->be_counters.srv_aborts++;
- s->fe->fe_counters.srv_aborts++;
+ sess->fe->fe_counters.srv_aborts++;
if (srv)
srv->counters.srv_aborts++;
s->flags |= SF_ERR_SRVCL;
}
else {
s->be->be_counters.srv_aborts++;
- s->fe->fe_counters.srv_aborts++;
+ sess->fe->fe_counters.srv_aborts++;
if (srv)
srv->counters.srv_aborts++;
s->flags |= SF_ERR_SRVTO;
res->analysers = 0;
if (res->flags & CF_READ_ERROR) {
s->be->be_counters.srv_aborts++;
- s->fe->fe_counters.srv_aborts++;
+ sess->fe->fe_counters.srv_aborts++;
if (srv)
srv->counters.srv_aborts++;
s->flags |= SF_ERR_SRVCL;
}
else if (res->flags & CF_READ_TIMEOUT) {
s->be->be_counters.srv_aborts++;
- s->fe->fe_counters.srv_aborts++;
+ sess->fe->fe_counters.srv_aborts++;
if (srv)
srv->counters.srv_aborts++;
s->flags |= SF_ERR_SRVTO;
}
else if (res->flags & CF_WRITE_ERROR) {
s->be->be_counters.cli_aborts++;
- s->fe->fe_counters.cli_aborts++;
+ sess->fe->fe_counters.cli_aborts++;
if (srv)
srv->counters.cli_aborts++;
s->flags |= SF_ERR_CLICL;
}
else {
s->be->be_counters.cli_aborts++;
- s->fe->fe_counters.cli_aborts++;
+ sess->fe->fe_counters.cli_aborts++;
if (srv)
srv->counters.cli_aborts++;
s->flags |= SF_ERR_CLITO;
(objt_conn(si_f->end) && __objt_conn(si_f->end)->xprt && __objt_conn(si_f->end)->xprt->rcv_pipe) &&
(objt_conn(si_b->end) && __objt_conn(si_b->end)->xprt && __objt_conn(si_b->end)->xprt->snd_pipe) &&
(pipes_used < global.maxpipes) &&
- (((s->fe->options2|s->be->options2) & PR_O2_SPLIC_REQ) ||
- (((s->fe->options2|s->be->options2) & PR_O2_SPLIC_AUT) &&
+ (((sess->fe->options2|s->be->options2) & PR_O2_SPLIC_REQ) ||
+ (((sess->fe->options2|s->be->options2) & PR_O2_SPLIC_AUT) &&
(req->flags & CF_STREAMER_FAST)))) {
req->flags |= CF_KERN_SPLICING;
}
if (unlikely((req->flags & (CF_SHUTW|CF_SHUTW_NOW|CF_AUTO_CLOSE|CF_SHUTR)) ==
(CF_AUTO_CLOSE|CF_SHUTR))) {
channel_shutw_now(req);
- if (tick_isset(s->fe->timeout.clientfin)) {
- res->wto = s->fe->timeout.clientfin;
+ if (tick_isset(sess->fe->timeout.clientfin)) {
+ res->wto = sess->fe->timeout.clientfin;
res->wex = tick_add(now_ms, res->wto);
}
}
if (si_f->flags & SI_FL_NOHALF)
si_f->flags |= SI_FL_NOLINGER;
si_shutr(si_f);
- if (tick_isset(s->fe->timeout.clientfin)) {
- res->wto = s->fe->timeout.clientfin;
+ if (tick_isset(sess->fe->timeout.clientfin)) {
+ res->wto = sess->fe->timeout.clientfin;
res->wex = tick_add(now_ms, res->wto);
}
}
req->rto = req->wto = res->rto = res->wto =
s->be->timeout.tunnel;
- if ((req->flags & CF_SHUTR) && tick_isset(s->fe->timeout.clientfin))
- res->wto = s->fe->timeout.clientfin;
+ if ((req->flags & CF_SHUTR) && tick_isset(sess->fe->timeout.clientfin))
+ res->wto = sess->fe->timeout.clientfin;
if ((req->flags & CF_SHUTW) && tick_isset(s->be->timeout.serverfin))
res->rto = s->be->timeout.serverfin;
if ((res->flags & CF_SHUTR) && tick_isset(s->be->timeout.serverfin))
req->wto = s->be->timeout.serverfin;
- if ((res->flags & CF_SHUTW) && tick_isset(s->fe->timeout.clientfin))
- req->rto = s->fe->timeout.clientfin;
+ if ((res->flags & CF_SHUTW) && tick_isset(sess->fe->timeout.clientfin))
+ req->rto = sess->fe->timeout.clientfin;
req->rex = tick_add(now_ms, req->rto);
req->wex = tick_add(now_ms, req->wto);
(objt_conn(si_f->end) && __objt_conn(si_f->end)->xprt && __objt_conn(si_f->end)->xprt->snd_pipe) &&
(objt_conn(si_b->end) && __objt_conn(si_b->end)->xprt && __objt_conn(si_b->end)->xprt->rcv_pipe) &&
(pipes_used < global.maxpipes) &&
- (((s->fe->options2|s->be->options2) & PR_O2_SPLIC_RTR) ||
- (((s->fe->options2|s->be->options2) & PR_O2_SPLIC_AUT) &&
+ (((sess->fe->options2|s->be->options2) & PR_O2_SPLIC_RTR) ||
+ (((sess->fe->options2|s->be->options2) & PR_O2_SPLIC_AUT) &&
(res->flags & CF_STREAMER_FAST)))) {
res->flags |= CF_KERN_SPLICING;
}
if (unlikely((res->flags & (CF_SHUTW|CF_SHUTW_NOW)) == CF_SHUTW_NOW &&
channel_is_empty(res))) {
si_shutw(si_f);
- if (tick_isset(s->fe->timeout.clientfin)) {
- req->rto = s->fe->timeout.clientfin;
+ if (tick_isset(sess->fe->timeout.clientfin)) {
+ req->rto = sess->fe->timeout.clientfin;
req->rex = tick_add(now_ms, req->rto);
}
}
if (likely((si_f->state != SI_ST_CLO) ||
(si_b->state > SI_ST_INI && si_b->state < SI_ST_CLO))) {
- if ((s->fe->options & PR_O_CONTSTATS) && (s->flags & SF_BE_ASSIGNED))
+ if ((sess->fe->options & PR_O_CONTSTATS) && (s->flags & SF_BE_ASSIGNED))
stream_process_counters(s);
if (si_f->state == SI_ST_EST && obj_type(si_f->end) != OBJ_TYPE_APPCTX)
return t; /* nothing more to do */
}
- s->fe->feconn--;
+ sess->fe->feconn--;
if (s->flags & SF_BE_ASSIGNED)
s->be->beconn--;
jobs--;
if (!LIST_ISEMPTY(&global_listener_queue))
dequeue_all_listeners(&global_listener_queue);
- if (!LIST_ISEMPTY(&s->fe->listener_queue) &&
- (!s->fe->fe_sps_lim || freq_ctr_remain(&s->fe->fe_sess_per_sec, s->fe->fe_sps_lim, 0) > 0))
- dequeue_all_listeners(&s->fe->listener_queue);
+ if (!LIST_ISEMPTY(&sess->fe->listener_queue) &&
+ (!sess->fe->fe_sps_lim || freq_ctr_remain(&sess->fe->fe_sess_per_sec, sess->fe->fe_sps_lim, 0) > 0))
+ dequeue_all_listeners(&sess->fe->listener_queue);
}
if (unlikely((global.mode & MODE_DEBUG) &&
if (n < 1 || n > 5)
n = 0;
- if (s->fe->mode == PR_MODE_HTTP) {
- s->fe->fe_counters.p.http.rsp[n]++;
+ if (sess->fe->mode == PR_MODE_HTTP) {
+ sess->fe->fe_counters.p.http.rsp[n]++;
if (s->comp_algo && (s->flags & SF_COMP_READY))
- s->fe->fe_counters.p.http.comp_rsp++;
+ sess->fe->fe_counters.p.http.comp_rsp++;
}
if ((s->flags & SF_BE_ASSIGNED) &&
(s->be->mode == PR_MODE_HTTP)) {
}
/* let's do a final log if we need it */
- if (!LIST_ISEMPTY(&s->fe->logformat) && s->logs.logwait &&
+ if (!LIST_ISEMPTY(&sess->fe->logformat) && s->logs.logwait &&
!(s->flags & SF_MONITOR) &&
- (!(s->fe->options & PR_O_NULLNOLOG) || req->total)) {
+ (!(sess->fe->options & PR_O_NULLNOLOG) || req->total)) {
s->do_log(s);
}