diff --git a/include/haproxy/session.h b/include/haproxy/session.h index fa21dda6c..205bd82ac 100644 --- a/include/haproxy/session.h +++ b/include/haproxy/session.h @@ -73,6 +73,30 @@ static inline void session_store_counters(struct session *sess) } } +/* Increase the number of cumulated HTTP requests in the tracked counters */ +static inline void session_inc_http_req_ctr(struct session *sess) +{ + int i; + + for (i = 0; i < MAX_SESS_STKCTR; i++) + stkctr_inc_http_req_ctr(&sess->stkctr[i]); +} + +/* Increase the number of cumulated failed HTTP requests in the tracked + * counters. Only 4xx requests should be counted here so that we can + * distinguish between errors caused by client behaviour and other ones. + * Note that even 404 are interesting because they're generally caused by + * vulnerability scans. + */ +static inline void session_inc_http_err_ctr(struct session *sess) +{ + int i; + + for (i = 0; i < MAX_SESS_STKCTR; i++) + stkctr_inc_http_err_ctr(&sess->stkctr[i]); +} + + /* Remove the connection from the session list, and destroy the srv_list if it's now empty */ static inline void session_unown_conn(struct session *sess, struct connection *conn) {