@@ -41,7 +41,9 @@ HTTPClientSession::ProxyConfig HTTPClientSession::_globalProxyConfig;
41
41
HTTPClientSession::HTTPClientSession ():
42
42
_port (HTTPSession::HTTP_PORT),
43
43
_sourceAddress4 (IPAddress::wildcard(IPAddress::IPv4), 0 ),
44
+ #if defined(POCO_HAVE_IPv6)
44
45
_sourceAddress6 (IPAddress::wildcard(IPAddress::IPv6), 0),
46
+ #endif // POCO_HAVE_IPv6
45
47
_proxyConfig (_globalProxyConfig),
46
48
_keepAliveTimeout (DEFAULT_KEEP_ALIVE_TIMEOUT, 0 ),
47
49
_reconnect (false ),
@@ -57,7 +59,9 @@ HTTPClientSession::HTTPClientSession(const StreamSocket& socket):
57
59
HTTPSession (socket),
58
60
_port (HTTPSession::HTTP_PORT),
59
61
_sourceAddress4 (IPAddress::wildcard(IPAddress::IPv4), 0 ),
62
+ #if defined(POCO_HAVE_IPv6)
60
63
_sourceAddress6 (IPAddress::wildcard(IPAddress::IPv6), 0),
64
+ #endif // POCO_HAVE_IPv6
61
65
_proxyConfig (_globalProxyConfig),
62
66
_keepAliveTimeout (DEFAULT_KEEP_ALIVE_TIMEOUT, 0 ),
63
67
_reconnect (false ),
@@ -73,7 +77,9 @@ HTTPClientSession::HTTPClientSession(const SocketAddress& address):
73
77
_host (address.host().toString()),
74
78
_port (address.port()),
75
79
_sourceAddress4 (IPAddress::wildcard(IPAddress::IPv4), 0 ),
80
+ #if defined(POCO_HAVE_IPv6)
76
81
_sourceAddress6 (IPAddress::wildcard(IPAddress::IPv6), 0),
82
+ #endif // POCO_HAVE_IPv6
77
83
_proxyConfig (_globalProxyConfig),
78
84
_keepAliveTimeout (DEFAULT_KEEP_ALIVE_TIMEOUT, 0 ),
79
85
_reconnect (false ),
@@ -89,7 +95,9 @@ HTTPClientSession::HTTPClientSession(const std::string& host, Poco::UInt16 port)
89
95
_host (host),
90
96
_port (port),
91
97
_sourceAddress4 (IPAddress::wildcard(IPAddress::IPv4), 0 ),
98
+ #if defined(POCO_HAVE_IPv6)
92
99
_sourceAddress6 (IPAddress::wildcard(IPAddress::IPv6), 0),
100
+ #endif // POCO_HAVE_IPv6
93
101
_proxyConfig (_globalProxyConfig),
94
102
_keepAliveTimeout (DEFAULT_KEEP_ALIVE_TIMEOUT, 0 ),
95
103
_reconnect (false ),
@@ -119,7 +127,9 @@ HTTPClientSession::HTTPClientSession(const StreamSocket& socket, const ProxyConf
119
127
HTTPSession (socket),
120
128
_port (HTTPSession::HTTP_PORT),
121
129
_sourceAddress4 (IPAddress::wildcard(IPAddress::IPv4), 0 ),
130
+ #if defined(POCO_HAVE_IPv6)
122
131
_sourceAddress6 (IPAddress::wildcard(IPAddress::IPv6), 0),
132
+ #endif // POCO_HAVE_IPv6
123
133
_proxyConfig (proxyConfig),
124
134
_keepAliveTimeout (DEFAULT_KEEP_ALIVE_TIMEOUT, 0 ),
125
135
_reconnect (false ),
@@ -159,8 +169,10 @@ void HTTPClientSession::setSourceAddress(const SocketAddress& address)
159
169
{
160
170
if (address.family () == IPAddress::IPv4)
161
171
_sourceAddress4 = address;
172
+ #if defined(POCO_HAVE_IPv6)
162
173
else
163
174
_sourceAddress6 = address;
175
+ #endif // POCO_HAVE_IPv6
164
176
_sourceAddress = address;
165
177
}
166
178
else
@@ -180,11 +192,12 @@ const SocketAddress& HTTPClientSession::getSourceAddress4()
180
192
}
181
193
182
194
195
+ #if defined(POCO_HAVE_IPv6)
183
196
const SocketAddress& HTTPClientSession::getSourceAddress6 ()
184
197
{
185
198
return _sourceAddress6;
186
199
}
187
-
200
+ # endif // POCO_HAVE_IPv6
188
201
189
202
void HTTPClientSession::setProxy (const std::string& host, Poco::UInt16 port)
190
203
{
@@ -465,8 +478,10 @@ void HTTPClientSession::reconnect()
465
478
466
479
if ((!_sourceAddress4.host ().isWildcard ()) || (_sourceAddress4.port () != 0 ))
467
480
connect (addr, _sourceAddress4);
481
+ #if defined(POCO_HAVE_IPv6)
468
482
else if ((!_sourceAddress6.host ().isWildcard ()) || (_sourceAddress6.port () != 0 ))
469
483
connect (addr, _sourceAddress6);
484
+ #endif // POCO_HAVE_IPv6
470
485
else
471
486
connect (addr);
472
487
}
@@ -596,7 +611,9 @@ StreamSocket HTTPClientSession::proxyConnect()
596
611
proxySession.proxyAuthenticateImpl (proxyRequest, _proxyConfig);
597
612
proxySession.setKeepAlive (true );
598
613
proxySession.setSourceAddress (_sourceAddress4);
614
+ #if defined(POCO_HAVE_IPv6)
599
615
proxySession.setSourceAddress (_sourceAddress6);
616
+ #endif // POCO_HAVE_IPv6
600
617
proxySession.sendRequest (proxyRequest);
601
618
proxySession.receiveResponse (proxyResponse);
602
619
if (proxyResponse.getStatus () != HTTPResponse::HTTP_OK)
0 commit comments