]> git.ipfire.org Git - thirdparty/squid.git/blob - src/anyp/PortCfg.cc
Docs: Copyright updates for 2018 (#114)
[thirdparty/squid.git] / src / anyp / PortCfg.cc
1 /*
2 * Copyright (C) 1996-2018 The Squid Software Foundation and contributors
3 *
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.
7 */
8
9 #include "squid.h"
10 #include "anyp/PortCfg.h"
11 #include "comm.h"
12 #include "fatal.h"
13 #include "security/PeerOptions.h"
14 #if USE_OPENSSL
15 #include "ssl/support.h"
16 #endif
17
18 #include <cstring>
19 #include <limits>
20
21 AnyP::PortCfgPointer HttpPortList;
22 AnyP::PortCfgPointer FtpPortList;
23
24 int NHttpSockets = 0;
25 int HttpSockets[MAXTCPLISTENPORTS];
26
27 AnyP::PortCfg::PortCfg() :
28 next(),
29 s(),
30 transport(AnyP::PROTO_HTTP,1,1), // "Squid is an HTTP proxy", etc.
31 name(NULL),
32 defaultsite(NULL),
33 flags(),
34 allow_direct(false),
35 vhost(false),
36 actAsOrigin(false),
37 ignore_cc(false),
38 connection_auth_disabled(false),
39 ftp_track_dirs(false),
40 vport(0),
41 disable_pmtu_discovery(0),
42 listenConn()
43 {
44 memset(&tcp_keepalive, 0, sizeof(tcp_keepalive));
45 }
46
47 AnyP::PortCfg::~PortCfg()
48 {
49 if (Comm::IsConnOpen(listenConn)) {
50 listenConn->close();
51 listenConn = NULL;
52 }
53
54 safe_free(name);
55 safe_free(defaultsite);
56 }
57
58 AnyP::PortCfgPointer
59 AnyP::PortCfg::clone() const
60 {
61 AnyP::PortCfgPointer b = new AnyP::PortCfg();
62 b->s = s;
63 if (name)
64 b->name = xstrdup(name);
65 if (defaultsite)
66 b->defaultsite = xstrdup(defaultsite);
67
68 b->transport = transport;
69 b->flags = flags;
70 b->allow_direct = allow_direct;
71 b->vhost = vhost;
72 b->vport = vport;
73 b->connection_auth_disabled = connection_auth_disabled;
74 b->ftp_track_dirs = ftp_track_dirs;
75 b->disable_pmtu_discovery = disable_pmtu_discovery;
76 b->tcp_keepalive = tcp_keepalive;
77 b->secure = secure;
78
79 return b;
80 }
81