return_int_err:
txn->status = 500;
- if (!(s->flags & SF_ERR_MASK))
- s->flags |= SF_ERR_INTERNAL;
+ s->flags |= SF_ERR_INTERNAL;
_HA_ATOMIC_INC(&sess->fe->fe_counters.internal_errors);
if (sess->listener && sess->listener->counters)
_HA_ATOMIC_INC(&sess->listener->counters->internal_errors);
/* fall through */
return_prx_cond:
- http_reply_and_close(s, txn->status, http_error_message(s));
http_set_term_flags(s);
+ http_reply_and_close(s, txn->status, http_error_message(s));
DBG_TRACE_DEVEL("leaving on error",
STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA|STRM_EV_HTTP_ERR, s, txn);
return_int_err:
txn->status = 500;
- if (!(s->flags & SF_ERR_MASK))
- s->flags |= SF_ERR_INTERNAL;
+ s->flags |= SF_ERR_INTERNAL;
_HA_ATOMIC_INC(&sess->fe->fe_counters.internal_errors);
if (s->flags & SF_BE_ASSIGNED)
_HA_ATOMIC_INC(&s->be->be_counters.internal_errors);
/* fall through */
return_prx_err:
+ http_set_term_flags(s);
http_reply_and_close(s, txn->status, http_error_message(s));
/* fall through */
return_int_err:
txn->status = 500;
- if (!(s->flags & SF_ERR_MASK))
- s->flags |= SF_ERR_INTERNAL;
+ s->flags |= SF_ERR_INTERNAL;
_HA_ATOMIC_INC(&sess->fe->fe_counters.internal_errors);
if (s->flags & SF_BE_ASSIGNED)
_HA_ATOMIC_INC(&s->be->be_counters.internal_errors);
if (sess->listener && sess->listener->counters)
_HA_ATOMIC_INC(&sess->listener->counters->internal_errors);
- http_reply_and_close(s, txn->status, http_error_message(s));
http_set_term_flags(s);
+ http_reply_and_close(s, txn->status, http_error_message(s));
DBG_TRACE_DEVEL("leaving on error",
STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA|STRM_EV_HTTP_ERR, s, txn);
*/
s->logs.t_queue = ns_to_ms(now_ns - s->logs.accept_ts);
- http_reply_and_close(s, txn->status, (!(s->scf->flags & SC_FL_ERROR) ? http_error_message(s) : NULL));
http_set_term_flags(s);
+ http_reply_and_close(s, txn->status, (!(s->scf->flags & SC_FL_ERROR) ? http_error_message(s) : NULL));
DBG_TRACE_LEAVE(STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA, s, txn);
return 0;
return_int_err:
txn->status = 500;
- if (!(s->flags & SF_ERR_MASK))
- s->flags |= SF_ERR_INTERNAL;
+ s->flags |= SF_ERR_INTERNAL;
_HA_ATOMIC_INC(&sess->fe->fe_counters.internal_errors);
if (s->flags & SF_BE_ASSIGNED)
_HA_ATOMIC_INC(&s->be->be_counters.internal_errors);
/* fall through */
return_prx_err:
+ http_set_term_flags(s);
http_reply_and_close(s, txn->status, http_error_message(s));
/* fall through */
goto return_prx_cond;
return_int_err:
- if (!(s->flags & SF_ERR_MASK))
- s->flags |= SF_ERR_INTERNAL;
+ s->flags |= SF_ERR_INTERNAL;
_HA_ATOMIC_INC(&sess->fe->fe_counters.internal_errors);
_HA_ATOMIC_INC(&s->be->be_counters.internal_errors);
if (sess->listener && sess->listener->counters)
/* fall through */
return_prx_cond:
+ http_set_term_flags(s);
if (txn->status > 0) {
/* Note: we don't send any error if some data were already sent */
http_reply_and_close(s, txn->status, NULL);
txn->status = status;
http_reply_and_close(s, txn->status, http_error_message(s));
}
- http_set_term_flags(s);
DBG_TRACE_DEVEL("leaving on error ",
STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA|STRM_EV_HTTP_ERR, s, txn);
return 0;
s->scb->flags &= ~(SC_FL_ERROR|SC_FL_SHUT_DONE|SC_FL_SHUT_WANTED);
if (sc_reset_endp(s->scb) < 0) {
- if (!(s->flags & SF_ERR_MASK))
- s->flags |= SF_ERR_INTERNAL;
+ s->flags |= SF_ERR_INTERNAL;
return -1;
}
}
s->scb->flags |= SC_FL_NOLINGER;
- http_reply_and_close(s, txn->status, http_error_message(s));
if (!(s->flags & SF_ERR_MASK))
s->flags |= SF_ERR_SRVCL;
http_set_term_flags(s);
+
+ http_reply_and_close(s, txn->status, http_error_message(s));
DBG_TRACE_DEVEL("leaving on error",
STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA|STRM_EV_HTTP_ERR, s, txn);
return 0;
txn->status = 504;
stream_inc_http_fail_ctr(s);
s->scb->flags |= SC_FL_NOLINGER;
- http_reply_and_close(s, txn->status, http_error_message(s));
if (!(s->flags & SF_ERR_MASK))
s->flags |= SF_ERR_SRVTO;
http_set_term_flags(s);
+
+ http_reply_and_close(s, txn->status, http_error_message(s));
DBG_TRACE_DEVEL("leaving on error",
STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA|STRM_EV_HTTP_ERR, s, txn);
return 0;
_HA_ATOMIC_INC(&__objt_server(s->target)->counters.cli_aborts);
txn->status = 400;
- http_reply_and_close(s, txn->status, http_error_message(s));
if (!(s->flags & SF_ERR_MASK))
s->flags |= SF_ERR_CLICL;
http_set_term_flags(s);
+ http_reply_and_close(s, txn->status, http_error_message(s));
+
/* process_stream() will take care of the error */
DBG_TRACE_DEVEL("leaving on error",
STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA|STRM_EV_HTTP_ERR, s, txn);
txn->status = 502;
stream_inc_http_fail_ctr(s);
s->scb->flags |= SC_FL_NOLINGER;
- http_reply_and_close(s, txn->status, http_error_message(s));
if (!(s->flags & SF_ERR_MASK))
s->flags |= SF_ERR_SRVCL;
http_set_term_flags(s);
+
+ http_reply_and_close(s, txn->status, http_error_message(s));
DBG_TRACE_DEVEL("leaving on error",
STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA|STRM_EV_HTTP_ERR, s, txn);
return 0;
if (objt_server(s->target))
_HA_ATOMIC_INC(&__objt_server(s->target)->counters.internal_errors);
txn->status = 500;
- if (!(s->flags & SF_ERR_MASK))
- s->flags |= SF_ERR_INTERNAL;
+ s->flags |= SF_ERR_INTERNAL;
goto return_prx_cond;
return_bad_res:
/* fall through */
return_prx_cond:
- http_reply_and_close(s, txn->status, http_error_message(s));
http_set_term_flags(s);
+ http_reply_and_close(s, txn->status, http_error_message(s));
s->scb->flags |= SC_FL_NOLINGER;
DBG_TRACE_DEVEL("leaving on error",
return_int_err:
txn->status = 500;
- if (!(s->flags & SF_ERR_MASK))
- s->flags |= SF_ERR_INTERNAL;
+ s->flags |= SF_ERR_INTERNAL;
_HA_ATOMIC_INC(&sess->fe->fe_counters.internal_errors);
_HA_ATOMIC_INC(&s->be->be_counters.internal_errors);
if (sess->listener && sess->listener->counters)
/* fall through */
return_prx_err:
+ http_set_term_flags(s);
http_reply_and_close(s, txn->status, http_error_message(s));
/* fall through */
_HA_ATOMIC_INC(&sess->listener->counters->internal_errors);
if (objt_server(s->target))
_HA_ATOMIC_INC(&__objt_server(s->target)->counters.internal_errors);
- if (!(s->flags & SF_ERR_MASK))
- s->flags |= SF_ERR_INTERNAL;
+ s->flags |= SF_ERR_INTERNAL;
goto return_error;
return_bad_res:
return_error:
/* don't send any error message as we're in the body */
- http_reply_and_close(s, txn->status, NULL);
http_set_term_flags(s);
+ http_reply_and_close(s, txn->status, NULL);
stream_inc_http_fail_ctr(s);
DBG_TRACE_DEVEL("leaving on error",
STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA|STRM_EV_HTTP_ERR, s, txn);
htx->flags |= HTX_FL_EOM;
htx_to_buf(htx, &res->buf);
+
+ if (!(s->flags & SF_ERR_MASK))
+ s->flags |= SF_ERR_LOCAL;
+ http_set_term_flags(s);
+
if (!http_forward_proxy_resp(s, 1))
goto fail;
_HA_ATOMIC_INC(&s->sess->fe->fe_counters.intercepted_req);
}
- if (!(s->flags & SF_ERR_MASK))
- s->flags |= SF_ERR_LOCAL;
- http_set_term_flags(s);
-
out:
free_trash_chunk(chunk);
return ret;
return ret;
abort:
+ http_set_term_flags(s);
http_reply_and_close(s, txn->status, http_error_message(s));
ret = HTTP_RULE_RES_ABRT;
goto end;
htx->flags |= HTX_FL_EOM;
htx_to_buf(htx, &res->buf);
+
+ if (!(s->flags & SF_ERR_MASK))
+ s->flags |= SF_ERR_LOCAL;
+ if (!(s->flags & SF_FINST_MASK))
+ s->flags |= SF_FINST_C;
+
if (!http_forward_proxy_resp(s, 1))
goto fail;
s->conn_err_type = STRM_ET_NONE;
sc->state = SC_ST_CLO;
- if (!(s->flags & SF_ERR_MASK))
- s->flags |= SF_ERR_LOCAL;
- if (!(s->flags & SF_FINST_MASK))
- s->flags |= SF_FINST_C;
/* FIXME: we should increase a counter of redirects per server and per backend. */
srv_inc_sess_ctr(srv);
void http_server_error(struct stream *s, struct stconn *sc, int err,
int finst, struct http_reply *msg)
{
- http_reply_and_close(s, s->txn->status, msg);
if (!(s->flags & SF_ERR_MASK))
s->flags |= err;
if (!(s->flags & SF_FINST_MASK))
s->flags |= finst;
+
+ http_reply_and_close(s, s->txn->status, msg);
}
void http_reply_and_close(struct stream *s, short status, struct http_reply *msg)