#if ICAP_CLIENT
#include "adaptation/icap/Elements.h"
#endif
+#include "ProtoPort.h"
/* forward decls */
class HttpReply;
const char *ssluser;
#endif
+ http_port_list *port;
} cache;
>la Local IP address the client connected to
>lp Local port number the client connected to
+ la Local listening IP address the client connection was connected to.
+ lp Local listening port number the client connection was connected to.
+
<a Server IP address of the last server or peer connection
<A Server FQDN or peer name
<p Server port number of the last server or peer connection
al.cache.caddr.SetNoAddr();
- if (getConn() != NULL) al.cache.caddr = getConn()->log_addr;
+ if (getConn() != NULL) {
+ al.cache.caddr = getConn()->log_addr;
+ al.cache.port = cbdataReference(getConn()->port);
+ }
al.cache.requestSize = req_sz;
al.cache.requestHeadersSize = req_sz;
}
break;
- case LFT_CLIENT_LOCAL_IP_OLD_31:
+ case LFT_LOCAL_LISTENING_IP: {
+ // avoid logging a dash if we have reliable info
+ const bool interceptedAtKnownPort = (al->request->flags.spoof_client_ip ||
+ al->request->flags.intercepted) && al->cache.port;
+ if (interceptedAtKnownPort) {
+ const bool portAddressConfigured = !al->cache.port->s.IsAnyAddr();
+ if (portAddressConfigured)
+ out = al->cache.port->s.NtoA(tmp, sizeof(tmp));
+ } else if (al->tcpClient != NULL)
+ out = al->tcpClient->local.NtoA(tmp, sizeof(tmp));
+ }
+ break;
+
case LFT_CLIENT_LOCAL_IP:
if (al->tcpClient != NULL) {
out = al->tcpClient->local.NtoA(tmp,sizeof(tmp));
}
break;
- case LFT_CLIENT_LOCAL_PORT_OLD_31:
+ case LFT_LOCAL_LISTENING_PORT:
+ if (al->cache.port) {
+ outint = al->cache.port->s.GetPort();
+ doint = 1;
+ }
+ break;
+
case LFT_CLIENT_LOCAL_PORT:
if (al->tcpClient != NULL) {
outint = al->tcpClient->local.GetPort();
static struct TokenTableEntry TokenTable2C[] = {
{">la", LFT_CLIENT_LOCAL_IP},
- {"la", LFT_CLIENT_LOCAL_IP_OLD_31},
+ {"la", LFT_LOCAL_LISTENING_IP},
{">lp", LFT_CLIENT_LOCAL_PORT},
- {"lp", LFT_CLIENT_LOCAL_PORT_OLD_31},
+ {"lp", LFT_LOCAL_LISTENING_PORT},
/*{ "lA", LFT_LOCAL_NAME }, */
{"<la", LFT_SERVER_LOCAL_IP},
type = LFT_HTTP_SENT_STATUS_CODE;
break;
- case LFT_CLIENT_LOCAL_IP_OLD_31:
- debugs(46, 0, "WARNING: The \"la\" formatting code is deprecated. Use the \">la\" instead.");
- type = LFT_CLIENT_LOCAL_IP;
- break;
-
- case LFT_CLIENT_LOCAL_PORT_OLD_31:
- debugs(46, 0, "WARNING: The \"lp\" formatting code is deprecated. Use the \">lp\" instead.");
- type = LFT_CLIENT_LOCAL_PORT;
- break;
-
case LFT_SERVER_LOCAL_IP_OLD_27:
debugs(46, 0, "WARNING: The \"oa\" formatting code is deprecated. Use the \"<la\" instead.");
type = LFT_SERVER_LOCAL_IP;
LFT_SERVER_PORT,
LFT_CLIENT_LOCAL_IP,
- LFT_CLIENT_LOCAL_IP_OLD_31,
+ LFT_LOCAL_LISTENING_IP,
LFT_CLIENT_LOCAL_PORT,
- LFT_CLIENT_LOCAL_PORT_OLD_31,
+ LFT_LOCAL_LISTENING_PORT,
/*LFT_LOCAL_NAME, */
LFT_SERVER_LOCAL_IP,
HTTPMSGUNLOCK(aLogEntry->icap.reply);
HTTPMSGUNLOCK(aLogEntry->icap.request);
#endif
+ cbdataReferenceDone(aLogEntry->cache.port);
}
int