diff options
author | Mauro Sardara <msardara+fdio@cisco.com> | 2018-02-16 17:22:53 +0100 |
---|---|---|
committer | Mauro Sardara <msardara+fdio@cisco.com> | 2018-02-16 17:22:53 +0100 |
commit | 953f18b834951680c738e9ce367b5a3eff91ccda (patch) | |
tree | 52bc181e53b9c76db1e14e693f473ca8cfca7250 /icnet/http/icnet_http_client_connection.h | |
parent | c5e952d1cadbdf85c976e88ba97ea8bee7e422ab (diff) |
Improvements for HTTP messages processing
Change-Id: Iefcbfa1820bd47fd52475780c68c363a2baa2568
Signed-off-by: Mauro Sardara <msardara+fdio@cisco.com>
Diffstat (limited to 'icnet/http/icnet_http_client_connection.h')
-rw-r--r-- | icnet/http/icnet_http_client_connection.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/icnet/http/icnet_http_client_connection.h b/icnet/http/icnet_http_client_connection.h index 41a2a4f9..ae52aa3e 100644 --- a/icnet/http/icnet_http_client_connection.h +++ b/icnet/http/icnet_http_client_connection.h @@ -19,9 +19,11 @@ #include "icnet_transport_socket_producer.h" #include "icnet_utils_uri.h" #include "icnet_http_request.h" +#include "icnet_http_response.h" #include "icnet_http_default_values.h" #include <vector> +#include <boost/asio/steady_timer.hpp> #define HTTP_VERSION "1.0" @@ -33,7 +35,9 @@ class HTTPClientConnection { public: HTTPClientConnection(); - HTTPClientConnection &get(std::string &url, HTTPHeaders headers = {}, HTTPPayload payload = {}); + HTTPClientConnection &get(const std::string &url, + HTTPHeaders headers = {}, + HTTPPayload payload = {}); HTTPResponse &&response(); @@ -41,16 +45,19 @@ class HTTPClientConnection { transport::ConsumerSocket &getConsumer(); + void setTimeout(const std::chrono::seconds &timeout); + private: - void processPayload(transport::ConsumerSocket &c, std::vector<uint8_t> &&payload); + void processPayload(transport::ConsumerSocket &c, std::vector<uint8_t> &&response); bool verifyData(transport::ConsumerSocket &c, const transport::ContentObject &contentObject); void processLeavingInterest(transport::ConsumerSocket &c, const transport::Interest &interest, std::string &payload); - HTTPResponse response_; + std::shared_ptr<HTTPResponse> response_; transport::ConsumerSocket consumer_; + std::unique_ptr<boost::asio::steady_timer> timer_; }; } // end namespace http |