]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/AccessLogEntry.cc
2 * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
10 #include "AccessLogEntry.h"
11 #include "HttpReply.h"
12 #include "HttpRequest.h"
13 #include "SquidConfig.h"
16 #include "ssl/support.h"
18 AccessLogEntry::SslDetails::SslDetails(): user(NULL
), bumpMode(::Ssl::bumpEnd
)
21 #endif /* USE_OPENSSL */
24 AccessLogEntry::getLogClientIp(char *buf
, size_t bufsz
) const
28 #if FOLLOW_X_FORWARDED_FOR
29 if (Config
.onoff
.log_uses_indirect_client
&& request
)
30 log_ip
= request
->indirect_client_addr
;
33 if (tcpClient
!= NULL
)
34 log_ip
= tcpClient
->remote
;
35 else if (cache
.caddr
.isNoAddr()) { // e.g., ICAP OPTIONS lack client
36 strncpy(buf
, "-", bufsz
);
41 // Apply so-called 'privacy masking' to IPv4 clients
42 // - localhost IP is always shown in full
43 // - IPv4 clients masked with client_netmask
44 // - IPv6 clients use 'privacy addressing' instead.
46 if (!log_ip
.isLocalhost() && log_ip
.isIPv4())
47 log_ip
.applyMask(Config
.Addrs
.client_netmask
);
49 log_ip
.toStr(buf
, bufsz
);
53 AccessLogEntry::getLogMethod() const
57 method
.append(icp_opcode_str
[icp
.opcode
]);
59 method
.append(htcp
.opcode
);
61 method
= http
.method
.image();
65 AccessLogEntry::~AccessLogEntry()
67 safe_free(headers
.request
);
70 safe_free(adapt
.last_meta
);
73 safe_free(headers
.reply
);
75 safe_free(headers
.adapted_request
);
76 HTTPMSGUNLOCK(adapted_request
);
78 safe_free(lastAclName
);
79 safe_free(lastAclData
);
82 HTTPMSGUNLOCK(request
);
84 HTTPMSGUNLOCK(icap
.reply
);
85 HTTPMSGUNLOCK(icap
.request
);