diff options
Diffstat (limited to 'include/tgbot/net/HttpClient.h')
-rw-r--r-- | include/tgbot/net/HttpClient.h | 69 |
1 files changed, 2 insertions, 67 deletions
diff --git a/include/tgbot/net/HttpClient.h b/include/tgbot/net/HttpClient.h index 4378623..62b1875 100644 --- a/include/tgbot/net/HttpClient.h +++ b/include/tgbot/net/HttpClient.h @@ -1,4 +1,4 @@ -/* + /* * Copyright (c) 2015 Oleg Morozenkov * Copyright (c) 2018 Egor Pugin * @@ -26,14 +26,8 @@ #include <string> -#include <boost/asio.hpp> -#ifdef HAVE_CURL -#include <curl/curl.h> -#endif - #include "tgbot/net/Url.h" #include "tgbot/net/HttpReqArg.h" -#include "tgbot/net/HttpParser.h" namespace TgBot { @@ -56,66 +50,7 @@ public: virtual std::string makeRequest(const Url& url, const std::vector<HttpReqArg>& args) const = 0; }; -/** - * @brief This class makes http requests via boost::asio. - * - * @ingroup net - */ -class BoostHttpClient : public HttpClient { - -public: - /** - * @brief Returns instance which lives during all application lifetime. - */ - static BoostHttpClient& getInstance(); - - /** - * @brief Sends a request to the url. - * - * If there's no args specified, a GET request will be sent, otherwise a POST request will be sent. - * If at least 1 arg is marked as file, the content type of a request will be multipart/form-data, otherwise it will be application/x-www-form-urlencoded. - */ - std::string makeRequest(const Url& url, const std::vector<HttpReqArg>& args) const override; - -private: - mutable boost::asio::io_service _ioService; -}; - -#ifdef HAVE_CURL - -/** - * @brief This class makes http requests via libcurl. - * - * @ingroup net - */ -class CurlHttpClient : public HttpClient { - -public: - - /** - * @brief Raw curl settings storage for fine tuning. - */ - CURL* curlSettings; - - CurlHttpClient(); - ~CurlHttpClient(); - - /** - * @brief Returns instance which lives during all application lifetime. - */ - static CurlHttpClient& getInstance(); - - /** - * @brief Sends a request to the url. - * - * If there's no args specified, a GET request will be sent, otherwise a POST request will be sent. - * If at least 1 arg is marked as file, the content type of a request will be multipart/form-data, otherwise it will be application/x-www-form-urlencoded. - */ - std::string makeRequest(const Url& url, const std::vector<HttpReqArg>& args) const override; -}; - -#endif - } + #endif //TGBOT_HTTPCLIENT_H |