mirror of
				https://github.com/pocoproject/poco.git
				synced 2025-10-28 11:31:53 +01:00 
			
		
		
		
	| @@ -93,7 +93,7 @@ HTTPSClientSessionTest::~HTTPSClientSessionTest() | ||||
| void HTTPSClientSessionTest::testGetSmall() | ||||
| { | ||||
| 	HTTPSTestServer srv; | ||||
| 	HTTPSClientSession s("localhost", srv.port()); | ||||
| 	HTTPSClientSession s("127.0.0.1", srv.port()); | ||||
| 	HTTPRequest request(HTTPRequest::HTTP_GET, "/small"); | ||||
| 	s.sendRequest(request); | ||||
| 	HTTPResponse response; | ||||
| @@ -109,7 +109,7 @@ void HTTPSClientSessionTest::testGetSmall() | ||||
| void HTTPSClientSessionTest::testGetLarge() | ||||
| { | ||||
| 	HTTPSTestServer srv; | ||||
| 	HTTPSClientSession s("localhost", srv.port()); | ||||
| 	HTTPSClientSession s("127.0.0.1", srv.port()); | ||||
| 	HTTPRequest request(HTTPRequest::HTTP_GET, "/large"); | ||||
| 	s.sendRequest(request); | ||||
| 	HTTPResponse response; | ||||
| @@ -125,7 +125,7 @@ void HTTPSClientSessionTest::testGetLarge() | ||||
| void HTTPSClientSessionTest::testHead() | ||||
| { | ||||
| 	HTTPSTestServer srv; | ||||
| 	HTTPSClientSession s("localhost", srv.port()); | ||||
| 	HTTPSClientSession s("127.0.0.1", srv.port()); | ||||
| 	HTTPRequest request(HTTPRequest::HTTP_HEAD, "/large"); | ||||
| 	s.sendRequest(request); | ||||
| 	HTTPResponse response; | ||||
| @@ -140,7 +140,7 @@ void HTTPSClientSessionTest::testHead() | ||||
| void HTTPSClientSessionTest::testPostSmallIdentity() | ||||
| { | ||||
| 	HTTPSTestServer srv; | ||||
| 	HTTPSClientSession s("localhost", srv.port()); | ||||
| 	HTTPSClientSession s("127.0.0.1", srv.port()); | ||||
| 	HTTPRequest request(HTTPRequest::HTTP_POST, "/echo"); | ||||
| 	std::string body("this is a random request body\r\n0\r\n"); | ||||
| 	request.setContentLength((int) body.length()); | ||||
| @@ -157,7 +157,7 @@ void HTTPSClientSessionTest::testPostSmallIdentity() | ||||
| void HTTPSClientSessionTest::testPostLargeIdentity() | ||||
| { | ||||
| 	HTTPSTestServer srv; | ||||
| 	HTTPSClientSession s("localhost", srv.port()); | ||||
| 	HTTPSClientSession s("127.0.0.1", srv.port()); | ||||
| 	HTTPRequest request(HTTPRequest::HTTP_POST, "/echo"); | ||||
| 	std::string body(8000, 'x'); | ||||
| 	body.append("\r\n0\r\n"); | ||||
| @@ -175,7 +175,7 @@ void HTTPSClientSessionTest::testPostLargeIdentity() | ||||
| void HTTPSClientSessionTest::testPostSmallChunked() | ||||
| { | ||||
| 	HTTPSTestServer srv; | ||||
| 	HTTPSClientSession s("localhost", srv.port()); | ||||
| 	HTTPSClientSession s("127.0.0.1", srv.port()); | ||||
| 	HTTPRequest request(HTTPRequest::HTTP_POST, "/echo"); | ||||
| 	std::string body("this is a random request body"); | ||||
| 	request.setChunkedTransferEncoding(true); | ||||
| @@ -193,7 +193,7 @@ void HTTPSClientSessionTest::testPostSmallChunked() | ||||
| void HTTPSClientSessionTest::testPostLargeChunked() | ||||
| { | ||||
| 	HTTPSTestServer srv; | ||||
| 	HTTPSClientSession s("localhost", srv.port()); | ||||
| 	HTTPSClientSession s("127.0.0.1", srv.port()); | ||||
| 	HTTPRequest request(HTTPRequest::HTTP_POST, "/echo"); | ||||
| 	std::string body(16000, 'x'); | ||||
| 	request.setChunkedTransferEncoding(true); | ||||
| @@ -215,7 +215,7 @@ void HTTPSClientSessionTest::testPostLargeChunkedKeepAlive() | ||||
| 	srv.start(); | ||||
| 	try | ||||
| 	{ | ||||
| 		HTTPSClientSession s("localhost", srv.port()); | ||||
| 		HTTPSClientSession s("127.0.0.1", srv.port()); | ||||
| 		s.setKeepAlive(true); | ||||
| 		for (int i = 0; i < 10; ++i) | ||||
| 		{ | ||||
| @@ -244,7 +244,7 @@ void HTTPSClientSessionTest::testPostLargeChunkedKeepAlive() | ||||
| void HTTPSClientSessionTest::testKeepAlive() | ||||
| { | ||||
| 	HTTPSTestServer srv; | ||||
| 	HTTPSClientSession s("localhost", srv.port()); | ||||
| 	HTTPSClientSession s("127.0.0.1", srv.port()); | ||||
| 	s.setKeepAlive(true); | ||||
| 	HTTPRequest request(HTTPRequest::HTTP_HEAD, "/keepAlive", HTTPMessage::HTTP_1_1); | ||||
| 	s.sendRequest(request); | ||||
| @@ -359,7 +359,7 @@ void HTTPSClientSessionTest::testCachedSession() | ||||
| 		"ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"); | ||||
| 	pClientContext->enableSessionCache(true); | ||||
|  | ||||
| 	HTTPSClientSession s1("localhost", srv.port(), pClientContext); | ||||
| 	HTTPSClientSession s1("127.0.0.1", srv.port(), pClientContext); | ||||
| 	HTTPRequest request1(HTTPRequest::HTTP_GET, "/small"); | ||||
| 	s1.sendRequest(request1); | ||||
| 	Session::Ptr pSession1 = s1.sslSession(); | ||||
| @@ -371,7 +371,7 @@ void HTTPSClientSessionTest::testCachedSession() | ||||
| 	StreamCopier::copyStream(rs1, ostr1); | ||||
| 	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"); | ||||
| 	s2.sendRequest(request2); | ||||
| 	Session::Ptr pSession2 = s2.sslSession(); | ||||
| @@ -419,7 +419,7 @@ void HTTPSClientSessionTest::testCachedSession() | ||||
| void HTTPSClientSessionTest::testUnknownContentLength() | ||||
| { | ||||
| 	HTTPSTestServer srv; | ||||
| 	HTTPSClientSession s("localhost", srv.port()); | ||||
| 	HTTPSClientSession s("127.0.0.1", srv.port()); | ||||
| 	HTTPRequest request(HTTPRequest::HTTP_GET, "/nolength"); | ||||
| 	s.sendRequest(request); | ||||
| 	HTTPResponse response; | ||||
| @@ -435,7 +435,7 @@ void HTTPSClientSessionTest::testUnknownContentLength() | ||||
| void HTTPSClientSessionTest::testServerAbort() | ||||
| { | ||||
| 	HTTPSTestServer srv; | ||||
| 	HTTPSClientSession s("localhost", srv.port()); | ||||
| 	HTTPSClientSession s("127.0.0.1", srv.port()); | ||||
| 	HTTPRequest request(HTTPRequest::HTTP_GET, "/nolength/connection/abort"); | ||||
| 	s.sendRequest(request); | ||||
| 	HTTPResponse response; | ||||
|   | ||||
| @@ -133,7 +133,7 @@ void HTTPSServerTest::testIdentityRequest() | ||||
| 	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()); | ||||
| @@ -156,7 +156,7 @@ void HTTPSServerTest::testChunkedRequest() | ||||
| 	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"); | ||||
| @@ -180,7 +180,7 @@ void HTTPSServerTest::testIdentityRequestKeepAlive() | ||||
| 	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); | ||||
| @@ -214,7 +214,7 @@ void HTTPSServerTest::testChunkedRequestKeepAlive() | ||||
| 	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); | ||||
| @@ -249,7 +249,7 @@ void HTTPSServerTest::test100Continue() | ||||
| 	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()); | ||||
| @@ -273,7 +273,7 @@ void HTTPSServerTest::testRedirect() | ||||
| 	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; | ||||
| @@ -293,7 +293,7 @@ void HTTPSServerTest::testAuth() | ||||
| 	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; | ||||
| @@ -313,7 +313,7 @@ void HTTPSServerTest::testNotImpl() | ||||
| 	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; | ||||
|   | ||||
| @@ -48,7 +48,7 @@ void HTTPSStreamFactoryTest::testNoRedirect() | ||||
| { | ||||
| 	HTTPSTestServer server; | ||||
| 	HTTPSStreamFactory factory; | ||||
| 	URI uri("https://localhost/large"); | ||||
| 	URI uri("https://127.0.0.1/large"); | ||||
| 	uri.setPort(server.port()); | ||||
| 	std::auto_ptr<std::istream> pStr(factory.open(uri)); | ||||
| 	std::ostringstream ostr; | ||||
| @@ -61,7 +61,7 @@ void HTTPSStreamFactoryTest::testEmptyPath() | ||||
| { | ||||
| 	HTTPSTestServer server; | ||||
| 	HTTPSStreamFactory factory; | ||||
| 	URI uri("https://localhost"); | ||||
| 	URI uri("https://127.0.0.1"); | ||||
| 	uri.setPort(server.port()); | ||||
| 	std::auto_ptr<std::istream> pStr(factory.open(uri)); | ||||
| 	std::ostringstream ostr; | ||||
| @@ -74,7 +74,7 @@ void HTTPSStreamFactoryTest::testRedirect() | ||||
| { | ||||
| 	HTTPSTestServer server; | ||||
| 	HTTPSStreamFactory factory; | ||||
| 	URI uri("https://localhost/redirect"); | ||||
| 	URI uri("https://127.0.0.1/redirect"); | ||||
| 	uri.setPort(server.port()); | ||||
| 	std::auto_ptr<std::istream> pStr(factory.open(uri)); | ||||
| 	std::ostringstream ostr; | ||||
| @@ -103,7 +103,7 @@ void HTTPSStreamFactoryTest::testError() | ||||
| { | ||||
| 	HTTPSTestServer server; | ||||
| 	HTTPSStreamFactory factory; | ||||
| 	URI uri("https://localhost/notfound"); | ||||
| 	URI uri("https://127.0.0.1/notfound"); | ||||
| 	uri.setPort(server.port()); | ||||
| 	try | ||||
| 	{ | ||||
|   | ||||
| @@ -95,7 +95,7 @@ void TCPServerTest::testOneConnection() | ||||
| 	assert (srv.queuedConnections() == 0); | ||||
| 	assert (srv.totalConnections() == 0); | ||||
| 	 | ||||
| 	SocketAddress sa("localhost", svs.address().port()); | ||||
| 	SocketAddress sa("127.0.0.1", svs.address().port()); | ||||
| 	SecureStreamSocket ss1(sa); | ||||
| 	std::string data("hello, world"); | ||||
| 	ss1.sendBytes(data.data(), (int) data.size()); | ||||
| @@ -123,7 +123,7 @@ void TCPServerTest::testTwoConnections() | ||||
| 	assert (srv.queuedConnections() == 0); | ||||
| 	assert (srv.totalConnections() == 0); | ||||
| 	 | ||||
| 	SocketAddress sa("localhost", svs.address().port()); | ||||
| 	SocketAddress sa("127.0.0.1", svs.address().port()); | ||||
| 	SecureStreamSocket ss1(sa); | ||||
| 	SecureStreamSocket ss2(sa); | ||||
| 	std::string data("hello, world"); | ||||
| @@ -170,7 +170,7 @@ void TCPServerTest::testMultiConnections() | ||||
| 	assert (srv.queuedConnections() == 0); | ||||
| 	assert (srv.totalConnections() == 0); | ||||
| 	 | ||||
| 	SocketAddress sa("localhost", svs.address().port()); | ||||
| 	SocketAddress sa("127.0.0.1", svs.address().port()); | ||||
| 	SecureStreamSocket ss1(sa); | ||||
| 	SecureStreamSocket ss2(sa); | ||||
| 	SecureStreamSocket ss3(sa); | ||||
| @@ -259,7 +259,7 @@ void TCPServerTest::testReuseSocket() | ||||
| 	assert (srv.queuedConnections() == 0); | ||||
| 	assert (srv.totalConnections() == 0); | ||||
| 	 | ||||
| 	SocketAddress sa("localhost", svs.address().port()); | ||||
| 	SocketAddress sa("127.0.0.1", svs.address().port()); | ||||
| 	SecureStreamSocket ss1(sa); | ||||
| 	std::string data("hello, world"); | ||||
| 	ss1.sendBytes(data.data(), (int) data.size()); | ||||
| @@ -328,7 +328,7 @@ void TCPServerTest::testReuseSession() | ||||
| 		"ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"); | ||||
| 	pClientContext->enableSessionCache(true); | ||||
| 	 | ||||
| 	SocketAddress sa("localhost", svs.address().port()); | ||||
| 	SocketAddress sa("127.0.0.1", svs.address().port()); | ||||
| 	SecureStreamSocket ss1(sa, pClientContext); | ||||
| 	assert (!ss1.sessionWasReused()); | ||||
| 	std::string data("hello, world"); | ||||
|   | ||||
| @@ -119,7 +119,7 @@ void WebSocketTest::testWebSocket() | ||||
| 	 | ||||
| 	Poco::Thread::sleep(200); | ||||
| 	 | ||||
| 	HTTPSClientSession cs("localhost", ss.address().port()); | ||||
| 	HTTPSClientSession cs("127.0.0.1", ss.address().port()); | ||||
| 	HTTPRequest request(HTTPRequest::HTTP_GET, "/ws"); | ||||
| 	HTTPResponse response; | ||||
| 	WebSocket ws(cs, request, response); | ||||
| @@ -186,7 +186,7 @@ void WebSocketTest::testWebSocketLarge() | ||||
| 	 | ||||
| 	Poco::Thread::sleep(200); | ||||
| 	 | ||||
| 	HTTPSClientSession cs("localhost", ss.address().port()); | ||||
| 	HTTPSClientSession cs("127.0.0.1", ss.address().port()); | ||||
| 	HTTPRequest request(HTTPRequest::HTTP_GET, "/ws"); | ||||
| 	HTTPResponse response; | ||||
| 	WebSocket ws(cs, request, response); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Guenter Obiltschnig
					Guenter Obiltschnig