]> git.ipfire.org Git - thirdparty/squid.git/blob - src/AccessLogEntry.cc
Merged changes since Apr 2013 review
[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
7 #if USE_SSL
8 #include "ssl/support.h"
9
10 AccessLogEntry::SslDetails::SslDetails(): user(NULL), bumpMode(::Ssl::bumpEnd)
11 {
12 }
13 #endif /* USE_SSL */
14
15 void
16 AccessLogEntry::getLogClientIp(char *buf, size_t bufsz) const
17 {
18 #if FOLLOW_X_FORWARDED_FOR
19 if (Config.onoff.log_uses_indirect_client && request)
20 request->indirect_client_addr.toStr(buf, bufsz);
21 else
22 #endif
23 if (tcpClient != NULL)
24 tcpClient->remote.toStr(buf, bufsz);
25 else if (cache.caddr.isNoAddr()) // e.g., ICAP OPTIONS lack client
26 strncpy(buf, "-", bufsz);
27 else
28 cache.caddr.toStr(buf, bufsz);
29 }
30
31 AccessLogEntry::~AccessLogEntry()
32 {
33 safe_free(headers.request);
34
35 #if USE_ADAPTATION
36 safe_free(adapt.last_meta);
37 #endif
38
39 safe_free(headers.reply);
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 }