fix tests on macOS

This commit is contained in:
Guenter Obiltschnig
2017-11-09 14:37:34 +01:00
parent 75a153dbc9
commit b80fb988a1
4 changed files with 74 additions and 74 deletions

View File

@@ -50,15 +50,15 @@ namespace
response.setChunkedTransferEncoding(true);
else if (request.getContentLength() != HTTPMessage::UNKNOWN_CONTENT_LENGTH)
response.setContentLength(request.getContentLength());
response.setContentType(request.getContentType());
std::istream& istr = request.stream();
std::ostream& ostr = response.send();
StreamCopier::copyStream(istr, ostr);
}
};
class EchoHeaderRequestHandler: public HTTPRequestHandler
{
public:
@@ -92,7 +92,7 @@ namespace
response.send();
}
};
class RequestHandlerFactory: public HTTPRequestHandlerFactory
{
public:
@@ -130,8 +130,8 @@ void HTTPSServerTest::testIdentityRequest()
pParams->setKeepAlive(false);
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
srv.start();
HTTPSClientSession cs("localhost", svs.address().port());
HTTPSClientSession cs("127.0.0.1", svs.address().port());
std::string body(5000, 'x');
HTTPRequest request("POST", "/echoBody");
request.setContentLength((int) body.length());
@@ -153,8 +153,8 @@ void HTTPSServerTest::testChunkedRequest()
pParams->setKeepAlive(false);
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
srv.start();
HTTPSClientSession cs("localhost", svs.address().port());
HTTPSClientSession cs("127.0.0.1", svs.address().port());
std::string body(5000, 'x');
HTTPRequest request("POST", "/echoBody");
request.setContentType("text/plain");
@@ -177,8 +177,8 @@ void HTTPSServerTest::testIdentityRequestKeepAlive()
pParams->setKeepAlive(true);
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
srv.start();
HTTPSClientSession cs("localhost", svs.address().port());
HTTPSClientSession cs("127.0.0.1", svs.address().port());
cs.setKeepAlive(true);
std::string body(5000, 'x');
HTTPRequest request("POST", "/echoBody", HTTPMessage::HTTP_1_1);
@@ -192,7 +192,7 @@ void HTTPSServerTest::testIdentityRequestKeepAlive()
assert (response.getContentType() == "text/plain");
assert (response.getKeepAlive());
assert (rbody == body);
body.assign(1000, 'y');
request.setContentLength((int) body.length());
request.setKeepAlive(false);
@@ -211,8 +211,8 @@ void HTTPSServerTest::testChunkedRequestKeepAlive()
pParams->setKeepAlive(true);
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
srv.start();
HTTPSClientSession cs("localhost", svs.address().port());
HTTPSClientSession cs("127.0.0.1", svs.address().port());
cs.setKeepAlive(true);
std::string body(5000, 'x');
HTTPRequest request("POST", "/echoBody", HTTPMessage::HTTP_1_1);
@@ -246,8 +246,8 @@ void HTTPSServerTest::test100Continue()
pParams->setKeepAlive(false);
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
srv.start();
HTTPSClientSession cs("localhost", svs.address().port());
HTTPSClientSession cs("127.0.0.1", svs.address().port());
std::string body(5000, 'x');
HTTPRequest request("POST", "/echoBody");
request.setContentLength((int) body.length());
@@ -270,8 +270,8 @@ void HTTPSServerTest::testRedirect()
pParams->setKeepAlive(false);
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
srv.start();
HTTPSClientSession cs("localhost", svs.address().port());
HTTPSClientSession cs("127.0.0.1", svs.address().port());
HTTPRequest request("GET", "/redirect");
cs.sendRequest(request);
HTTPResponse response;
@@ -290,8 +290,8 @@ void HTTPSServerTest::testAuth()
pParams->setKeepAlive(false);
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
srv.start();
HTTPSClientSession cs("localhost", svs.address().port());
HTTPSClientSession cs("127.0.0.1", svs.address().port());
HTTPRequest request("GET", "/auth");
cs.sendRequest(request);
HTTPResponse response;
@@ -310,8 +310,8 @@ void HTTPSServerTest::testNotImpl()
pParams->setKeepAlive(false);
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
srv.start();
HTTPSClientSession cs("localhost", svs.address().port());
HTTPSClientSession cs("127.0.0.1", svs.address().port());
HTTPRequest request("GET", "/notImpl");
cs.sendRequest(request);
HTTPResponse response;