From 05ca302c2bc5fd3be3598da503b209c5cdde5dbe Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Wed, 22 May 2019 10:54:36 +0100 Subject: tests for chunked transfer encoding parser. Change-Id: Ic55669ab7cc55bb44e8f7a00f30231b44f10535a --- test/helpers.hpp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'test/helpers.hpp') diff --git a/test/helpers.hpp b/test/helpers.hpp index c0f9d112c..708806cd2 100644 --- a/test/helpers.hpp +++ b/test/helpers.hpp @@ -21,6 +21,8 @@ #include #include #include +#include +#include #include #include #include @@ -175,18 +177,33 @@ Poco::Net::HTTPClientSession* createSession(const Poco::URI& uri) return new Poco::Net::HTTPClientSession(uri.getHost(), uri.getPort()); } -inline -std::string const & getTestServerURI() +inline int getClientPort() { static const char* clientPort = std::getenv("LOOL_TEST_CLIENT_PORT"); + return clientPort? atoi(clientPort) : DEFAULT_CLIENT_PORT_NUMBER; +} + +inline std::shared_ptr createRawSocket() +{ + return +#if ENABLE_SSL + std::make_shared +#else + std::make_shared +#endif + (Poco::Net::SocketAddress("127.0.0.1", getClientPort())); +} +inline +std::string const & getTestServerURI() +{ static std::string serverURI( #if ENABLE_SSL "https://127.0.0.1:" #else "http://127.0.0.1:" #endif - + (clientPort? std::string(clientPort) : std::to_string(DEFAULT_CLIENT_PORT_NUMBER))); + + std::to_string(getClientPort())); return serverURI; } -- cgit v1.2.3