MINOR: session: Add functions to increase http values of tracked counters

cumulative numbers of http request and http errors of counters tracked at
the session level and their rates can now be updated at the session level
thanks to two new functions. These functions are not used for now, but it
will be called to keep tracked counters up-to-date if an error occurs before
the stream creation.
This commit is contained in:
Christopher Faulet 2020-10-06 14:23:34 +02:00
parent 84600631cd
commit 7d0c19e82d

View File

@ -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)
{