mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 07:37:02 +02:00
MINOR: http-ana: Use http_set_term_flags() in most of HTTP analyzers
We use the new function to set the HTTP termination flags in the most obvious places. The other places are a bit specific and will be handled one by one in dedicated patched.
This commit is contained in:
parent
71236dedb9
commit
4a66c94d25
@ -332,11 +332,7 @@ int http_wait_for_request(struct stream *s, struct channel *req, int an_bit)
|
|||||||
|
|
||||||
return_prx_cond:
|
return_prx_cond:
|
||||||
http_reply_and_close(s, txn->status, http_error_message(s));
|
http_reply_and_close(s, txn->status, http_error_message(s));
|
||||||
|
http_set_term_flags(s);
|
||||||
if (!(s->flags & SF_ERR_MASK))
|
|
||||||
s->flags |= SF_ERR_PRXCOND;
|
|
||||||
if (!(s->flags & SF_FINST_MASK))
|
|
||||||
s->flags |= SF_FINST_R;
|
|
||||||
|
|
||||||
DBG_TRACE_DEVEL("leaving on error",
|
DBG_TRACE_DEVEL("leaving on error",
|
||||||
STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA|STRM_EV_HTTP_ERR, s, txn);
|
STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA|STRM_EV_HTTP_ERR, s, txn);
|
||||||
@ -465,8 +461,7 @@ int http_process_req_common(struct stream *s, struct channel *req, int an_bit, s
|
|||||||
|
|
||||||
if (!(s->flags & SF_ERR_MASK)) // this is not really an error but it is
|
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_ERR_LOCAL; // to mark that it comes from the proxy
|
||||||
if (!(s->flags & SF_FINST_MASK))
|
http_set_term_flags(s);
|
||||||
s->flags |= SF_FINST_R;
|
|
||||||
|
|
||||||
if (HAS_FILTERS(s))
|
if (HAS_FILTERS(s))
|
||||||
req->analysers |= AN_REQ_FLT_HTTP_HDRS;
|
req->analysers |= AN_REQ_FLT_HTTP_HDRS;
|
||||||
@ -599,10 +594,7 @@ int http_process_req_common(struct stream *s, struct channel *req, int an_bit, s
|
|||||||
/* fall through */
|
/* fall through */
|
||||||
|
|
||||||
return_prx_cond:
|
return_prx_cond:
|
||||||
if (!(s->flags & SF_ERR_MASK))
|
http_set_term_flags(s);
|
||||||
s->flags |= SF_ERR_PRXCOND;
|
|
||||||
if (!(s->flags & SF_FINST_MASK))
|
|
||||||
s->flags |= SF_FINST_R;
|
|
||||||
|
|
||||||
req->analysers &= AN_REQ_FLT_END;
|
req->analysers &= AN_REQ_FLT_END;
|
||||||
req->analyse_exp = TICK_ETERNITY;
|
req->analyse_exp = TICK_ETERNITY;
|
||||||
@ -839,11 +831,7 @@ int http_process_request(struct stream *s, struct channel *req, int an_bit)
|
|||||||
_HA_ATOMIC_INC(&sess->listener->counters->internal_errors);
|
_HA_ATOMIC_INC(&sess->listener->counters->internal_errors);
|
||||||
|
|
||||||
http_reply_and_close(s, txn->status, http_error_message(s));
|
http_reply_and_close(s, txn->status, http_error_message(s));
|
||||||
|
http_set_term_flags(s);
|
||||||
if (!(s->flags & SF_ERR_MASK))
|
|
||||||
s->flags |= SF_ERR_PRXCOND;
|
|
||||||
if (!(s->flags & SF_FINST_MASK))
|
|
||||||
s->flags |= SF_FINST_R;
|
|
||||||
|
|
||||||
DBG_TRACE_DEVEL("leaving on error",
|
DBG_TRACE_DEVEL("leaving on error",
|
||||||
STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA|STRM_EV_HTTP_ERR, s, txn);
|
STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA|STRM_EV_HTTP_ERR, s, txn);
|
||||||
@ -884,11 +872,7 @@ int http_process_tarpit(struct stream *s, struct channel *req, int an_bit)
|
|||||||
s->logs.t_queue = tv_ms_elapsed(&s->logs.tv_accept, &now);
|
s->logs.t_queue = tv_ms_elapsed(&s->logs.tv_accept, &now);
|
||||||
|
|
||||||
http_reply_and_close(s, txn->status, (!(req->flags & CF_READ_ERROR) ? http_error_message(s) : NULL));
|
http_reply_and_close(s, txn->status, (!(req->flags & CF_READ_ERROR) ? http_error_message(s) : NULL));
|
||||||
|
http_set_term_flags(s);
|
||||||
if (!(s->flags & SF_ERR_MASK))
|
|
||||||
s->flags |= SF_ERR_PRXCOND;
|
|
||||||
if (!(s->flags & SF_FINST_MASK))
|
|
||||||
s->flags |= SF_FINST_T;
|
|
||||||
|
|
||||||
DBG_TRACE_LEAVE(STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA, s, txn);
|
DBG_TRACE_LEAVE(STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA, s, txn);
|
||||||
return 0;
|
return 0;
|
||||||
@ -1392,8 +1376,7 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
|
|||||||
|
|
||||||
if (!(s->flags & SF_ERR_MASK))
|
if (!(s->flags & SF_ERR_MASK))
|
||||||
s->flags |= SF_ERR_SRVCL;
|
s->flags |= SF_ERR_SRVCL;
|
||||||
if (!(s->flags & SF_FINST_MASK))
|
http_set_term_flags(s);
|
||||||
s->flags |= SF_FINST_H;
|
|
||||||
DBG_TRACE_DEVEL("leaving on error",
|
DBG_TRACE_DEVEL("leaving on error",
|
||||||
STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA|STRM_EV_HTTP_ERR, s, txn);
|
STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA|STRM_EV_HTTP_ERR, s, txn);
|
||||||
return 0;
|
return 0;
|
||||||
@ -1422,8 +1405,7 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
|
|||||||
|
|
||||||
if (!(s->flags & SF_ERR_MASK))
|
if (!(s->flags & SF_ERR_MASK))
|
||||||
s->flags |= SF_ERR_SRVTO;
|
s->flags |= SF_ERR_SRVTO;
|
||||||
if (!(s->flags & SF_FINST_MASK))
|
http_set_term_flags(s);
|
||||||
s->flags |= SF_FINST_H;
|
|
||||||
DBG_TRACE_DEVEL("leaving on error",
|
DBG_TRACE_DEVEL("leaving on error",
|
||||||
STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA|STRM_EV_HTTP_ERR, s, txn);
|
STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA|STRM_EV_HTTP_ERR, s, txn);
|
||||||
return 0;
|
return 0;
|
||||||
@ -1443,8 +1425,7 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
|
|||||||
|
|
||||||
if (!(s->flags & SF_ERR_MASK))
|
if (!(s->flags & SF_ERR_MASK))
|
||||||
s->flags |= SF_ERR_CLICL;
|
s->flags |= SF_ERR_CLICL;
|
||||||
if (!(s->flags & SF_FINST_MASK))
|
http_set_term_flags(s);
|
||||||
s->flags |= SF_FINST_H;
|
|
||||||
|
|
||||||
/* process_stream() will take care of the error */
|
/* process_stream() will take care of the error */
|
||||||
DBG_TRACE_DEVEL("leaving on error",
|
DBG_TRACE_DEVEL("leaving on error",
|
||||||
@ -1479,8 +1460,7 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
|
|||||||
|
|
||||||
if (!(s->flags & SF_ERR_MASK))
|
if (!(s->flags & SF_ERR_MASK))
|
||||||
s->flags |= SF_ERR_SRVCL;
|
s->flags |= SF_ERR_SRVCL;
|
||||||
if (!(s->flags & SF_FINST_MASK))
|
http_set_term_flags(s);
|
||||||
s->flags |= SF_FINST_H;
|
|
||||||
DBG_TRACE_DEVEL("leaving on error",
|
DBG_TRACE_DEVEL("leaving on error",
|
||||||
STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA|STRM_EV_HTTP_ERR, s, txn);
|
STRM_EV_STRM_ANA|STRM_EV_HTTP_ANA|STRM_EV_HTTP_ERR, s, txn);
|
||||||
return 0;
|
return 0;
|
||||||
@ -1498,8 +1478,7 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
|
|||||||
|
|
||||||
if (!(s->flags & SF_ERR_MASK))
|
if (!(s->flags & SF_ERR_MASK))
|
||||||
s->flags |= SF_ERR_CLICL;
|
s->flags |= SF_ERR_CLICL;
|
||||||
if (!(s->flags & SF_FINST_MASK))
|
http_set_term_flags(s);
|
||||||
s->flags |= SF_FINST_H;
|
|
||||||
|
|
||||||
/* process_stream() will take care of the error */
|
/* process_stream() will take care of the error */
|
||||||
DBG_TRACE_DEVEL("leaving on error",
|
DBG_TRACE_DEVEL("leaving on error",
|
||||||
@ -1763,11 +1742,7 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
|
|||||||
|
|
||||||
return_prx_cond:
|
return_prx_cond:
|
||||||
http_reply_and_close(s, txn->status, http_error_message(s));
|
http_reply_and_close(s, txn->status, http_error_message(s));
|
||||||
|
http_set_term_flags(s);
|
||||||
if (!(s->flags & SF_ERR_MASK))
|
|
||||||
s->flags |= SF_ERR_PRXCOND;
|
|
||||||
if (!(s->flags & SF_FINST_MASK))
|
|
||||||
s->flags |= SF_FINST_H;
|
|
||||||
|
|
||||||
s->scb->flags |= SC_FL_NOLINGER;
|
s->scb->flags |= SC_FL_NOLINGER;
|
||||||
DBG_TRACE_DEVEL("leaving on error",
|
DBG_TRACE_DEVEL("leaving on error",
|
||||||
@ -2092,10 +2067,7 @@ int http_process_res_common(struct stream *s, struct channel *rep, int an_bit, s
|
|||||||
s->logs.t_data = -1; /* was not a valid response */
|
s->logs.t_data = -1; /* was not a valid response */
|
||||||
s->scb->flags |= SC_FL_NOLINGER;
|
s->scb->flags |= SC_FL_NOLINGER;
|
||||||
|
|
||||||
if (!(s->flags & SF_ERR_MASK))
|
http_set_term_flags(s);
|
||||||
s->flags |= SF_ERR_PRXCOND;
|
|
||||||
if (!(s->flags & SF_FINST_MASK))
|
|
||||||
s->flags |= SF_FINST_H;
|
|
||||||
|
|
||||||
rep->analysers &= AN_RES_FLT_END;
|
rep->analysers &= AN_RES_FLT_END;
|
||||||
s->req.analysers &= AN_REQ_FLT_END;
|
s->req.analysers &= AN_REQ_FLT_END;
|
||||||
@ -2612,8 +2584,7 @@ int http_apply_redirect_rule(struct redirect_rule *rule, struct stream *s, struc
|
|||||||
|
|
||||||
if (!(s->flags & SF_ERR_MASK))
|
if (!(s->flags & SF_ERR_MASK))
|
||||||
s->flags |= SF_ERR_LOCAL;
|
s->flags |= SF_ERR_LOCAL;
|
||||||
if (!(s->flags & SF_FINST_MASK))
|
http_set_term_flags(s);
|
||||||
s->flags |= ((rule->flags & REDIRECT_FLAG_FROM_REQ) ? SF_FINST_R : SF_FINST_H);
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
free_trash_chunk(chunk);
|
free_trash_chunk(chunk);
|
||||||
|
Loading…
Reference in New Issue
Block a user