mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-25 18:22:59 +02:00
fix tests on macOS
This commit is contained in:
@@ -90,7 +90,7 @@ HTTPSClientSessionTest::~HTTPSClientSessionTest()
|
|||||||
void HTTPSClientSessionTest::testGetSmall()
|
void HTTPSClientSessionTest::testGetSmall()
|
||||||
{
|
{
|
||||||
HTTPSTestServer srv;
|
HTTPSTestServer srv;
|
||||||
HTTPSClientSession s("localhost", srv.port());
|
HTTPSClientSession s("127.0.0.1", srv.port());
|
||||||
HTTPRequest request(HTTPRequest::HTTP_GET, "/small");
|
HTTPRequest request(HTTPRequest::HTTP_GET, "/small");
|
||||||
s.sendRequest(request);
|
s.sendRequest(request);
|
||||||
HTTPResponse response;
|
HTTPResponse response;
|
||||||
@@ -106,7 +106,7 @@ void HTTPSClientSessionTest::testGetSmall()
|
|||||||
void HTTPSClientSessionTest::testGetLarge()
|
void HTTPSClientSessionTest::testGetLarge()
|
||||||
{
|
{
|
||||||
HTTPSTestServer srv;
|
HTTPSTestServer srv;
|
||||||
HTTPSClientSession s("localhost", srv.port());
|
HTTPSClientSession s("127.0.0.1", srv.port());
|
||||||
HTTPRequest request(HTTPRequest::HTTP_GET, "/large");
|
HTTPRequest request(HTTPRequest::HTTP_GET, "/large");
|
||||||
s.sendRequest(request);
|
s.sendRequest(request);
|
||||||
HTTPResponse response;
|
HTTPResponse response;
|
||||||
@@ -122,7 +122,7 @@ void HTTPSClientSessionTest::testGetLarge()
|
|||||||
void HTTPSClientSessionTest::testHead()
|
void HTTPSClientSessionTest::testHead()
|
||||||
{
|
{
|
||||||
HTTPSTestServer srv;
|
HTTPSTestServer srv;
|
||||||
HTTPSClientSession s("localhost", srv.port());
|
HTTPSClientSession s("127.0.0.1", srv.port());
|
||||||
HTTPRequest request(HTTPRequest::HTTP_HEAD, "/large");
|
HTTPRequest request(HTTPRequest::HTTP_HEAD, "/large");
|
||||||
s.sendRequest(request);
|
s.sendRequest(request);
|
||||||
HTTPResponse response;
|
HTTPResponse response;
|
||||||
@@ -137,7 +137,7 @@ void HTTPSClientSessionTest::testHead()
|
|||||||
void HTTPSClientSessionTest::testPostSmallIdentity()
|
void HTTPSClientSessionTest::testPostSmallIdentity()
|
||||||
{
|
{
|
||||||
HTTPSTestServer srv;
|
HTTPSTestServer srv;
|
||||||
HTTPSClientSession s("localhost", srv.port());
|
HTTPSClientSession s("127.0.0.1", srv.port());
|
||||||
HTTPRequest request(HTTPRequest::HTTP_POST, "/echo");
|
HTTPRequest request(HTTPRequest::HTTP_POST, "/echo");
|
||||||
std::string body("this is a random request body\r\n0\r\n");
|
std::string body("this is a random request body\r\n0\r\n");
|
||||||
request.setContentLength((int) body.length());
|
request.setContentLength((int) body.length());
|
||||||
@@ -154,7 +154,7 @@ void HTTPSClientSessionTest::testPostSmallIdentity()
|
|||||||
void HTTPSClientSessionTest::testPostLargeIdentity()
|
void HTTPSClientSessionTest::testPostLargeIdentity()
|
||||||
{
|
{
|
||||||
HTTPSTestServer srv;
|
HTTPSTestServer srv;
|
||||||
HTTPSClientSession s("localhost", srv.port());
|
HTTPSClientSession s("127.0.0.1", srv.port());
|
||||||
HTTPRequest request(HTTPRequest::HTTP_POST, "/echo");
|
HTTPRequest request(HTTPRequest::HTTP_POST, "/echo");
|
||||||
std::string body(8000, 'x');
|
std::string body(8000, 'x');
|
||||||
body.append("\r\n0\r\n");
|
body.append("\r\n0\r\n");
|
||||||
@@ -172,7 +172,7 @@ void HTTPSClientSessionTest::testPostLargeIdentity()
|
|||||||
void HTTPSClientSessionTest::testPostSmallChunked()
|
void HTTPSClientSessionTest::testPostSmallChunked()
|
||||||
{
|
{
|
||||||
HTTPSTestServer srv;
|
HTTPSTestServer srv;
|
||||||
HTTPSClientSession s("localhost", srv.port());
|
HTTPSClientSession s("127.0.0.1", srv.port());
|
||||||
HTTPRequest request(HTTPRequest::HTTP_POST, "/echo");
|
HTTPRequest request(HTTPRequest::HTTP_POST, "/echo");
|
||||||
std::string body("this is a random request body");
|
std::string body("this is a random request body");
|
||||||
request.setChunkedTransferEncoding(true);
|
request.setChunkedTransferEncoding(true);
|
||||||
@@ -190,7 +190,7 @@ void HTTPSClientSessionTest::testPostSmallChunked()
|
|||||||
void HTTPSClientSessionTest::testPostLargeChunked()
|
void HTTPSClientSessionTest::testPostLargeChunked()
|
||||||
{
|
{
|
||||||
HTTPSTestServer srv;
|
HTTPSTestServer srv;
|
||||||
HTTPSClientSession s("localhost", srv.port());
|
HTTPSClientSession s("127.0.0.1", srv.port());
|
||||||
HTTPRequest request(HTTPRequest::HTTP_POST, "/echo");
|
HTTPRequest request(HTTPRequest::HTTP_POST, "/echo");
|
||||||
std::string body(16000, 'x');
|
std::string body(16000, 'x');
|
||||||
request.setChunkedTransferEncoding(true);
|
request.setChunkedTransferEncoding(true);
|
||||||
@@ -212,7 +212,7 @@ void HTTPSClientSessionTest::testPostLargeChunkedKeepAlive()
|
|||||||
srv.start();
|
srv.start();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
HTTPSClientSession s("localhost", srv.port());
|
HTTPSClientSession s("127.0.0.1", srv.port());
|
||||||
s.setKeepAlive(true);
|
s.setKeepAlive(true);
|
||||||
for (int i = 0; i < 10; ++i)
|
for (int i = 0; i < 10; ++i)
|
||||||
{
|
{
|
||||||
@@ -241,7 +241,7 @@ void HTTPSClientSessionTest::testPostLargeChunkedKeepAlive()
|
|||||||
void HTTPSClientSessionTest::testKeepAlive()
|
void HTTPSClientSessionTest::testKeepAlive()
|
||||||
{
|
{
|
||||||
HTTPSTestServer srv;
|
HTTPSTestServer srv;
|
||||||
HTTPSClientSession s("localhost", srv.port());
|
HTTPSClientSession s("127.0.0.1", srv.port());
|
||||||
s.setKeepAlive(true);
|
s.setKeepAlive(true);
|
||||||
HTTPRequest request(HTTPRequest::HTTP_HEAD, "/keepAlive", HTTPMessage::HTTP_1_1);
|
HTTPRequest request(HTTPRequest::HTTP_HEAD, "/keepAlive", HTTPMessage::HTTP_1_1);
|
||||||
s.sendRequest(request);
|
s.sendRequest(request);
|
||||||
@@ -356,7 +356,7 @@ void HTTPSClientSessionTest::testCachedSession()
|
|||||||
"ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
|
"ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
|
||||||
pClientContext->enableSessionCache(true);
|
pClientContext->enableSessionCache(true);
|
||||||
|
|
||||||
HTTPSClientSession s1("localhost", srv.port(), pClientContext);
|
HTTPSClientSession s1("127.0.0.1", srv.port(), pClientContext);
|
||||||
HTTPRequest request1(HTTPRequest::HTTP_GET, "/small");
|
HTTPRequest request1(HTTPRequest::HTTP_GET, "/small");
|
||||||
s1.sendRequest(request1);
|
s1.sendRequest(request1);
|
||||||
Session::Ptr pSession1 = s1.sslSession();
|
Session::Ptr pSession1 = s1.sslSession();
|
||||||
@@ -368,7 +368,7 @@ void HTTPSClientSessionTest::testCachedSession()
|
|||||||
StreamCopier::copyStream(rs1, ostr1);
|
StreamCopier::copyStream(rs1, ostr1);
|
||||||
assert (ostr1.str() == HTTPSTestServer::SMALL_BODY);
|
assert (ostr1.str() == HTTPSTestServer::SMALL_BODY);
|
||||||
|
|
||||||
HTTPSClientSession s2("localhost", srv.port(), pClientContext, pSession1);
|
HTTPSClientSession s2("127.0.0.1", srv.port(), pClientContext, pSession1);
|
||||||
HTTPRequest request2(HTTPRequest::HTTP_GET, "/small");
|
HTTPRequest request2(HTTPRequest::HTTP_GET, "/small");
|
||||||
s2.sendRequest(request2);
|
s2.sendRequest(request2);
|
||||||
Session::Ptr pSession2 = s2.sslSession();
|
Session::Ptr pSession2 = s2.sslSession();
|
||||||
@@ -416,7 +416,7 @@ void HTTPSClientSessionTest::testCachedSession()
|
|||||||
void HTTPSClientSessionTest::testUnknownContentLength()
|
void HTTPSClientSessionTest::testUnknownContentLength()
|
||||||
{
|
{
|
||||||
HTTPSTestServer srv;
|
HTTPSTestServer srv;
|
||||||
HTTPSClientSession s("localhost", srv.port());
|
HTTPSClientSession s("127.0.0.1", srv.port());
|
||||||
HTTPRequest request(HTTPRequest::HTTP_GET, "/nolength");
|
HTTPRequest request(HTTPRequest::HTTP_GET, "/nolength");
|
||||||
s.sendRequest(request);
|
s.sendRequest(request);
|
||||||
HTTPResponse response;
|
HTTPResponse response;
|
||||||
@@ -432,7 +432,7 @@ void HTTPSClientSessionTest::testUnknownContentLength()
|
|||||||
void HTTPSClientSessionTest::testServerAbort()
|
void HTTPSClientSessionTest::testServerAbort()
|
||||||
{
|
{
|
||||||
HTTPSTestServer srv;
|
HTTPSTestServer srv;
|
||||||
HTTPSClientSession s("localhost", srv.port());
|
HTTPSClientSession s("127.0.0.1", srv.port());
|
||||||
HTTPRequest request(HTTPRequest::HTTP_GET, "/nolength/connection/abort");
|
HTTPRequest request(HTTPRequest::HTTP_GET, "/nolength/connection/abort");
|
||||||
s.sendRequest(request);
|
s.sendRequest(request);
|
||||||
HTTPResponse response;
|
HTTPResponse response;
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ void HTTPSServerTest::testIdentityRequest()
|
|||||||
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
|
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
|
||||||
srv.start();
|
srv.start();
|
||||||
|
|
||||||
HTTPSClientSession cs("localhost", svs.address().port());
|
HTTPSClientSession cs("127.0.0.1", svs.address().port());
|
||||||
std::string body(5000, 'x');
|
std::string body(5000, 'x');
|
||||||
HTTPRequest request("POST", "/echoBody");
|
HTTPRequest request("POST", "/echoBody");
|
||||||
request.setContentLength((int) body.length());
|
request.setContentLength((int) body.length());
|
||||||
@@ -154,7 +154,7 @@ void HTTPSServerTest::testChunkedRequest()
|
|||||||
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
|
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
|
||||||
srv.start();
|
srv.start();
|
||||||
|
|
||||||
HTTPSClientSession cs("localhost", svs.address().port());
|
HTTPSClientSession cs("127.0.0.1", svs.address().port());
|
||||||
std::string body(5000, 'x');
|
std::string body(5000, 'x');
|
||||||
HTTPRequest request("POST", "/echoBody");
|
HTTPRequest request("POST", "/echoBody");
|
||||||
request.setContentType("text/plain");
|
request.setContentType("text/plain");
|
||||||
@@ -178,7 +178,7 @@ void HTTPSServerTest::testIdentityRequestKeepAlive()
|
|||||||
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
|
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
|
||||||
srv.start();
|
srv.start();
|
||||||
|
|
||||||
HTTPSClientSession cs("localhost", svs.address().port());
|
HTTPSClientSession cs("127.0.0.1", svs.address().port());
|
||||||
cs.setKeepAlive(true);
|
cs.setKeepAlive(true);
|
||||||
std::string body(5000, 'x');
|
std::string body(5000, 'x');
|
||||||
HTTPRequest request("POST", "/echoBody", HTTPMessage::HTTP_1_1);
|
HTTPRequest request("POST", "/echoBody", HTTPMessage::HTTP_1_1);
|
||||||
@@ -212,7 +212,7 @@ void HTTPSServerTest::testChunkedRequestKeepAlive()
|
|||||||
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
|
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
|
||||||
srv.start();
|
srv.start();
|
||||||
|
|
||||||
HTTPSClientSession cs("localhost", svs.address().port());
|
HTTPSClientSession cs("127.0.0.1", svs.address().port());
|
||||||
cs.setKeepAlive(true);
|
cs.setKeepAlive(true);
|
||||||
std::string body(5000, 'x');
|
std::string body(5000, 'x');
|
||||||
HTTPRequest request("POST", "/echoBody", HTTPMessage::HTTP_1_1);
|
HTTPRequest request("POST", "/echoBody", HTTPMessage::HTTP_1_1);
|
||||||
@@ -247,7 +247,7 @@ void HTTPSServerTest::test100Continue()
|
|||||||
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
|
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
|
||||||
srv.start();
|
srv.start();
|
||||||
|
|
||||||
HTTPSClientSession cs("localhost", svs.address().port());
|
HTTPSClientSession cs("127.0.0.1", svs.address().port());
|
||||||
std::string body(5000, 'x');
|
std::string body(5000, 'x');
|
||||||
HTTPRequest request("POST", "/echoBody");
|
HTTPRequest request("POST", "/echoBody");
|
||||||
request.setContentLength((int) body.length());
|
request.setContentLength((int) body.length());
|
||||||
@@ -271,7 +271,7 @@ void HTTPSServerTest::testRedirect()
|
|||||||
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
|
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
|
||||||
srv.start();
|
srv.start();
|
||||||
|
|
||||||
HTTPSClientSession cs("localhost", svs.address().port());
|
HTTPSClientSession cs("127.0.0.1", svs.address().port());
|
||||||
HTTPRequest request("GET", "/redirect");
|
HTTPRequest request("GET", "/redirect");
|
||||||
cs.sendRequest(request);
|
cs.sendRequest(request);
|
||||||
HTTPResponse response;
|
HTTPResponse response;
|
||||||
@@ -291,7 +291,7 @@ void HTTPSServerTest::testAuth()
|
|||||||
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
|
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
|
||||||
srv.start();
|
srv.start();
|
||||||
|
|
||||||
HTTPSClientSession cs("localhost", svs.address().port());
|
HTTPSClientSession cs("127.0.0.1", svs.address().port());
|
||||||
HTTPRequest request("GET", "/auth");
|
HTTPRequest request("GET", "/auth");
|
||||||
cs.sendRequest(request);
|
cs.sendRequest(request);
|
||||||
HTTPResponse response;
|
HTTPResponse response;
|
||||||
@@ -311,7 +311,7 @@ void HTTPSServerTest::testNotImpl()
|
|||||||
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
|
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
|
||||||
srv.start();
|
srv.start();
|
||||||
|
|
||||||
HTTPSClientSession cs("localhost", svs.address().port());
|
HTTPSClientSession cs("127.0.0.1", svs.address().port());
|
||||||
HTTPRequest request("GET", "/notImpl");
|
HTTPRequest request("GET", "/notImpl");
|
||||||
cs.sendRequest(request);
|
cs.sendRequest(request);
|
||||||
HTTPResponse response;
|
HTTPResponse response;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ void HTTPSStreamFactoryTest::testNoRedirect()
|
|||||||
{
|
{
|
||||||
HTTPSTestServer server;
|
HTTPSTestServer server;
|
||||||
HTTPSStreamFactory factory;
|
HTTPSStreamFactory factory;
|
||||||
URI uri("https://localhost/large");
|
URI uri("https://127.0.0.1/large");
|
||||||
uri.setPort(server.port());
|
uri.setPort(server.port());
|
||||||
#ifndef POCO_ENABLE_CPP11
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<std::istream> pStr(factory.open(uri));
|
std::auto_ptr<std::istream> pStr(factory.open(uri));
|
||||||
@@ -62,7 +62,7 @@ void HTTPSStreamFactoryTest::testEmptyPath()
|
|||||||
{
|
{
|
||||||
HTTPSTestServer server;
|
HTTPSTestServer server;
|
||||||
HTTPSStreamFactory factory;
|
HTTPSStreamFactory factory;
|
||||||
URI uri("https://localhost");
|
URI uri("https://127.0.0.1");
|
||||||
uri.setPort(server.port());
|
uri.setPort(server.port());
|
||||||
#ifndef POCO_ENABLE_CPP11
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<std::istream> pStr(factory.open(uri));
|
std::auto_ptr<std::istream> pStr(factory.open(uri));
|
||||||
@@ -79,7 +79,7 @@ void HTTPSStreamFactoryTest::testRedirect()
|
|||||||
{
|
{
|
||||||
HTTPSTestServer server;
|
HTTPSTestServer server;
|
||||||
HTTPSStreamFactory factory;
|
HTTPSStreamFactory factory;
|
||||||
URI uri("https://localhost/redirect");
|
URI uri("https://127.0.0.1/redirect");
|
||||||
uri.setPort(server.port());
|
uri.setPort(server.port());
|
||||||
#ifndef POCO_ENABLE_CPP11
|
#ifndef POCO_ENABLE_CPP11
|
||||||
std::auto_ptr<std::istream> pStr(factory.open(uri));
|
std::auto_ptr<std::istream> pStr(factory.open(uri));
|
||||||
@@ -115,7 +115,7 @@ void HTTPSStreamFactoryTest::testError()
|
|||||||
{
|
{
|
||||||
HTTPSTestServer server;
|
HTTPSTestServer server;
|
||||||
HTTPSStreamFactory factory;
|
HTTPSStreamFactory factory;
|
||||||
URI uri("https://localhost/notfound");
|
URI uri("https://127.0.0.1/notfound");
|
||||||
uri.setPort(server.port());
|
uri.setPort(server.port());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ void TCPServerTest::testOneConnection()
|
|||||||
assert (srv.queuedConnections() == 0);
|
assert (srv.queuedConnections() == 0);
|
||||||
assert (srv.totalConnections() == 0);
|
assert (srv.totalConnections() == 0);
|
||||||
|
|
||||||
SocketAddress sa("localhost", svs.address().port());
|
SocketAddress sa("127.0.0.1", svs.address().port());
|
||||||
SecureStreamSocket ss1(sa);
|
SecureStreamSocket ss1(sa);
|
||||||
std::string data("hello, world");
|
std::string data("hello, world");
|
||||||
ss1.sendBytes(data.data(), (int) data.size());
|
ss1.sendBytes(data.data(), (int) data.size());
|
||||||
@@ -121,7 +121,7 @@ void TCPServerTest::testTwoConnections()
|
|||||||
assert (srv.queuedConnections() == 0);
|
assert (srv.queuedConnections() == 0);
|
||||||
assert (srv.totalConnections() == 0);
|
assert (srv.totalConnections() == 0);
|
||||||
|
|
||||||
SocketAddress sa("localhost", svs.address().port());
|
SocketAddress sa("127.0.0.1", svs.address().port());
|
||||||
SecureStreamSocket ss1(sa);
|
SecureStreamSocket ss1(sa);
|
||||||
SecureStreamSocket ss2(sa);
|
SecureStreamSocket ss2(sa);
|
||||||
std::string data("hello, world");
|
std::string data("hello, world");
|
||||||
@@ -168,7 +168,7 @@ void TCPServerTest::testMultiConnections()
|
|||||||
assert (srv.queuedConnections() == 0);
|
assert (srv.queuedConnections() == 0);
|
||||||
assert (srv.totalConnections() == 0);
|
assert (srv.totalConnections() == 0);
|
||||||
|
|
||||||
SocketAddress sa("localhost", svs.address().port());
|
SocketAddress sa("127.0.0.1", svs.address().port());
|
||||||
SecureStreamSocket ss1(sa);
|
SecureStreamSocket ss1(sa);
|
||||||
SecureStreamSocket ss2(sa);
|
SecureStreamSocket ss2(sa);
|
||||||
SecureStreamSocket ss3(sa);
|
SecureStreamSocket ss3(sa);
|
||||||
@@ -257,7 +257,7 @@ void TCPServerTest::testReuseSocket()
|
|||||||
assert (srv.queuedConnections() == 0);
|
assert (srv.queuedConnections() == 0);
|
||||||
assert (srv.totalConnections() == 0);
|
assert (srv.totalConnections() == 0);
|
||||||
|
|
||||||
SocketAddress sa("localhost", svs.address().port());
|
SocketAddress sa("127.0.0.1", svs.address().port());
|
||||||
SecureStreamSocket ss1(sa);
|
SecureStreamSocket ss1(sa);
|
||||||
std::string data("hello, world");
|
std::string data("hello, world");
|
||||||
ss1.sendBytes(data.data(), (int) data.size());
|
ss1.sendBytes(data.data(), (int) data.size());
|
||||||
@@ -326,7 +326,7 @@ void TCPServerTest::testReuseSession()
|
|||||||
"ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
|
"ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH");
|
||||||
pClientContext->enableSessionCache(true);
|
pClientContext->enableSessionCache(true);
|
||||||
|
|
||||||
SocketAddress sa("localhost", svs.address().port());
|
SocketAddress sa("127.0.0.1", svs.address().port());
|
||||||
SecureStreamSocket ss1(sa, pClientContext);
|
SecureStreamSocket ss1(sa, pClientContext);
|
||||||
assert (!ss1.sessionWasReused());
|
assert (!ss1.sessionWasReused());
|
||||||
std::string data("hello, world");
|
std::string data("hello, world");
|
||||||
|
|||||||
Reference in New Issue
Block a user