Unverified Commit 614953be authored by Kip's avatar Kip Committed by GitHub

Merge pull request #957 from Tachi107/experimental-client

Move the Http client to `Pistache::Experimental`
parents 23b88dd0 10e205e8
......@@ -33,9 +33,9 @@ int main(int argc, char* argv[])
count = std::stoi(argv[2]);
}
Http::Client client;
Http::Experimental::Client client;
auto opts = Http::Client::options().threads(1).maxConnectionsPerHost(8);
auto opts = Http::Experimental::Client::options().threads(1).maxConnectionsPerHost(8);
client.init(opts);
std::vector<Async::Promise<Http::Response>> responses;
......
......@@ -27,7 +27,7 @@
#include <string>
#include <unordered_map>
namespace Pistache::Http
namespace Pistache::Http::Experimental
{
namespace Default
......
......@@ -168,13 +168,16 @@ namespace Pistache
};
} // namespace Uri
// Remove when RequestBuilder will be out of namespace Experimental
namespace Experimental {class RequestBuilder; };
// 5. Request
class Request : public Message
{
public:
friend class Private::RequestLineStep;
friend class RequestBuilder;
friend class Experimental::RequestBuilder;
Request() = default;
......
......@@ -26,7 +26,7 @@
#include <sstream>
#include <string>
namespace Pistache::Http
namespace Pistache::Http::Experimental
{
using NotifyOn = Polling::NotifyOn;
......
......@@ -48,7 +48,7 @@ TEST(http_client_test, one_client_with_one_request_with_onecookie)
const std::string server_address = "localhost:" + server.getPort().toString();
std::cout << "Server address: " << server_address << "\n";
Http::Client client;
Http::Experimental::Client client;
client.init();
std::vector<Async::Promise<Http::Response>> responses;
......@@ -87,7 +87,7 @@ TEST(http_client_test, one_client_with_one_request_with_several_cookies)
const std::string server_address = "localhost:" + server.getPort().toString();
std::cout << "Server address: " << server_address << "\n";
Http::Client client;
Http::Experimental::Client client;
client.init();
std::vector<Async::Promise<Http::Response>> responses;
......
......@@ -101,7 +101,7 @@ TEST(http_client_test, one_client_with_one_request)
const std::string server_address = "localhost:" + server.getPort().toString();
std::cout << "Server address: " << server_address << "\n";
Http::Client client;
Http::Experimental::Client client;
client.init();
auto rb = client.get(server_address);
......@@ -138,7 +138,7 @@ TEST(http_client_test, one_client_with_multiple_requests)
const std::string server_address = "localhost:" + server.getPort().toString();
std::cout << "Server address: " << server_address << "\n";
Http::Client client;
Http::Experimental::Client client;
client.init();
std::vector<Async::Promise<Http::Response>> responses;
......@@ -184,11 +184,11 @@ TEST(http_client_test, multiple_clients_with_one_request)
std::cout << "Server address: " << server_address << "\n";
const int CLIENT_SIZE = 3;
Http::Client client1;
Http::Experimental::Client client1;
client1.init();
Http::Client client2;
Http::Experimental::Client client2;
client2.init();
Http::Client client3;
Http::Experimental::Client client3;
client3.init();
std::vector<Async::Promise<Http::Response>> responses;
......@@ -249,7 +249,7 @@ TEST(http_client_test, timeout_reject)
const std::string server_address = "localhost:" + server.getPort().toString();
std::cout << "Server address: " << server_address << "\n";
Http::Client client;
Http::Experimental::Client client;
client.init();
auto rb = client.get(server_address).timeout(std::chrono::milliseconds(1000));
......@@ -284,8 +284,8 @@ TEST(
const std::string server_address = "localhost:" + server.getPort().toString();
std::cout << "Server address: " << server_address << "\n";
Http::Client client;
auto opts = Http::Client::options().maxConnectionsPerHost(1).threads(2);
Http::Experimental::Client client;
auto opts = Http::Experimental::Client::options().maxConnectionsPerHost(1).threads(2);
client.init(opts);
std::vector<Async::Promise<Http::Response>> responses;
......@@ -333,8 +333,8 @@ TEST(
const std::string server_address = "localhost:" + server.getPort().toString();
std::cout << "Server address: " << server_address << "\n";
Http::Client client;
auto opts = Http::Client::options().maxConnectionsPerHost(2).threads(1);
Http::Experimental::Client client;
auto opts = Http::Experimental::Client::options().maxConnectionsPerHost(2).threads(1);
client.init(opts);
std::vector<Async::Promise<Http::Response>> responses;
......@@ -380,7 +380,7 @@ TEST(http_client_test, test_client_timeout)
const std::string server_address = "localhost:" + server.getPort().toString();
std::cout << "Server address: " << server_address << "\n";
Http::Client client;
Http::Experimental::Client client;
client.init();
std::vector<Async::Promise<Http::Response>> responses;
......@@ -441,7 +441,7 @@ TEST(http_client_test, client_sends_query)
const std::string server_address = "localhost:" + server.getPort().toString();
std::cout << "Server address: " << server_address << "\n";
Http::Client client;
Http::Experimental::Client client;
client.init();
std::string queryStr;
......@@ -513,8 +513,8 @@ TEST(http_client_test, client_get_large_content)
const std::string server_address = "localhost:" + server.getPort().toString();
std::cout << "Server address: " << server_address << "\n";
Http::Client client;
auto opts = Http::Client::options().maxResponseSize(8192);
Http::Experimental::Client client;
auto opts = Http::Experimental::Client::options().maxResponseSize(8192);
client.init(opts);
auto response = client.get(server_address).send();
......@@ -554,8 +554,8 @@ TEST(http_client_test, client_do_not_get_large_content)
const std::string server_address = "localhost:" + server.getPort().toString();
std::cout << "Server address: " << server_address << "\n";
Http::Client client;
auto opts = Http::Client::options().maxResponseSize(4096);
Http::Experimental::Client client;
auto opts = Http::Experimental::Client::options().maxResponseSize(4096);
client.init(opts);
auto response = client.get(server_address).send();
......
......@@ -194,7 +194,7 @@ struct PingHandler : public Http::Handler
int clientLogicFunc(size_t response_size, const std::string& server_page,
int timeout_seconds, int wait_seconds)
{
Http::Client client;
Http::Experimental::Client client;
client.init();
std::vector<Async::Promise<Http::Response>> responses;
......@@ -401,7 +401,7 @@ TEST(http_server_test, server_with_static_file)
const std::string server_address = "localhost:" + server.getPort().toString();
LOGGER("test", "Server address: " << server_address);
Http::Client client;
Http::Experimental::Client client;
client.init();
auto rb = client.get(server_address);
auto response = rb.send();
......@@ -443,7 +443,7 @@ TEST(http_server_test, server_request_copies_address)
const std::string server_address = "localhost:" + server.getPort().toString();
LOGGER("test", "Server address: " << server_address);
Http::Client client;
Http::Experimental::Client client;
client.init();
auto rb = client.get(server_address);
auto response = rb.send();
......@@ -511,7 +511,7 @@ TEST(http_server_test, response_size_captured)
// Use the built-in http client, but this test is interested in testing
// that the ResponseWriter in the server stashed the correct size and code
// values.
Http::Client client;
Http::Experimental::Client client;
client.init();
auto rb = client.get(server_address);
auto response = rb.send();
......
......@@ -49,8 +49,8 @@ void testRequestSizes(const std::string& url,
RequestSizeTestSets testResults;
std::mutex resultsetMutex;
Http::Client client;
auto client_opts = Http::Client::options().threads(3).maxConnectionsPerHost(3);
Http::Experimental::Client client;
auto client_opts = Http::Experimental::Client::options().threads(3).maxConnectionsPerHost(3);
client.init(client_opts);
std::vector<Async::Promise<Http::Response>> responses;
......
......@@ -40,7 +40,7 @@ struct HelloHandlerWithDelay : public Http::Handler
int clientLogicFunc(int response_size, const std::string& server_page,
int wait_seconds)
{
Http::Client client;
Http::Experimental::Client client;
client.init();
std::vector<Async::Promise<Http::Response>> responses;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment