]> git.ipfire.org Git - thirdparty/squid.git/blob - src/AccessLogEntry.cc
sourceformat: split protos.h into more specific headers, change many functions' likag...
[thirdparty/squid.git] / src / AccessLogEntry.cc
1 #include "squid.h"
2 #include "AccessLogEntry.h"
3 #include "HttpReply.h"
4 #include "HttpRequest.h"
5 #include "SquidConfig.h"
6 #include "ssl/support.h"
7
8 #if USE_SSL
9 AccessLogEntry::SslDetails::SslDetails(): user(NULL), bumpMode(::Ssl::bumpEnd)
10 {
11 }
12 #endif /* USE_SSL */
13
14 void
15 AccessLogEntry::getLogClientIp(char *buf, size_t bufsz) const
16 {
17 #if FOLLOW_X_FORWARDED_FOR
18 if (Config.onoff.log_uses_indirect_client && request)
19 request->indirect_client_addr.NtoA(buf, bufsz);
20 else
21 #endif
22 if (tcpClient != NULL)
23 tcpClient->remote.NtoA(buf, bufsz);
24 else if (cache.caddr.IsNoAddr()) // e.g., ICAP OPTIONS lack client
25 strncpy(buf, "-", 1);
26 else
27 cache.caddr.NtoA(buf, bufsz);
28 }
29
30 AccessLogEntry::~AccessLogEntry()
31 {
32 safe_free(headers.request);
33
34 #if ICAP_CLIENT
35 safe_free(adapt.last_meta);
36 #endif
37
38 safe_free(headers.reply);
39 safe_free(cache.authuser);
40
41 safe_free(headers.adapted_request);
42 HTTPMSGUNLOCK(adapted_request);
43
44 HTTPMSGUNLOCK(reply);
45 HTTPMSGUNLOCK(request);
46 #if ICAP_CLIENT
47 HTTPMSGUNLOCK(icap.reply);
48 HTTPMSGUNLOCK(icap.request);
49 #endif
50 cbdataReferenceDone(cache.port);
51 }