mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 15:47:01 +02:00
MEDIUM: tevt/stconn/stream: Add dedicated termination events for stream location
If it is the last patch to introduce dedicated termination events for each location. In this one, events for the stream location are introcued. The old enum is also removed because it is now unused. Here, more accurate evets are added. The "intercepted" event was splitted.
This commit is contained in:
parent
9697704932
commit
2dc02f75b1
@ -616,22 +616,21 @@ enum se_term_event_type {
|
|||||||
se_tevt_type_cancelled = 12,
|
se_tevt_type_cancelled = 12,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum term_event_type {
|
enum strm_term_event_type {
|
||||||
/* Events emitted by haproxy */
|
strm_tevt_type_shutw = 1,
|
||||||
tevt_type_shutw = 1,
|
strm_tevt_type_eos = 2,
|
||||||
tevt_type_intercepted = 2,
|
strm_tevt_type_rcv_err = 3,
|
||||||
tevt_type_tout = 3,
|
strm_tevt_type_snd_err = 4,
|
||||||
|
strm_tevt_type_truncated_eos = 5,
|
||||||
|
strm_tevt_type_truncated_rcv_err= 6,
|
||||||
|
|
||||||
/* 4..9 unsued */
|
strm_tevt_type_tout = 7,
|
||||||
|
strm_tevt_type_intercepted = 8,
|
||||||
|
|
||||||
/* Events received by haproxy */
|
strm_tevt_type_proto_err = 9,
|
||||||
tevt_type_shutr = 10,
|
strm_tevt_type_internal_err = 10,
|
||||||
tevt_type_rcv_err = 11,
|
strm_tevt_type_other_err = 11,
|
||||||
tevt_type_truncated_shutr = 12,
|
strm_tevt_type_aborted = 12,
|
||||||
tevt_type_truncated_rcv_err= 13,
|
|
||||||
tevt_type_snd_err = 14,
|
|
||||||
|
|
||||||
/* 15 unsued */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* This structure describes a connection with its methods and data.
|
/* This structure describes a connection with its methods and data.
|
||||||
|
@ -574,7 +574,10 @@ static inline void se_report_term_evt(struct sedesc *se, enum se_term_event_type
|
|||||||
se->term_evts_log = tevt_report_event(se->term_evts_log, loc, type);
|
se->term_evts_log = tevt_report_event(se->term_evts_log, loc, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void sc_report_term_evt(struct stconn *sc, enum strm_term_event_type type)
|
||||||
{
|
{
|
||||||
|
enum term_event_loc loc = tevt_loc_strm;
|
||||||
|
|
||||||
if (sc->flags & SC_FL_ISBACK)
|
if (sc->flags & SC_FL_ISBACK)
|
||||||
loc += 8;
|
loc += 8;
|
||||||
sc->term_evts_log = tevt_report_event(sc->term_evts_log, loc, type);
|
sc->term_evts_log = tevt_report_event(sc->term_evts_log, loc, type);
|
||||||
|
@ -418,9 +418,10 @@ static inline unsigned int stream_map_task_state(unsigned int state)
|
|||||||
0;
|
0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void stream_report_term_evt(struct stconn *sc, enum term_event_loc loc, enum term_event_type type)
|
static inline void stream_report_term_evt(struct stconn *sc, enum strm_term_event_type type)
|
||||||
{
|
{
|
||||||
struct stream *s = sc_strm(sc);
|
struct stream *s = sc_strm(sc);
|
||||||
|
enum term_event_loc loc = tevt_loc_strm;
|
||||||
|
|
||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
@ -244,6 +244,7 @@ int http_wait_for_request(struct stream *s, struct channel *req, int an_bit)
|
|||||||
txn->status = 503;
|
txn->status = 503;
|
||||||
if (!(s->flags & SF_ERR_MASK))
|
if (!(s->flags & SF_ERR_MASK))
|
||||||
s->flags |= SF_ERR_LOCAL; /* we don't want a real error here */
|
s->flags |= SF_ERR_LOCAL; /* we don't want a real error here */
|
||||||
|
stream_report_term_evt(s->scf, strm_tevt_type_intercepted);
|
||||||
goto return_prx_cond;
|
goto return_prx_cond;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,6 +252,7 @@ int http_wait_for_request(struct stream *s, struct channel *req, int an_bit)
|
|||||||
txn->status = 200;
|
txn->status = 200;
|
||||||
if (!(s->flags & SF_ERR_MASK))
|
if (!(s->flags & SF_ERR_MASK))
|
||||||
s->flags |= SF_ERR_LOCAL; /* we don't want a real error here */
|
s->flags |= SF_ERR_LOCAL; /* we don't want a real error here */
|
||||||
|
stream_report_term_evt(s->scf, strm_tevt_type_intercepted);
|
||||||
goto return_prx_cond;
|
goto return_prx_cond;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -343,6 +345,7 @@ int http_wait_for_request(struct stream *s, struct channel *req, int an_bit)
|
|||||||
_HA_ATOMIC_INC(&sess->fe->fe_counters.internal_errors);
|
_HA_ATOMIC_INC(&sess->fe->fe_counters.internal_errors);
|
||||||
if (sess->listener && sess->listener->counters)
|
if (sess->listener && sess->listener->counters)
|
||||||
_HA_ATOMIC_INC(&sess->listener->counters->internal_errors);
|
_HA_ATOMIC_INC(&sess->listener->counters->internal_errors);
|
||||||
|
stream_report_term_evt(s->scb, strm_tevt_type_internal_err);
|
||||||
goto return_prx_cond;
|
goto return_prx_cond;
|
||||||
|
|
||||||
return_bad_req:
|
return_bad_req:
|
||||||
@ -350,11 +353,10 @@ int http_wait_for_request(struct stream *s, struct channel *req, int an_bit)
|
|||||||
_HA_ATOMIC_INC(&sess->fe->fe_counters.failed_req);
|
_HA_ATOMIC_INC(&sess->fe->fe_counters.failed_req);
|
||||||
if (sess->listener && sess->listener->counters)
|
if (sess->listener && sess->listener->counters)
|
||||||
_HA_ATOMIC_INC(&sess->listener->counters->failed_req);
|
_HA_ATOMIC_INC(&sess->listener->counters->failed_req);
|
||||||
|
stream_report_term_evt(s->scb, strm_tevt_type_proto_err);
|
||||||
/* fall through */
|
/* fall through */
|
||||||
|
|
||||||
return_prx_cond:
|
return_prx_cond:
|
||||||
// XXX: All errors are handled as intercepted here !
|
|
||||||
stream_report_term_evt(s->scf, tevt_loc_strm, tevt_type_intercepted);
|
|
||||||
http_set_term_flags(s);
|
http_set_term_flags(s);
|
||||||
http_reply_and_close(s, txn->status, http_error_message(s));
|
http_reply_and_close(s, txn->status, http_error_message(s));
|
||||||
|
|
||||||
@ -412,6 +414,7 @@ int http_process_req_common(struct stream *s, struct channel *req, int an_bit, s
|
|||||||
goto deny;
|
goto deny;
|
||||||
|
|
||||||
case HTTP_RULE_RES_ABRT: /* abort request, response already sent. Eg: auth */
|
case HTTP_RULE_RES_ABRT: /* abort request, response already sent. Eg: auth */
|
||||||
|
stream_report_term_evt(s->scf, strm_tevt_type_intercepted);
|
||||||
goto return_prx_cond;
|
goto return_prx_cond;
|
||||||
|
|
||||||
case HTTP_RULE_RES_DONE: /* OK, but terminate request processing (eg: redirect) */
|
case HTTP_RULE_RES_DONE: /* OK, but terminate request processing (eg: redirect) */
|
||||||
@ -465,8 +468,10 @@ int http_process_req_common(struct stream *s, struct channel *req, int an_bit, s
|
|||||||
if (verdict == HTTP_RULE_RES_DENY) /* stats http-request deny */
|
if (verdict == HTTP_RULE_RES_DENY) /* stats http-request deny */
|
||||||
goto deny;
|
goto deny;
|
||||||
|
|
||||||
if (verdict == HTTP_RULE_RES_ABRT) /* stats auth / stats http-request auth */
|
if (verdict == HTTP_RULE_RES_ABRT) { /* stats auth / stats http-request auth */
|
||||||
|
stream_report_term_evt(s->scf, strm_tevt_type_intercepted);
|
||||||
goto return_prx_cond;
|
goto return_prx_cond;
|
||||||
|
}
|
||||||
|
|
||||||
if (verdict == HTTP_RULE_RES_BADREQ) /* failed with a bad request */
|
if (verdict == HTTP_RULE_RES_BADREQ) /* failed with a bad request */
|
||||||
goto return_bad_req;
|
goto return_bad_req;
|
||||||
@ -507,7 +512,7 @@ int http_process_req_common(struct stream *s, struct channel *req, int an_bit, s
|
|||||||
if (!http_apply_redirect_rule(rule, s, txn)) {
|
if (!http_apply_redirect_rule(rule, s, txn)) {
|
||||||
goto return_int_err;
|
goto return_int_err;
|
||||||
}
|
}
|
||||||
stream_report_term_evt(s->scf, tevt_loc_strm, tevt_type_intercepted);
|
stream_report_term_evt(s->scf, strm_tevt_type_intercepted);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -559,6 +564,7 @@ int http_process_req_common(struct stream *s, struct channel *req, int an_bit, s
|
|||||||
_HA_ATOMIC_INC(&s->be->be_counters.denied_req);
|
_HA_ATOMIC_INC(&s->be->be_counters.denied_req);
|
||||||
if (sess->listener && sess->listener->counters)
|
if (sess->listener && sess->listener->counters)
|
||||||
_HA_ATOMIC_INC(&sess->listener->counters->denied_req);
|
_HA_ATOMIC_INC(&sess->listener->counters->denied_req);
|
||||||
|
stream_report_term_evt(s->scf, strm_tevt_type_intercepted);
|
||||||
goto done_without_exp;
|
goto done_without_exp;
|
||||||
|
|
||||||
deny: /* this request was blocked (denied) */
|
deny: /* this request was blocked (denied) */
|
||||||
@ -575,6 +581,7 @@ int http_process_req_common(struct stream *s, struct channel *req, int an_bit, s
|
|||||||
_HA_ATOMIC_INC(&s->be->be_counters.denied_req);
|
_HA_ATOMIC_INC(&s->be->be_counters.denied_req);
|
||||||
if (sess->listener && sess->listener->counters)
|
if (sess->listener && sess->listener->counters)
|
||||||
_HA_ATOMIC_INC(&sess->listener->counters->denied_req);
|
_HA_ATOMIC_INC(&sess->listener->counters->denied_req);
|
||||||
|
stream_report_term_evt(s->scf, strm_tevt_type_intercepted);
|
||||||
goto return_prx_err;
|
goto return_prx_err;
|
||||||
|
|
||||||
return_fail_rewrite:
|
return_fail_rewrite:
|
||||||
@ -598,6 +605,7 @@ int http_process_req_common(struct stream *s, struct channel *req, int an_bit, s
|
|||||||
_HA_ATOMIC_INC(&s->be->be_counters.internal_errors);
|
_HA_ATOMIC_INC(&s->be->be_counters.internal_errors);
|
||||||
if (sess->listener && sess->listener->counters)
|
if (sess->listener && sess->listener->counters)
|
||||||
_HA_ATOMIC_INC(&sess->listener->counters->internal_errors);
|
_HA_ATOMIC_INC(&sess->listener->counters->internal_errors);
|
||||||
|
stream_report_term_evt(s->scf, strm_tevt_type_internal_err);
|
||||||
goto return_prx_err;
|
goto return_prx_err;
|
||||||
|
|
||||||
return_bad_req:
|
return_bad_req:
|
||||||
@ -605,6 +613,7 @@ int http_process_req_common(struct stream *s, struct channel *req, int an_bit, s
|
|||||||
_HA_ATOMIC_INC(&sess->fe->fe_counters.failed_req);
|
_HA_ATOMIC_INC(&sess->fe->fe_counters.failed_req);
|
||||||
if (sess->listener && sess->listener->counters)
|
if (sess->listener && sess->listener->counters)
|
||||||
_HA_ATOMIC_INC(&sess->listener->counters->failed_req);
|
_HA_ATOMIC_INC(&sess->listener->counters->failed_req);
|
||||||
|
stream_report_term_evt(s->scf, strm_tevt_type_proto_err);
|
||||||
/* fall through */
|
/* fall through */
|
||||||
|
|
||||||
return_prx_err:
|
return_prx_err:
|
||||||
@ -613,8 +622,6 @@ 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:
|
||||||
// XXX: All errors are handled as intercepted here !
|
|
||||||
stream_report_term_evt(s->scf, tevt_loc_strm, tevt_type_intercepted);
|
|
||||||
http_set_term_flags(s);
|
http_set_term_flags(s);
|
||||||
req->analysers &= AN_REQ_FLT_END;
|
req->analysers &= AN_REQ_FLT_END;
|
||||||
req->analyse_exp = TICK_ETERNITY;
|
req->analyse_exp = TICK_ETERNITY;
|
||||||
@ -750,9 +757,8 @@ int http_process_request(struct stream *s, struct channel *req, int an_bit)
|
|||||||
_HA_ATOMIC_INC(&s->be->be_counters.internal_errors);
|
_HA_ATOMIC_INC(&s->be->be_counters.internal_errors);
|
||||||
if (sess->listener && sess->listener->counters)
|
if (sess->listener && sess->listener->counters)
|
||||||
_HA_ATOMIC_INC(&sess->listener->counters->internal_errors);
|
_HA_ATOMIC_INC(&sess->listener->counters->internal_errors);
|
||||||
|
stream_report_term_evt(s->scf, strm_tevt_type_internal_err);
|
||||||
|
|
||||||
// XXX: All errors are handled as intercepted here !
|
|
||||||
stream_report_term_evt(s->scf, tevt_loc_strm, tevt_type_intercepted);
|
|
||||||
http_set_term_flags(s);
|
http_set_term_flags(s);
|
||||||
http_reply_and_close(s, txn->status, http_error_message(s));
|
http_reply_and_close(s, txn->status, http_error_message(s));
|
||||||
|
|
||||||
@ -795,7 +801,7 @@ int http_process_tarpit(struct stream *s, struct channel *req, int an_bit)
|
|||||||
s->logs.t_queue = ns_to_ms(now_ns - s->logs.accept_ts);
|
s->logs.t_queue = ns_to_ms(now_ns - s->logs.accept_ts);
|
||||||
|
|
||||||
// XXX: All errors are handled as intercepted here !
|
// XXX: All errors are handled as intercepted here !
|
||||||
stream_report_term_evt(s->scf, tevt_loc_strm, tevt_type_intercepted);
|
stream_report_term_evt(s->scf, strm_tevt_type_intercepted);
|
||||||
http_set_term_flags(s);
|
http_set_term_flags(s);
|
||||||
http_reply_and_close(s, txn->status, (!(s->scf->flags & SC_FL_ERROR) ? http_error_message(s) : NULL));
|
http_reply_and_close(s, txn->status, (!(s->scf->flags & SC_FL_ERROR) ? http_error_message(s) : NULL));
|
||||||
|
|
||||||
@ -833,6 +839,7 @@ int http_wait_for_request_body(struct stream *s, struct channel *req, int an_bit
|
|||||||
case HTTP_RULE_RES_ERROR:
|
case HTTP_RULE_RES_ERROR:
|
||||||
goto return_int_err;
|
goto return_int_err;
|
||||||
case HTTP_RULE_RES_ABRT:
|
case HTTP_RULE_RES_ABRT:
|
||||||
|
stream_report_term_evt(s->scf, strm_tevt_type_intercepted);
|
||||||
goto return_prx_cond;
|
goto return_prx_cond;
|
||||||
default:
|
default:
|
||||||
goto return_int_err;
|
goto return_int_err;
|
||||||
@ -861,6 +868,7 @@ int http_wait_for_request_body(struct stream *s, struct channel *req, int an_bit
|
|||||||
_HA_ATOMIC_INC(&s->be->be_counters.internal_errors);
|
_HA_ATOMIC_INC(&s->be->be_counters.internal_errors);
|
||||||
if (sess->listener && sess->listener->counters)
|
if (sess->listener && sess->listener->counters)
|
||||||
_HA_ATOMIC_INC(&sess->listener->counters->internal_errors);
|
_HA_ATOMIC_INC(&sess->listener->counters->internal_errors);
|
||||||
|
stream_report_term_evt(s->scf, strm_tevt_type_internal_err);
|
||||||
goto return_prx_err;
|
goto return_prx_err;
|
||||||
|
|
||||||
return_bad_req: /* let's centralize all bad requests */
|
return_bad_req: /* let's centralize all bad requests */
|
||||||
@ -868,6 +876,7 @@ int http_wait_for_request_body(struct stream *s, struct channel *req, int an_bit
|
|||||||
_HA_ATOMIC_INC(&sess->fe->fe_counters.failed_req);
|
_HA_ATOMIC_INC(&sess->fe->fe_counters.failed_req);
|
||||||
if (sess->listener && sess->listener->counters)
|
if (sess->listener && sess->listener->counters)
|
||||||
_HA_ATOMIC_INC(&sess->listener->counters->failed_req);
|
_HA_ATOMIC_INC(&sess->listener->counters->failed_req);
|
||||||
|
stream_report_term_evt(s->scf, strm_tevt_type_proto_err);
|
||||||
/* fall through */
|
/* fall through */
|
||||||
|
|
||||||
return_prx_err:
|
return_prx_err:
|
||||||
@ -876,8 +885,6 @@ int http_wait_for_request_body(struct stream *s, struct channel *req, int an_bit
|
|||||||
/* fall through */
|
/* fall through */
|
||||||
|
|
||||||
return_prx_cond:
|
return_prx_cond:
|
||||||
// XXX: All errors are handled as intercepted here !
|
|
||||||
stream_report_term_evt(s->scf, tevt_loc_strm, tevt_type_intercepted);
|
|
||||||
http_set_term_flags(s);
|
http_set_term_flags(s);
|
||||||
|
|
||||||
req->analysers &= AN_REQ_FLT_END;
|
req->analysers &= AN_REQ_FLT_END;
|
||||||
@ -1112,8 +1119,6 @@ int http_request_forward_body(struct stream *s, struct channel *req, int an_bit)
|
|||||||
goto return_prx_cond;
|
goto return_prx_cond;
|
||||||
|
|
||||||
return_int_err:
|
return_int_err:
|
||||||
// XXX: All errors are handled as intercepted here !
|
|
||||||
stream_report_term_evt(s->scf, tevt_loc_strm, tevt_type_intercepted);
|
|
||||||
if (!(s->flags & SF_ERR_MASK))
|
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(&sess->fe->fe_counters.internal_errors);
|
||||||
@ -1122,16 +1127,16 @@ int http_request_forward_body(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);
|
||||||
if (objt_server(s->target))
|
if (objt_server(s->target))
|
||||||
_HA_ATOMIC_INC(&__objt_server(s->target)->counters.internal_errors);
|
_HA_ATOMIC_INC(&__objt_server(s->target)->counters.internal_errors);
|
||||||
|
stream_report_term_evt(s->scf, strm_tevt_type_internal_err);
|
||||||
status = 500;
|
status = 500;
|
||||||
COUNT_IF(1, "Internal error during request forwarding");
|
COUNT_IF(1, "Internal error during request forwarding");
|
||||||
goto return_prx_cond;
|
goto return_prx_cond;
|
||||||
|
|
||||||
return_bad_req:
|
return_bad_req:
|
||||||
// XXX: All errors are handled as intercepted here !
|
|
||||||
stream_report_term_evt(s->scf, tevt_loc_strm, tevt_type_intercepted);
|
|
||||||
_HA_ATOMIC_INC(&sess->fe->fe_counters.failed_req);
|
_HA_ATOMIC_INC(&sess->fe->fe_counters.failed_req);
|
||||||
if (sess->listener && sess->listener->counters)
|
if (sess->listener && sess->listener->counters)
|
||||||
_HA_ATOMIC_INC(&sess->listener->counters->failed_req);
|
_HA_ATOMIC_INC(&sess->listener->counters->failed_req);
|
||||||
|
stream_report_term_evt(s->scf, strm_tevt_type_proto_err);
|
||||||
status = 400;
|
status = 400;
|
||||||
COUNT_IF(1, "Request parsing error during request forwarding");
|
COUNT_IF(1, "Request parsing error during request forwarding");
|
||||||
/* fall through */
|
/* fall through */
|
||||||
@ -1663,6 +1668,7 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
|
|||||||
txn->status = 500;
|
txn->status = 500;
|
||||||
if (!(s->flags & SF_ERR_MASK))
|
if (!(s->flags & SF_ERR_MASK))
|
||||||
s->flags |= SF_ERR_INTERNAL;
|
s->flags |= SF_ERR_INTERNAL;
|
||||||
|
stream_report_term_evt(s->scb, strm_tevt_type_internal_err);
|
||||||
goto return_prx_cond;
|
goto return_prx_cond;
|
||||||
|
|
||||||
return_bad_res:
|
return_bad_res:
|
||||||
@ -1680,11 +1686,10 @@ int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit)
|
|||||||
|
|
||||||
txn->status = 502;
|
txn->status = 502;
|
||||||
stream_inc_http_fail_ctr(s);
|
stream_inc_http_fail_ctr(s);
|
||||||
|
stream_report_term_evt(s->scb, strm_tevt_type_proto_err);
|
||||||
/* fall through */
|
/* fall through */
|
||||||
|
|
||||||
return_prx_cond:
|
return_prx_cond:
|
||||||
// XXX: All errors are handled as intercepted here !
|
|
||||||
stream_report_term_evt(s->scb, tevt_loc_strm, tevt_type_intercepted);
|
|
||||||
http_set_term_flags(s);
|
http_set_term_flags(s);
|
||||||
http_reply_and_close(s, txn->status, http_error_message(s));
|
http_reply_and_close(s, txn->status, http_error_message(s));
|
||||||
|
|
||||||
@ -1785,6 +1790,7 @@ int http_process_res_common(struct stream *s, struct channel *rep, int an_bit, s
|
|||||||
goto deny;
|
goto deny;
|
||||||
|
|
||||||
case HTTP_RULE_RES_ABRT: /* abort request, response already sent */
|
case HTTP_RULE_RES_ABRT: /* abort request, response already sent */
|
||||||
|
stream_report_term_evt(s->scb, strm_tevt_type_intercepted);
|
||||||
goto return_prx_cond;
|
goto return_prx_cond;
|
||||||
|
|
||||||
case HTTP_RULE_RES_DONE: /* OK, but terminate request processing (eg: redirect) */
|
case HTTP_RULE_RES_DONE: /* OK, but terminate request processing (eg: redirect) */
|
||||||
@ -1976,6 +1982,7 @@ int http_process_res_common(struct stream *s, struct channel *rep, int an_bit, s
|
|||||||
_HA_ATOMIC_INC(&sess->listener->counters->denied_resp);
|
_HA_ATOMIC_INC(&sess->listener->counters->denied_resp);
|
||||||
if (objt_server(s->target))
|
if (objt_server(s->target))
|
||||||
_HA_ATOMIC_INC(&__objt_server(s->target)->counters.denied_resp);
|
_HA_ATOMIC_INC(&__objt_server(s->target)->counters.denied_resp);
|
||||||
|
stream_report_term_evt(s->scb, strm_tevt_type_intercepted);
|
||||||
goto return_prx_err;
|
goto return_prx_err;
|
||||||
|
|
||||||
return_fail_rewrite:
|
return_fail_rewrite:
|
||||||
@ -1999,6 +2006,7 @@ int http_process_res_common(struct stream *s, struct channel *rep, int an_bit, s
|
|||||||
_HA_ATOMIC_INC(&sess->listener->counters->internal_errors);
|
_HA_ATOMIC_INC(&sess->listener->counters->internal_errors);
|
||||||
if (objt_server(s->target))
|
if (objt_server(s->target))
|
||||||
_HA_ATOMIC_INC(&__objt_server(s->target)->counters.internal_errors);
|
_HA_ATOMIC_INC(&__objt_server(s->target)->counters.internal_errors);
|
||||||
|
stream_report_term_evt(s->scb, strm_tevt_type_internal_err);
|
||||||
goto return_prx_err;
|
goto return_prx_err;
|
||||||
|
|
||||||
return_bad_res:
|
return_bad_res:
|
||||||
@ -2010,6 +2018,7 @@ int http_process_res_common(struct stream *s, struct channel *rep, int an_bit, s
|
|||||||
_HA_ATOMIC_INC(&__objt_server(s->target)->counters.failed_resp);
|
_HA_ATOMIC_INC(&__objt_server(s->target)->counters.failed_resp);
|
||||||
health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_RSP);
|
health_adjust(__objt_server(s->target), HANA_STATUS_HTTP_RSP);
|
||||||
}
|
}
|
||||||
|
stream_report_term_evt(s->scb, strm_tevt_type_proto_err);
|
||||||
/* fall through */
|
/* fall through */
|
||||||
|
|
||||||
return_prx_err:
|
return_prx_err:
|
||||||
@ -2019,9 +2028,6 @@ int http_process_res_common(struct stream *s, struct channel *rep, int an_bit, s
|
|||||||
|
|
||||||
return_prx_cond:
|
return_prx_cond:
|
||||||
s->scb->flags |= SC_FL_NOLINGER;
|
s->scb->flags |= SC_FL_NOLINGER;
|
||||||
|
|
||||||
// XXX: All errors are handled as intercepted here !
|
|
||||||
stream_report_term_evt(s->scb, tevt_loc_strm, tevt_type_intercepted);
|
|
||||||
http_set_term_flags(s);
|
http_set_term_flags(s);
|
||||||
|
|
||||||
rep->analysers &= AN_RES_FLT_END;
|
rep->analysers &= AN_RES_FLT_END;
|
||||||
@ -2264,7 +2270,7 @@ int http_response_forward_body(struct stream *s, struct channel *res, int an_bit
|
|||||||
|
|
||||||
return_int_err:
|
return_int_err:
|
||||||
// XXX: All errors are handled as intercepted here !
|
// XXX: All errors are handled as intercepted here !
|
||||||
stream_report_term_evt(s->scb, tevt_loc_strm, tevt_type_intercepted);
|
stream_report_term_evt(s->scb, strm_tevt_type_intercepted);
|
||||||
_HA_ATOMIC_INC(&sess->fe->fe_counters.internal_errors);
|
_HA_ATOMIC_INC(&sess->fe->fe_counters.internal_errors);
|
||||||
_HA_ATOMIC_INC(&s->be->be_counters.internal_errors);
|
_HA_ATOMIC_INC(&s->be->be_counters.internal_errors);
|
||||||
if (sess->listener && sess->listener->counters)
|
if (sess->listener && sess->listener->counters)
|
||||||
@ -2274,11 +2280,12 @@ int http_response_forward_body(struct stream *s, struct channel *res, int an_bit
|
|||||||
if (!(s->flags & SF_ERR_MASK))
|
if (!(s->flags & SF_ERR_MASK))
|
||||||
s->flags |= SF_ERR_INTERNAL;
|
s->flags |= SF_ERR_INTERNAL;
|
||||||
COUNT_IF(1, "Internal error during response forwarding");
|
COUNT_IF(1, "Internal error during response forwarding");
|
||||||
|
stream_report_term_evt(s->scb, strm_tevt_type_internal_err);
|
||||||
goto return_error;
|
goto return_error;
|
||||||
|
|
||||||
return_bad_res:
|
return_bad_res:
|
||||||
// XXX: All errors are handled as intercepted here !
|
// XXX: All errors are handled as intercepted here !
|
||||||
stream_report_term_evt(s->scb, tevt_loc_strm, tevt_type_intercepted);
|
stream_report_term_evt(s->scb, strm_tevt_type_intercepted);
|
||||||
_HA_ATOMIC_INC(&s->be->be_counters.failed_resp);
|
_HA_ATOMIC_INC(&s->be->be_counters.failed_resp);
|
||||||
if (objt_server(s->target)) {
|
if (objt_server(s->target)) {
|
||||||
_HA_ATOMIC_INC(&__objt_server(s->target)->counters.failed_resp);
|
_HA_ATOMIC_INC(&__objt_server(s->target)->counters.failed_resp);
|
||||||
@ -2286,6 +2293,7 @@ int http_response_forward_body(struct stream *s, struct channel *res, int an_bit
|
|||||||
}
|
}
|
||||||
stream_inc_http_fail_ctr(s);
|
stream_inc_http_fail_ctr(s);
|
||||||
COUNT_IF(1, "Response parsing error during response forwarding");
|
COUNT_IF(1, "Response parsing error during response forwarding");
|
||||||
|
stream_report_term_evt(s->scb, strm_tevt_type_proto_err);
|
||||||
/* fall through */
|
/* fall through */
|
||||||
|
|
||||||
return_error:
|
return_error:
|
||||||
|
10
src/stconn.c
10
src/stconn.c
@ -785,7 +785,7 @@ static void sc_app_shut_conn(struct stconn *sc)
|
|||||||
sc->flags |= SC_FL_SHUT_DONE;
|
sc->flags |= SC_FL_SHUT_DONE;
|
||||||
oc->flags |= CF_WRITE_EVENT;
|
oc->flags |= CF_WRITE_EVENT;
|
||||||
sc_set_hcto(sc);
|
sc_set_hcto(sc);
|
||||||
sc_report_term_evt(sedesc->sc, tevt_loc_strm, tevt_type_shutw);
|
sc_report_term_evt(sc, strm_tevt_type_shutw);
|
||||||
|
|
||||||
switch (sc->state) {
|
switch (sc->state) {
|
||||||
case SC_ST_RDY:
|
case SC_ST_RDY:
|
||||||
@ -1238,7 +1238,7 @@ static void sc_conn_eos(struct stconn *sc)
|
|||||||
sc->flags |= SC_FL_EOS;
|
sc->flags |= SC_FL_EOS;
|
||||||
ic->flags |= CF_READ_EVENT;
|
ic->flags |= CF_READ_EVENT;
|
||||||
sc_ep_report_read_activity(sc);
|
sc_ep_report_read_activity(sc);
|
||||||
sc_report_term_evt(sc, tevt_loc_strm, (sc->flags & SC_FL_EOI ? tevt_type_shutr: tevt_type_truncated_shutr));
|
sc_report_term_evt(sc, (sc->flags & SC_FL_EOI ? strm_tevt_type_eos: strm_tevt_type_truncated_eos));
|
||||||
if (sc->state != SC_ST_EST)
|
if (sc->state != SC_ST_EST)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1526,7 +1526,7 @@ int sc_conn_recv(struct stconn *sc)
|
|||||||
if (sc_ep_test(sc, SE_FL_ERROR)) {
|
if (sc_ep_test(sc, SE_FL_ERROR)) {
|
||||||
sc->flags |= SC_FL_ERROR;
|
sc->flags |= SC_FL_ERROR;
|
||||||
if (!(sc->flags & SC_FL_EOS))
|
if (!(sc->flags & SC_FL_EOS))
|
||||||
sc_report_term_evt(sc, tevt_loc_strm, (sc->flags & SC_FL_EOI ? tevt_type_rcv_err: tevt_type_truncated_rcv_err));
|
sc_report_term_evt(sc, (sc->flags & SC_FL_EOI ? strm_tevt_type_rcv_err: strm_tevt_type_truncated_rcv_err));
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1752,7 +1752,7 @@ int sc_conn_send(struct stconn *sc)
|
|||||||
if (sc_ep_test(sc, SE_FL_ERROR | SE_FL_ERR_PENDING)) {
|
if (sc_ep_test(sc, SE_FL_ERROR | SE_FL_ERR_PENDING)) {
|
||||||
oc->flags |= CF_WRITE_EVENT;
|
oc->flags |= CF_WRITE_EVENT;
|
||||||
BUG_ON(sc_ep_test(sc, SE_FL_EOS|SE_FL_ERROR|SE_FL_ERR_PENDING) == (SE_FL_EOS|SE_FL_ERR_PENDING));
|
BUG_ON(sc_ep_test(sc, SE_FL_EOS|SE_FL_ERROR|SE_FL_ERR_PENDING) == (SE_FL_EOS|SE_FL_ERR_PENDING));
|
||||||
sc_report_term_evt(sc, tevt_loc_strm, tevt_type_snd_err);
|
sc_report_term_evt(sc, strm_tevt_type_snd_err);
|
||||||
if (sc_ep_test(sc, SE_FL_ERROR))
|
if (sc_ep_test(sc, SE_FL_ERROR))
|
||||||
sc->flags |= SC_FL_ERROR;
|
sc->flags |= SC_FL_ERROR;
|
||||||
return 1;
|
return 1;
|
||||||
@ -1893,7 +1893,7 @@ int sc_conn_process(struct stconn *sc)
|
|||||||
|
|
||||||
if (sc_ep_test(sc, SE_FL_ERROR) && !(sc->flags & SC_FL_ERROR)) {
|
if (sc_ep_test(sc, SE_FL_ERROR) && !(sc->flags & SC_FL_ERROR)) {
|
||||||
if (!(sc->flags & SC_FL_EOS))
|
if (!(sc->flags & SC_FL_EOS))
|
||||||
sc_report_term_evt(sc, tevt_loc_strm, (sc->flags & SC_FL_EOI ? tevt_type_rcv_err: tevt_type_truncated_rcv_err));
|
sc_report_term_evt(sc, (sc->flags & SC_FL_EOI ? strm_tevt_type_rcv_err: strm_tevt_type_truncated_rcv_err));
|
||||||
sc->flags |= SC_FL_ERROR;
|
sc->flags |= SC_FL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1576,25 +1576,25 @@ static void stream_handle_timeouts(struct stream *s)
|
|||||||
channel_check_timeout(&s->res);
|
channel_check_timeout(&s->res);
|
||||||
|
|
||||||
if (unlikely(!(s->scb->flags & SC_FL_SHUT_DONE) && (s->req.flags & CF_WRITE_TIMEOUT))) {
|
if (unlikely(!(s->scb->flags & SC_FL_SHUT_DONE) && (s->req.flags & CF_WRITE_TIMEOUT))) {
|
||||||
stream_report_term_evt(s->scb, tevt_loc_strm, tevt_type_tout);
|
stream_report_term_evt(s->scb, strm_tevt_type_tout);
|
||||||
s->scb->flags |= SC_FL_NOLINGER;
|
s->scb->flags |= SC_FL_NOLINGER;
|
||||||
sc_shutdown(s->scb);
|
sc_shutdown(s->scb);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unlikely(!(s->scf->flags & (SC_FL_EOS|SC_FL_ABRT_DONE)) && (s->req.flags & CF_READ_TIMEOUT))) {
|
if (unlikely(!(s->scf->flags & (SC_FL_EOS|SC_FL_ABRT_DONE)) && (s->req.flags & CF_READ_TIMEOUT))) {
|
||||||
stream_report_term_evt(s->scf, tevt_loc_strm, tevt_type_tout);
|
stream_report_term_evt(s->scf, strm_tevt_type_tout);
|
||||||
if (s->scf->flags & SC_FL_NOHALF)
|
if (s->scf->flags & SC_FL_NOHALF)
|
||||||
s->scf->flags |= SC_FL_NOLINGER;
|
s->scf->flags |= SC_FL_NOLINGER;
|
||||||
sc_abort(s->scf);
|
sc_abort(s->scf);
|
||||||
}
|
}
|
||||||
if (unlikely(!(s->scf->flags & SC_FL_SHUT_DONE) && (s->res.flags & CF_WRITE_TIMEOUT))) {
|
if (unlikely(!(s->scf->flags & SC_FL_SHUT_DONE) && (s->res.flags & CF_WRITE_TIMEOUT))) {
|
||||||
stream_report_term_evt(s->scf, tevt_loc_strm, tevt_type_tout);
|
stream_report_term_evt(s->scf, strm_tevt_type_tout);
|
||||||
s->scf->flags |= SC_FL_NOLINGER;
|
s->scf->flags |= SC_FL_NOLINGER;
|
||||||
sc_shutdown(s->scf);
|
sc_shutdown(s->scf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unlikely(!(s->scb->flags & (SC_FL_EOS|SC_FL_ABRT_DONE)) && (s->res.flags & CF_READ_TIMEOUT))) {
|
if (unlikely(!(s->scb->flags & (SC_FL_EOS|SC_FL_ABRT_DONE)) && (s->res.flags & CF_READ_TIMEOUT))) {
|
||||||
stream_report_term_evt(s->scb, tevt_loc_strm, tevt_type_tout);
|
stream_report_term_evt(s->scb, strm_tevt_type_tout);
|
||||||
if (s->scb->flags & SC_FL_NOHALF)
|
if (s->scb->flags & SC_FL_NOHALF)
|
||||||
s->scb->flags |= SC_FL_NOLINGER;
|
s->scb->flags |= SC_FL_NOLINGER;
|
||||||
sc_abort(s->scb);
|
sc_abort(s->scb);
|
||||||
|
@ -193,6 +193,7 @@ int tcp_inspect_request(struct stream *s, struct channel *req, int an_bit)
|
|||||||
s->last_entity.ptr = rule;
|
s->last_entity.ptr = rule;
|
||||||
goto deny;
|
goto deny;
|
||||||
case ACT_RET_ABRT:
|
case ACT_RET_ABRT:
|
||||||
|
stream_report_term_evt(s->scf, strm_tevt_type_intercepted);
|
||||||
s->last_entity.type = STRM_ENTITY_RULE;
|
s->last_entity.type = STRM_ENTITY_RULE;
|
||||||
s->last_entity.ptr = rule;
|
s->last_entity.ptr = rule;
|
||||||
goto abort;
|
goto abort;
|
||||||
@ -249,6 +250,7 @@ int tcp_inspect_request(struct stream *s, struct channel *req, int an_bit)
|
|||||||
_HA_ATOMIC_INC(&sess->fe->fe_counters.denied_req);
|
_HA_ATOMIC_INC(&sess->fe->fe_counters.denied_req);
|
||||||
if (sess->listener && sess->listener->counters)
|
if (sess->listener && sess->listener->counters)
|
||||||
_HA_ATOMIC_INC(&sess->listener->counters->denied_req);
|
_HA_ATOMIC_INC(&sess->listener->counters->denied_req);
|
||||||
|
stream_report_term_evt(s->scf, strm_tevt_type_intercepted);
|
||||||
goto reject;
|
goto reject;
|
||||||
|
|
||||||
internal:
|
internal:
|
||||||
@ -257,12 +259,14 @@ int tcp_inspect_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);
|
||||||
if (!(s->flags & SF_ERR_MASK))
|
if (!(s->flags & SF_ERR_MASK))
|
||||||
s->flags |= SF_ERR_INTERNAL;
|
s->flags |= SF_ERR_INTERNAL;
|
||||||
|
stream_report_term_evt(s->scf, strm_tevt_type_internal_err);
|
||||||
goto reject;
|
goto reject;
|
||||||
|
|
||||||
invalid:
|
invalid:
|
||||||
_HA_ATOMIC_INC(&sess->fe->fe_counters.failed_req);
|
_HA_ATOMIC_INC(&sess->fe->fe_counters.failed_req);
|
||||||
if (sess->listener && sess->listener->counters)
|
if (sess->listener && sess->listener->counters)
|
||||||
_HA_ATOMIC_INC(&sess->listener->counters->failed_req);
|
_HA_ATOMIC_INC(&sess->listener->counters->failed_req);
|
||||||
|
stream_report_term_evt(s->scf, strm_tevt_type_proto_err);
|
||||||
|
|
||||||
reject:
|
reject:
|
||||||
sc_must_kill_conn(s->scf);
|
sc_must_kill_conn(s->scf);
|
||||||
@ -270,7 +274,6 @@ int tcp_inspect_request(struct stream *s, struct channel *req, int an_bit)
|
|||||||
|
|
||||||
abort:
|
abort:
|
||||||
// XXX: All errors are handled as intercepted here !
|
// XXX: All errors are handled as intercepted here !
|
||||||
stream_report_term_evt(s->scf, tevt_loc_strm, tevt_type_intercepted);
|
|
||||||
req->analysers &= AN_REQ_FLT_END;
|
req->analysers &= AN_REQ_FLT_END;
|
||||||
s->current_rule = s->current_rule_list = NULL;
|
s->current_rule = s->current_rule_list = NULL;
|
||||||
req->analyse_exp = s->rules_exp = TICK_ETERNITY;
|
req->analyse_exp = s->rules_exp = TICK_ETERNITY;
|
||||||
@ -387,6 +390,7 @@ int tcp_inspect_response(struct stream *s, struct channel *rep, int an_bit)
|
|||||||
s->last_entity.ptr = rule;
|
s->last_entity.ptr = rule;
|
||||||
goto deny;
|
goto deny;
|
||||||
case ACT_RET_ABRT:
|
case ACT_RET_ABRT:
|
||||||
|
stream_report_term_evt(s->scb, strm_tevt_type_intercepted);
|
||||||
s->last_entity.type = STRM_ENTITY_RULE;
|
s->last_entity.type = STRM_ENTITY_RULE;
|
||||||
s->last_entity.ptr = rule;
|
s->last_entity.ptr = rule;
|
||||||
goto abort;
|
goto abort;
|
||||||
@ -454,6 +458,7 @@ int tcp_inspect_response(struct stream *s, struct channel *rep, int an_bit)
|
|||||||
_HA_ATOMIC_INC(&s->sess->listener->counters->denied_resp);
|
_HA_ATOMIC_INC(&s->sess->listener->counters->denied_resp);
|
||||||
if (objt_server(s->target))
|
if (objt_server(s->target))
|
||||||
_HA_ATOMIC_INC(&__objt_server(s->target)->counters.denied_resp);
|
_HA_ATOMIC_INC(&__objt_server(s->target)->counters.denied_resp);
|
||||||
|
stream_report_term_evt(s->scb, strm_tevt_type_intercepted);
|
||||||
goto reject;
|
goto reject;
|
||||||
|
|
||||||
internal:
|
internal:
|
||||||
@ -465,20 +470,20 @@ int tcp_inspect_response(struct stream *s, struct channel *rep, int an_bit)
|
|||||||
_HA_ATOMIC_INC(&__objt_server(s->target)->counters.internal_errors);
|
_HA_ATOMIC_INC(&__objt_server(s->target)->counters.internal_errors);
|
||||||
if (!(s->flags & SF_ERR_MASK))
|
if (!(s->flags & SF_ERR_MASK))
|
||||||
s->flags |= SF_ERR_INTERNAL;
|
s->flags |= SF_ERR_INTERNAL;
|
||||||
|
stream_report_term_evt(s->scf, strm_tevt_type_internal_err);
|
||||||
goto reject;
|
goto reject;
|
||||||
|
|
||||||
invalid:
|
invalid:
|
||||||
_HA_ATOMIC_INC(&s->be->be_counters.failed_resp);
|
_HA_ATOMIC_INC(&s->be->be_counters.failed_resp);
|
||||||
if (objt_server(s->target))
|
if (objt_server(s->target))
|
||||||
_HA_ATOMIC_INC(&__objt_server(s->target)->counters.failed_resp);
|
_HA_ATOMIC_INC(&__objt_server(s->target)->counters.failed_resp);
|
||||||
|
stream_report_term_evt(s->scf, strm_tevt_type_proto_err);
|
||||||
|
|
||||||
reject:
|
reject:
|
||||||
sc_must_kill_conn(s->scb);
|
sc_must_kill_conn(s->scb);
|
||||||
stream_abort(s);
|
stream_abort(s);
|
||||||
|
|
||||||
abort:
|
abort:
|
||||||
// XXX: All errors are handled as intercepted here !
|
|
||||||
stream_report_term_evt(s->scb, tevt_loc_strm, tevt_type_intercepted);
|
|
||||||
rep->analysers &= AN_RES_FLT_END;
|
rep->analysers &= AN_RES_FLT_END;
|
||||||
s->current_rule = s->current_rule_list = NULL;
|
s->current_rule = s->current_rule_list = NULL;
|
||||||
rep->analyse_exp = s->rules_exp = TICK_ETERNITY;
|
rep->analyse_exp = s->rules_exp = TICK_ETERNITY;
|
||||||
|
Loading…
Reference in New Issue
Block a user