mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-28 11:31:53 +01:00
Rerun testProxy but cacth the exception.
Signed-off-by: FrancisANDRE <zosrothko@orange.fr>
This commit is contained in:
@@ -38,6 +38,7 @@
|
|||||||
#include <istream>
|
#include <istream>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
using namespace Poco::Net;
|
using namespace Poco::Net;
|
||||||
@@ -306,22 +307,27 @@ void HTTPSClientSessionTest::testInterop()
|
|||||||
|
|
||||||
void HTTPSClientSessionTest::testProxy()
|
void HTTPSClientSessionTest::testProxy()
|
||||||
{
|
{
|
||||||
HTTPSTestServer srv;
|
try {
|
||||||
HTTPSClientSession s("secure.appinf.com");
|
HTTPSTestServer srv;
|
||||||
s.setProxy(
|
HTTPSClientSession s("secure.appinf.com");
|
||||||
Application::instance().config().getString("testsuite.proxy.host"),
|
s.setProxy(
|
||||||
Application::instance().config().getInt("testsuite.proxy.port")
|
Application::instance().config().getString("testsuite.proxy.host"),
|
||||||
);
|
Application::instance().config().getInt("testsuite.proxy.port")
|
||||||
HTTPRequest request(HTTPRequest::HTTP_GET, "/public/poco/NetSSL.txt");
|
);
|
||||||
s.sendRequest(request);
|
HTTPRequest request(HTTPRequest::HTTP_GET, "/public/poco/NetSSL.txt");
|
||||||
X509Certificate cert = s.serverCertificate();
|
s.sendRequest(request);
|
||||||
HTTPResponse response;
|
X509Certificate cert = s.serverCertificate();
|
||||||
std::istream& rs = s.receiveResponse(response);
|
HTTPResponse response;
|
||||||
std::ostringstream ostr;
|
std::istream& rs = s.receiveResponse(response);
|
||||||
StreamCopier::copyStream(rs, ostr);
|
std::ostringstream ostr;
|
||||||
std::string str(ostr.str());
|
StreamCopier::copyStream(rs, ostr);
|
||||||
assert (str == "This is a test file for NetSSL.\n");
|
std::string str(ostr.str());
|
||||||
assert (cert.commonName() == "secure.appinf.com" || cert.commonName() == "*.appinf.com");
|
assert(str == "This is a test file for NetSSL.\n");
|
||||||
|
assert(cert.commonName() == "secure.appinf.com" || cert.commonName() == "*.appinf.com");
|
||||||
|
}
|
||||||
|
catch (Poco::Net::HTTPException e) {
|
||||||
|
std::cout << e.displayText() << std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -477,8 +483,8 @@ CppUnit::Test* HTTPSClientSessionTest::suite()
|
|||||||
should use a public proxy server
|
should use a public proxy server
|
||||||
http://www.publicproxyservers.com/proxy/list1.html
|
http://www.publicproxyservers.com/proxy/list1.html
|
||||||
Really working public proxy servers - page 1 of 6.
|
Really working public proxy servers - page 1 of 6.
|
||||||
CppUnit_addTest(pSuite, HTTPSClientSessionTest, testProxy);
|
|
||||||
#endif
|
#endif
|
||||||
|
CppUnit_addTest(pSuite, HTTPSClientSessionTest, testProxy);
|
||||||
CppUnit_addTest(pSuite, HTTPSClientSessionTest, testCachedSession);
|
CppUnit_addTest(pSuite, HTTPSClientSessionTest, testCachedSession);
|
||||||
CppUnit_addTest(pSuite, HTTPSClientSessionTest, testUnknownContentLength);
|
CppUnit_addTest(pSuite, HTTPSClientSessionTest, testUnknownContentLength);
|
||||||
CppUnit_addTest(pSuite, HTTPSClientSessionTest, testServerAbort);
|
CppUnit_addTest(pSuite, HTTPSClientSessionTest, testServerAbort);
|
||||||
|
|||||||
Reference in New Issue
Block a user