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