Update POCO library.

This commit is contained in:
Sandu Liviu Catalin committed 2023-03-23 20:19:11 +02:00
1 parent 8d15f4b6e9
commit 233fc103f9
2521 files changed
+257092 -72789

No files matched your search

+2 -2
View File
@@ -39,7 +39,7 @@ public:
runner.addTest("NetSSLTestSuite", NetSSLTestSuite::suite());
return runner.run(_targs) ? 0 : 1;
}
void setup(int argc, char** argv)
{
init(1, argv);
@@ -53,7 +53,7 @@ protected:
loadConfiguration(); // load default configuration files, if present
Poco::Util::Application::initialize(self);
}
private:
std::vector<std::string> _targs;
};
@@ -50,7 +50,7 @@ public:
TestRequestHandler()
{
}
void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response)
{
response.setChunkedTransferEncoding(true);
@@ -251,7 +251,7 @@ void HTTPSClientSessionTest::testKeepAlive()
assertTrue (response.getKeepAlive());
std::ostringstream ostr1;
assertTrue (StreamCopier::copyStream(rs1, ostr1) == 0);
request.setMethod(HTTPRequest::HTTP_GET);
request.setURI("/small");
s.sendRequest(request);
@@ -261,7 +261,7 @@ void HTTPSClientSessionTest::testKeepAlive()
std::ostringstream ostr2;
StreamCopier::copyStream(rs2, ostr2);
assertTrue (ostr2.str() == HTTPSTestServer::SMALL_BODY);
request.setMethod(HTTPRequest::HTTP_GET);
request.setURI("/large");
s.sendRequest(request);
@@ -304,7 +304,7 @@ void HTTPSClientSessionTest::testInterop()
cert.extractNames(commonName, domainNames);
assertTrue (commonName == "secure.appinf.com" || commonName == "*.appinf.com");
assertTrue (domainNames.find("appinf.com") != domainNames.end()
assertTrue (domainNames.find("appinf.com") != domainNames.end()
|| domainNames.find("*.appinf.com") != domainNames.end());
}
@@ -314,7 +314,7 @@ void HTTPSClientSessionTest::testProxy()
HTTPSTestServer srv;
HTTPSClientSession s("secure.appinf.com");
s.setProxy(
Application::instance().config().getString("testsuite.proxy.host"),
Application::instance().config().getString("testsuite.proxy.host"),
Application::instance().config().getInt("testsuite.proxy.port")
);
HTTPRequest request(HTTPRequest::HTTP_GET, "/public/poco/NetSSL.txt");
@@ -335,10 +335,10 @@ void HTTPSClientSessionTest::testCachedSession()
// ensure OpenSSL machinery is fully setup
Context::Ptr pDefaultServerContext = SSLManager::instance().defaultServerContext();
Context::Ptr pDefaultClientContext = SSLManager::instance().defaultClientContext();
Context::Ptr pServerContext = new Context(
Context::SERVER_USE,
"");
"");
//pServerContext->enableSessionCache(true, "TestSuite");
//pServerContext->setSessionTimeout(10);
//pServerContext->setSessionCacheSize(1000);
@@ -347,7 +347,7 @@ void HTTPSClientSessionTest::testCachedSession()
HTTPSTestServer srv(pServerContext);
Context::Ptr pClientContext = new Context(
Context::CLIENT_USE,
Context::CLIENT_USE,
"");
//pClientContext->enableSessionCache(true);
@@ -374,7 +374,7 @@ void HTTPSClientSessionTest::testCachedSession()
std::ostringstream ostr2;
StreamCopier::copyStream(rs2, ostr2);
assertTrue (ostr2.str() == HTTPSTestServer::SMALL_BODY);
assertTrue (pSession1 == pSession2);
HTTPRequest request3(HTTPRequest::HTTP_GET, "/small");
@@ -392,7 +392,7 @@ void HTTPSClientSessionTest::testCachedSession()
Thread::sleep(15000); // wait for session to expire
//pServerContext->flushSessionCache();
HTTPRequest request4(HTTPRequest::HTTP_GET, "/small");
s2.sendRequest(request4);
Session::Ptr pSession4 = s2.sslSession();
+13 -13
View File
@@ -51,15 +51,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:
@@ -93,7 +93,7 @@ namespace
response.send();
}
};
class RequestHandlerFactory: public HTTPRequestHandlerFactory
{
public:
@@ -131,7 +131,7 @@ void HTTPSServerTest::testIdentityRequest()
pParams->setKeepAlive(false);
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
srv.start();
HTTPSClientSession cs("127.0.0.1", svs.address().port());
std::string body(5000, 'x');
HTTPRequest request("POST", "/echoBody");
@@ -154,7 +154,7 @@ void HTTPSServerTest::testChunkedRequest()
pParams->setKeepAlive(false);
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
srv.start();
HTTPSClientSession cs("127.0.0.1", svs.address().port());
std::string body(5000, 'x');
HTTPRequest request("POST", "/echoBody");
@@ -178,7 +178,7 @@ void HTTPSServerTest::testIdentityRequestKeepAlive()
pParams->setKeepAlive(true);
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
srv.start();
HTTPSClientSession cs("127.0.0.1", svs.address().port());
cs.setKeepAlive(true);
std::string body(5000, 'x');
@@ -193,7 +193,7 @@ void HTTPSServerTest::testIdentityRequestKeepAlive()
assertTrue (response.getContentType() == "text/plain");
assertTrue (response.getKeepAlive());
assertTrue (rbody == body);
body.assign(1000, 'y');
request.setContentLength((int) body.length());
request.setKeepAlive(false);
@@ -213,7 +213,7 @@ void HTTPSServerTest::testChunkedRequestKeepAlive()
pParams->setKeepAlive(true);
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
srv.start();
HTTPSClientSession cs("127.0.0.1", svs.address().port());
cs.setKeepAlive(true);
std::string body(5000, 'x');
@@ -248,7 +248,7 @@ void HTTPSServerTest::test100Continue()
pParams->setKeepAlive(false);
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
srv.start();
HTTPSClientSession cs("127.0.0.1", svs.address().port());
std::string body(5000, 'x');
HTTPRequest request("POST", "/echoBody");
@@ -272,7 +272,7 @@ void HTTPSServerTest::testRedirect()
pParams->setKeepAlive(false);
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
srv.start();
HTTPSClientSession cs("127.0.0.1", svs.address().port());
HTTPRequest request("GET", "/redirect");
cs.sendRequest(request);
@@ -292,7 +292,7 @@ void HTTPSServerTest::testAuth()
pParams->setKeepAlive(false);
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
srv.start();
HTTPSClientSession cs("127.0.0.1", svs.address().port());
HTTPRequest request("GET", "/auth");
cs.sendRequest(request);
@@ -312,7 +312,7 @@ void HTTPSServerTest::testNotImpl()
pParams->setKeepAlive(false);
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
srv.start();
HTTPSClientSession cs("127.0.0.1", svs.address().port());
HTTPRequest request("GET", "/notImpl");
cs.sendRequest(request);
+8 -8
View File
@@ -106,7 +106,7 @@ void HTTPSTestServer::run()
bool HTTPSTestServer::requestComplete() const
{
return ((_lastRequest.substr(0, 3) == "GET" || _lastRequest.substr(0, 4) == "HEAD") &&
return ((_lastRequest.substr(0, 3) == "GET" || _lastRequest.substr(0, 4) == "HEAD") &&
(_lastRequest.find("\r\n\r\n") != std::string::npos)) ||
(_lastRequest.find("\r\n0\r\n") != std::string::npos);
}
@@ -122,7 +122,7 @@ std::string HTTPSTestServer::handleRequest() const
std::string body(SMALL_BODY);
response.append("HTTP/1.0 200 OK\r\n");
response.append("Content-Type: text/plain\r\n");
response.append("Content-Length: ");
response.append("Content-Length: ");
response.append(NumberFormatter::format((int) body.size()));
response.append("\r\n");
response.append("Connection: Close\r\n");
@@ -137,7 +137,7 @@ std::string HTTPSTestServer::handleRequest() const
std::string body(LARGE_BODY);
response.append("HTTP/1.0 200 OK\r\n");
response.append("Content-Type: text/plain\r\n");
response.append("Content-Length: ");
response.append("Content-Length: ");
response.append(NumberFormatter::format((int) body.size()));
response.append("\r\n");
response.append("Connection: Close\r\n");
@@ -154,7 +154,7 @@ std::string HTTPSTestServer::handleRequest() const
response.append("Content-Type: text/plain\r\n");
if (_lastRequest.find("Content-Length") != std::string::npos)
{
response.append("Content-Length: ");
response.append("Content-Length: ");
response.append(NumberFormatter::format((int) body.size()));
response.append("\r\n");
}
@@ -175,13 +175,13 @@ std::string HTTPSTestServer::handleRequest() const
response.append("HTTP/1.1 200 OK\r\n");
response.append("Connection: keep-alive\r\n");
response.append("Content-Type: text/plain\r\n");
response.append("Content-Length: ");
response.append("Content-Length: ");
response.append(NumberFormatter::format((int) body.size()));
response.append("\r\n\r\n");
response.append("HTTP/1.1 200 OK\r\n");
response.append("Connection: Keep-Alive\r\n");
response.append("Content-Type: text/plain\r\n");
response.append("Content-Length: ");
response.append("Content-Length: ");
response.append(NumberFormatter::format((int) body.size()));
response.append("\r\n\r\n");
response.append(body);
@@ -197,7 +197,7 @@ std::string HTTPSTestServer::handleRequest() const
response.append("HTTP/1.1 200 OK\r\n");
response.append("Connection: close\r\n");
response.append("Content-Type: text/plain\r\n");
response.append("Content-Length: ");
response.append("Content-Length: ");
response.append(NumberFormatter::format((int) body.size()));
response.append("\r\n\r\n");
}
@@ -218,7 +218,7 @@ std::string HTTPSTestServer::handleRequest() const
std::string body(SMALL_BODY);
response.append("HTTP/1.0 200 OK\r\n");
response.append("Content-Type: text/plain\r\n");
response.append("Content-Length: ");
response.append("Content-Length: ");
response.append(NumberFormatter::format((int) body.size()));
response.append("\r\n");
response.append("Connection: Close\r\n");
+3 -3
View File
@@ -36,15 +36,15 @@ public:
Poco::UInt16 port() const;
/// Returns the port the echo server is
/// listening on.
void run();
/// Does the work.
const std::string& lastRequest() const;
/// Returns the last request.
static const std::string SMALL_BODY;
static const std::string LARGE_BODY;
static const std::string LARGE_BODY;
protected:
bool requestComplete() const;
+20 -20
View File
@@ -50,7 +50,7 @@ namespace
EchoConnection(const StreamSocket& s): TCPServerConnection(s)
{
}
void run()
{
StreamSocket& ss = socket();
@@ -92,7 +92,7 @@ void TCPServerTest::testOneConnection()
assertTrue (srv.currentThreads() == 0);
assertTrue (srv.queuedConnections() == 0);
assertTrue (srv.totalConnections() == 0);
SocketAddress sa("127.0.0.1", svs.address().port());
SecureStreamSocket ss1(sa);
std::string data("hello, world");
@@ -120,7 +120,7 @@ void TCPServerTest::testTwoConnections()
assertTrue (srv.currentThreads() == 0);
assertTrue (srv.queuedConnections() == 0);
assertTrue (srv.totalConnections() == 0);
SocketAddress sa("127.0.0.1", svs.address().port());
SecureStreamSocket ss1(sa);
SecureStreamSocket ss2(sa);
@@ -136,7 +136,7 @@ void TCPServerTest::testTwoConnections()
n = ss2.receiveBytes(buffer, sizeof(buffer));
assertTrue (n > 0);
assertTrue (std::string(buffer, n) == data);
assertTrue (srv.currentConnections() == 2);
assertTrue (srv.currentThreads() == 2);
assertTrue (srv.queuedConnections() == 0);
@@ -167,7 +167,7 @@ void TCPServerTest::testMultiConnections()
assertTrue (srv.currentThreads() == 0);
assertTrue (srv.queuedConnections() == 0);
assertTrue (srv.totalConnections() == 0);
SocketAddress sa("127.0.0.1", svs.address().port());
SecureStreamSocket ss1(sa);
SecureStreamSocket ss2(sa);
@@ -195,12 +195,12 @@ void TCPServerTest::testMultiConnections()
n = ss4.receiveBytes(buffer, sizeof(buffer));
assertTrue (n > 0);
assertTrue (std::string(buffer, n) == data);
assertTrue (srv.currentConnections() == 4);
assertTrue (srv.currentThreads() == 4);
assertTrue (srv.queuedConnections() == 0);
assertTrue (srv.totalConnections() == 4);
SecureStreamSocket ss5;
ss5.setLazyHandshake();
ss5.connect(sa);
@@ -211,7 +211,7 @@ void TCPServerTest::testMultiConnections()
ss6.connect(sa);
Thread::sleep(200);
assertTrue (srv.queuedConnections() == 2);
ss1.close();
Thread::sleep(300);
assertTrue (srv.currentConnections() == 4);
@@ -225,7 +225,7 @@ void TCPServerTest::testMultiConnections()
assertTrue (srv.currentThreads() == 4);
assertTrue (srv.queuedConnections() == 0);
assertTrue (srv.totalConnections() == 6);
ss3.close();
Thread::sleep(300);
assertTrue (srv.currentConnections() == 3);
@@ -256,7 +256,7 @@ void TCPServerTest::testReuseSocket()
assertTrue (srv.currentThreads() == 0);
assertTrue (srv.queuedConnections() == 0);
assertTrue (srv.totalConnections() == 0);
SocketAddress sa("127.0.0.1", svs.address().port());
SecureStreamSocket ss1(sa);
std::string data("hello, world");
@@ -292,15 +292,15 @@ void TCPServerTest::testReuseSession()
// ensure SSL machinery is fully setup
Context::Ptr pDefaultServerContext = SSLManager::instance().defaultServerContext();
Context::Ptr pDefaultClientContext = SSLManager::instance().defaultClientContext();
Context::Ptr pServerContext = new Context(
Context::SERVER_USE,
"test.appinf.com");
Context::SERVER_USE,
"test.appinf.com");
//pServerContext->enableSessionCache(true, "TestSuite");
//pServerContext->setSessionTimeout(10);
//pServerContext->setSessionCacheSize(1000);
//pServerContext->disableStatelessSessionResumption();
SecureServerSocket svs(0, 64, pServerContext);
TCPServer srv(new TCPServerConnectionFactoryImpl<EchoConnection>(), svs);
srv.start();
@@ -308,12 +308,12 @@ void TCPServerTest::testReuseSession()
assertTrue (srv.currentThreads() == 0);
assertTrue (srv.queuedConnections() == 0);
assertTrue (srv.totalConnections() == 0);
Context::Ptr pClientContext = new Context(
Context::CLIENT_USE,
Context::CLIENT_USE,
"");
//pClientContext->enableSessionCache(true);
SocketAddress sa("127.0.0.1", svs.address().port());
SecureStreamSocket ss1(sa, pClientContext);
assertTrue (!ss1.sessionWasReused());
@@ -327,9 +327,9 @@ void TCPServerTest::testReuseSession()
assertTrue (srv.currentThreads() == 1);
assertTrue (srv.queuedConnections() == 0);
assertTrue (srv.totalConnections() == 1);
Session::Ptr pSession = ss1.currentSession();
ss1.close();
Thread::sleep(300);
assertTrue (srv.currentConnections() == 0);
@@ -351,7 +351,7 @@ void TCPServerTest::testReuseSession()
Thread::sleep(15000); // wait for session to expire
//pServerContext->flushSessionCache();
ss1.useSession(pSession);
ss1.connect(sa);
assertTrue (!ss1.sessionWasReused());
+3 -3
View File
@@ -40,14 +40,14 @@ public:
runner.addTest("NetSSLTestSuite", NetSSLTestSuite::suite());
return runner.run(_targs) ? 0 : 1;
}
void setup(const std::vector<std::string>& args)
{
char* argv[] =
{
const_cast<char*>(args[0].c_str())
};
init(1, argv);
for (std::size_t i = 0; i < args.size(); ++i)
_targs.push_back(args[i]);
@@ -59,7 +59,7 @@ protected:
loadConfiguration(); // load default configuration files, if present
Poco::Util::Application::initialize(self);
}
private:
std::vector<std::string> _targs;
};
+2 -2
View File
@@ -39,14 +39,14 @@ public:
runner.run();
return 0;
}
protected:
void initialize(Poco::Util::Application& self)
{
loadConfiguration(); // load default configuration files, if present
Poco::Util::Application::initialize(self);
}
private:
std::vector<std::string> _targs;
};