]> git.ipfire.org Git - thirdparty/squid.git/blame - src/AccessLogEntry.cc
SourceFormat Enforcement
[thirdparty/squid.git] / src / AccessLogEntry.cc
CommitLineData
f7f3304a 1#include "squid.h"
d4204018 2#include "AccessLogEntry.h"
582c2af2 3#include "HttpReply.h"
d4204018 4#include "HttpRequest.h"
08097970
AR
5#include "ssl/support.h"
6
dc544ce5 7#if USE_SSL
71cae389 8AccessLogEntry::SslDetails::SslDetails(): user(NULL), bumpMode(::Ssl::bumpEnd)
08097970
AR
9{
10}
dc544ce5 11#endif /* USE_SSL */
08097970 12
d4204018
AJ
13void
14AccessLogEntry::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}
41ebd397
CT
28
29AccessLogEntry::~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}