2 * Copyright (C) 1996-2021 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 "anyp/PortCfg.h"
13 #include "security/PeerOptions.h"
15 #include "ssl/support.h"
21 AnyP::PortCfgPointer HttpPortList
;
22 AnyP::PortCfgPointer FtpPortList
;
25 int HttpSockets
[MAXTCPLISTENPORTS
];
27 AnyP::PortCfg::PortCfg() :
30 transport(AnyP::PROTO_HTTP
,1,1), // "Squid is an HTTP proxy", etc.
38 connection_auth_disabled(false),
39 ftp_track_dirs(false),
41 disable_pmtu_discovery(0),
45 memset(&tcp_keepalive
, 0, sizeof(tcp_keepalive
));
48 AnyP::PortCfg::~PortCfg()
50 if (Comm::IsConnOpen(listenConn
)) {
56 safe_free(defaultsite
);
60 AnyP::PortCfg::clone() const
62 AnyP::PortCfgPointer b
= new AnyP::PortCfg();
65 b
->name
= xstrdup(name
);
67 b
->defaultsite
= xstrdup(defaultsite
);
69 b
->transport
= transport
;
71 b
->allow_direct
= allow_direct
;
74 b
->connection_auth_disabled
= connection_auth_disabled
;
75 b
->workerQueues
= workerQueues
;
76 b
->ftp_track_dirs
= ftp_track_dirs
;
77 b
->disable_pmtu_discovery
= disable_pmtu_discovery
;
78 b
->tcp_keepalive
= tcp_keepalive
;
85 AnyP::PortCfg::codeContextGist() const
87 // Unfortunately, .name lifetime is too short in FTP use cases.
88 // TODO: Consider adding InstanceId<uint32_t> to all RefCountable classes.
89 return ScopedId("port");
93 AnyP::PortCfg::detailCodeContext(std::ostream
&os
) const
95 // parsePortSpecification() defaults optional port name to the required
96 // listening address so we cannot easily distinguish one from the other.
98 os
<< Debug::Extra
<< "listening port: " << name
;
100 os
<< Debug::Extra
<< "listening port address: " << s
;