proxy->timeout.tunnel = TICK_ETERNITY;
}
+/* return proxy's abortonclose status: 0=off, non-zero=on */
+static inline int proxy_abrt_close(const struct proxy *px)
+{
+ return !!(px->options & PR_O_ABRT_CLOSE);
+}
+
/* increase the number of cumulated connections received on the designated frontend */
static inline void proxy_inc_fe_conn_ctr(struct listener *l, struct proxy *fe)
{
{
return ((s->scf->flags & SC_FL_ERROR) ||
((s->scb->flags & (SC_FL_SHUT_WANTED|SC_FL_SHUT_DONE)) && /* empty and client aborted */
- (!co_data(req) || (s->be->options & PR_O_ABRT_CLOSE))));
+ (!co_data(req) || proxy_abrt_close(s->be))));
}
/* Update back stream connector status for input states SC_ST_ASS, SC_ST_QUE,
/* the client might want to abort */
if ((s->scf->flags & SC_FL_SHUT_DONE) ||
((s->scb->flags & SC_FL_SHUT_WANTED) &&
- (!co_data(req) || (s->be->options & PR_O_ABRT_CLOSE)))) {
+ (!co_data(req) || proxy_abrt_close(s->be)))) {
sc->flags |= SC_FL_NOLINGER;
sc_shutdown(sc);
s->conn_err_type |= STRM_ET_CONN_ABRT;
/* client abort ? */
if ((s->scf->flags & SC_FL_SHUT_DONE) ||
((s->scb->flags & SC_FL_SHUT_WANTED) &&
- (!co_data(req) || (s->be->options & PR_O_ABRT_CLOSE)))) {
+ (!co_data(req) || proxy_abrt_close(s->be)))) {
/* give up */
sc->flags |= SC_FL_NOLINGER;
sc_shutdown(sc);
* server, which will decide whether to close or to go on processing the
* request. We only do that in tunnel mode, and not in other modes since
* it can be abused to exhaust source ports. */
- if (s->be->options & PR_O_ABRT_CLOSE) {
+ if (proxy_abrt_close(s->be)) {
channel_auto_read(req);
if ((s->scf->flags & (SC_FL_ABRT_DONE|SC_FL_EOS)) && !(txn->flags & TX_CON_WANT_TUN))
s->scb->flags |= SC_FL_NOLINGER;
if ((s->scf->flags & SC_FL_ERROR) ||
((s->scf->flags & (SC_FL_EOS|SC_FL_ABRT_DONE)) &&
- (px->options & PR_O_ABRT_CLOSE)))
+ proxy_abrt_close(px)))
act_opts |= ACT_OPT_FINAL | ACT_OPT_FINAL_EARLY;
/* If "the current_rule_list" match the executed rule list, we are in
act_opts |= ACT_OPT_FINAL;
if ((s->scf->flags & SC_FL_ERROR) ||
((s->scf->flags & (SC_FL_EOS|SC_FL_ABRT_DONE)) &&
- (px->options & PR_O_ABRT_CLOSE)))
+ proxy_abrt_close(px)))
act_opts |= ACT_OPT_FINAL | ACT_OPT_FINAL_EARLY;
/* If "the current_rule_list" match the executed rule list, we are in
* buffers, otherwise a close could cause an RST on some systems
* (eg: Linux).
*/
- if (!(s->be->options & PR_O_ABRT_CLOSE) && txn->meth != HTTP_METH_POST)
+ if (!proxy_abrt_close(s->be) && txn->meth != HTTP_METH_POST)
channel_dont_read(chn);
/* if the server closes the connection, we want to immediately react
if (txn->rsp.flags & HTTP_MSGF_XFER_LEN)
s->scb->flags |= SC_FL_NOLINGER; /* we want to close ASAP */
/* see above in MSG_DONE why we only do this in these states */
- if (!(s->be->options & PR_O_ABRT_CLOSE))
+ if (!proxy_abrt_close(s->be))
channel_dont_read(chn);
goto end;
}
if (ctx->conn->flags & CO_FL_SSL_WAIT_HS &&
!conn_is_back(ctx->conn) &&
- ((struct session *)ctx->conn->owner)->fe->options & PR_O_ABRT_CLOSE)
+ proxy_abrt_close(((struct session *)ctx->conn->owner)->fe))
detect_shutr = 1;
else
detect_shutr = 0;
#include <haproxy/http_ana.h>
#include <haproxy/pipe.h>
#include <haproxy/pool.h>
+#include <haproxy/proxy.h>
#include <haproxy/sample.h>
#include <haproxy/sc_strm.h>
#include <haproxy/stconn.h>
/* Instruct the mux it must subscribed for read events */
if (!(sc->flags & SC_FL_ISBACK) && /* for frontend conns only */
(sc_opposite(sc)->state != SC_ST_INI) && /* before backend connection setup */
- (__sc_strm(sc)->be->options & PR_O_ABRT_CLOSE)) /* if abortonclose option is set for the current backend */
+ proxy_abrt_close(__sc_strm(sc)->be)) /* if abortonclose option is set for the current backend */
flags |= CO_RFL_KEEP_RECV;
/* Important note : if we're called with POLL_IN|POLL_HUP, it means the read polling
!(s->txn->flags & TX_D_L7_RETRY))
s->txn->flags |= TX_L7_RETRY;
- if (s->be->options & PR_O_ABRT_CLOSE) {
+ if (proxy_abrt_close(s->be)) {
struct connection *conn = sc_conn(scf);
se_have_more_data(scf->sedesc);
*/
if (unlikely((req->flags & CF_AUTO_CLOSE) && (scf->flags & (SC_FL_EOS|SC_FL_ABRT_DONE)) &&
!(scb->flags & (SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED)) &&
- (scb->state != SC_ST_CON || (s->be->options & PR_O_ABRT_CLOSE)))) {
+ (scb->state != SC_ST_CON || proxy_abrt_close(s->be)))) {
sc_schedule_shutdown(scb);
}