diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2019-05-22 10:54:36 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2019-05-22 11:07:42 +0100 |
commit | 05ca302c2bc5fd3be3598da503b209c5cdde5dbe (patch) | |
tree | c768ffc1fc6f4ebdb4ba897c2bbb611a60632380 /test/helpers.hpp | |
parent | 9d723cb230986e2d464d19a6a1518c7bf0f8df1e (diff) |
tests for chunked transfer encoding parser.
Change-Id: Ic55669ab7cc55bb44e8f7a00f30231b44f10535a
Diffstat (limited to 'test/helpers.hpp')
-rw-r--r-- | test/helpers.hpp | 23 |
1 files changed, 20 insertions, 3 deletions
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 <Poco/Net/HTTPResponse.h> #include <Poco/Net/HTTPSClientSession.h> #include <Poco/Net/NetException.h> +#include <Poco/Net/StreamSocket.h> +#include <Poco/Net/SecureStreamSocket.h> #include <Poco/Net/Socket.h> #include <Poco/Path.h> #include <Poco/StringTokenizer.h> @@ -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<Poco::Net::StreamSocket> createRawSocket() +{ + return +#if ENABLE_SSL + std::make_shared<Poco::Net::SecureStreamSocket> +#else + std::make_shared<Poco::Net::StreamSocket> +#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; } |