long long bytes_in; /* number of bytes transferred from the client to the server */
long long bytes_out; /* number of bytes transferred from the server to the client */
} logs;
+ void (*do_log)(struct session *s); /* the function to call in order to log */
short int data_source; /* where to get the data we generate ourselves */
short int data_state; /* where to get the data we generate ourselves */
union {
else
s->logs.logwait = p->to_log;
+ if (s->logs.logwait & LW_REQ)
+ s->do_log = http_sess_log;
+ else
+ s->do_log = tcp_sess_log;
+
s->logs.accept_date = date; /* user-visible date for logging */
s->logs.tv_accept = now; /* corrected date for internal use */
tv_zero(&s->logs.tv_request);
/* we have the client ip */
if (s->logs.logwait & LW_CLIP)
if (!(s->logs.logwait &= ~LW_CLIP))
- tcp_sess_log(s);
+ s->do_log(s);
}
else if (s->cli_addr.ss_family == AF_INET) {
char pn[INET_ADDRSTRLEN], sn[INET_ADDRSTRLEN];
client_retnclose(t, &http_200_chunk);
goto return_prx_cond;
}
-
+
/*
* 3: Maybe we have to copy the original REQURI for the logs ?
* Note: we cannot log anymore if the request has been
txn->uri[urilen] = 0;
if (!(t->logs.logwait &= ~LW_REQ))
- http_sess_log(t);
+ t->do_log(t);
} else {
Alert("HTTP logging : out of memory.\n");
}
if (t->fe->to_log && !(t->logs.logwait & LW_BYTES)) {
t->logs.t_close = t->logs.t_data; /* to get a valid end date */
t->logs.bytes_out = txn->rsp.eoh;
- if (t->fe->to_log & LW_REQ)
- http_sess_log(t);
- else
- tcp_sess_log(t);
+ t->do_log(t);
t->logs.bytes_out = 0;
}
* bytes from the server, then this is the right moment. */
if (s->fe->to_log && !(s->logs.logwait & LW_BYTES)) {
s->logs.t_close = s->logs.t_connect; /* to get a valid end date */
- tcp_sess_log(s);
+ s->do_log(s);
}
#ifdef CONFIG_HAP_TCPSPLICE
if ((s->fe->options & s->be->options) & PR_O_TCPSPLICE) {
if (s->logs.logwait &&
!(s->flags & SN_MONITOR) &&
(!(s->fe->options & PR_O_NULLNOLOG) || s->req->total)) {
- if (s->fe->to_log & LW_REQ)
- http_sess_log(s);
- else
- tcp_sess_log(s);
+ s->do_log(s);
}
/* the task MUST not be in the run queue anymore */