Commit a7a312e5 authored by octal's avatar octal

Client is not experimental anymore

parent 62323ae4
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "client.h" #include "client.h"
using namespace Net; using namespace Net;
using namespace Net::Http;
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
if (argc < 1) { if (argc < 1) {
...@@ -23,14 +22,14 @@ int main(int argc, char *argv[]) { ...@@ -23,14 +22,14 @@ int main(int argc, char *argv[]) {
count = std::stoi(argv[2]); count = std::stoi(argv[2]);
} }
Experimental::Client client; Http::Client client;
auto opts = Http::Experimental::Client::options() auto opts = Http::Client::options()
.threads(1) .threads(1)
.maxConnectionsPerHost(8); .maxConnectionsPerHost(8);
client.init(opts); client.init(opts);
std::vector<Async::Promise<Response>> responses; std::vector<Async::Promise<Http::Response>> responses;
std::atomic<size_t> completedRequests(0); std::atomic<size_t> completedRequests(0);
std::atomic<size_t> failedRequests(0); std::atomic<size_t> failedRequests(0);
...@@ -38,8 +37,8 @@ int main(int argc, char *argv[]) { ...@@ -38,8 +37,8 @@ int main(int argc, char *argv[]) {
auto start = std::chrono::system_clock::now(); auto start = std::chrono::system_clock::now();
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
auto resp = client.get(page).cookie(Cookie("FOO", "bar")).send(); auto resp = client.get(page).cookie(Http::Cookie("FOO", "bar")).send();
resp.then([&](Response response) { resp.then([&](Http::Response response) {
++completedRequests; ++completedRequests;
std::cout << "Response code = " << response.code() << std::endl; std::cout << "Response code = " << response.code() << std::endl;
auto body = response.body(); auto body = response.body();
...@@ -50,12 +49,12 @@ int main(int argc, char *argv[]) { ...@@ -50,12 +49,12 @@ int main(int argc, char *argv[]) {
} }
auto sync = Async::whenAll(responses.begin(), responses.end()); auto sync = Async::whenAll(responses.begin(), responses.end());
Async::Barrier<std::vector<Response>> barrier(sync); Async::Barrier<std::vector<Http::Response>> barrier(sync);
barrier.wait_for(std::chrono::seconds(5)); barrier.wait_for(std::chrono::seconds(5));
auto end = std::chrono::system_clock::now(); auto end = std::chrono::system_clock::now();
std::cout << "Summary of excution" << std::endl std::cout << "Summary of execution" << std::endl
<< "Total number of requests sent : " << count << std::endl << "Total number of requests sent : " << count << std::endl
<< "Total number of responses received: " << completedRequests.load() << std::endl << "Total number of responses received: " << completedRequests.load() << std::endl
<< "Total number of requests failed : " << failedRequests.load() << std::endl << "Total number of requests failed : " << failedRequests.load() << std::endl
......
...@@ -20,8 +20,6 @@ namespace Net { ...@@ -20,8 +20,6 @@ namespace Net {
namespace Http { namespace Http {
namespace Experimental {
class ConnectionPool; class ConnectionPool;
class Transport; class Transport;
...@@ -353,8 +351,6 @@ private: ...@@ -353,8 +351,6 @@ private:
}; };
} // namespace Experimental
} // namespace Http } // namespace Http
} // namespace Net } // namespace Net
......
...@@ -52,11 +52,6 @@ namespace Private { ...@@ -52,11 +52,6 @@ namespace Private {
class BodyStep; class BodyStep;
} }
namespace Experimental {
class Client;
class RequestBuilder;
}
template< class CharT, class Traits> template< class CharT, class Traits>
std::basic_ostream<CharT, Traits>& crlf(std::basic_ostream<CharT, Traits>& os) { std::basic_ostream<CharT, Traits>& crlf(std::basic_ostream<CharT, Traits>& os) {
static constexpr char CRLF[] = {0xD, 0xA}; static constexpr char CRLF[] = {0xD, 0xA};
...@@ -118,9 +113,9 @@ public: ...@@ -118,9 +113,9 @@ public:
friend class Private::RequestLineStep; friend class Private::RequestLineStep;
friend class Private::Parser<Http::Request>; friend class Private::Parser<Http::Request>;
friend class Experimental::RequestBuilder; friend class RequestBuilder;
// @Todo: try to remove the need for friend-ness here // @Todo: try to remove the need for friend-ness here
friend class Experimental::Client; friend class Client;
Request(const Request& other) = default; Request(const Request& other) = default;
Request& operator=(const Request& other) = default; Request& operator=(const Request& other) = default;
......
...@@ -30,8 +30,6 @@ namespace { ...@@ -30,8 +30,6 @@ namespace {
} }
} }
namespace Experimental {
static constexpr const char* UA = "pistache/0.1"; static constexpr const char* UA = "pistache/0.1";
std::pair<StringView, StringView> std::pair<StringView, StringView>
...@@ -864,8 +862,6 @@ Client::processRequestQueue() { ...@@ -864,8 +862,6 @@ Client::processRequestQueue() {
} }
} }
} // namespace Experimental
} // namespace Http } // namespace Http
} // namespace Net } // namespace Net
...@@ -25,7 +25,3 @@ add_test( cookie_test run_cookie_test ) ...@@ -25,7 +25,3 @@ add_test( cookie_test run_cookie_test )
add_executable( run_view_test view_test.cc ) add_executable( run_view_test view_test.cc )
target_link_libraries(run_view_test gtest gtest_main net) target_link_libraries(run_view_test gtest gtest_main net)
add_test( view_test run_view_test ) add_test( view_test run_view_test )
add_executable( run_client_test http_client_test.cc )
target_link_libraries(run_client_test gtest gtest_main net)
add_test( client_test run_client_test )
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