diff --git a/client_http.hpp b/client_http.hpp index 24997e0..5e13252 100644 --- a/client_http.hpp +++ b/client_http.hpp @@ -10,6 +10,7 @@ #include #include #include +#include namespace SimpleWeb { template @@ -68,8 +69,8 @@ namespace SimpleWeb { auto corrected_path=path; if(corrected_path=="") corrected_path="/"; - if(!config.proxy_server.empty()) - corrected_path=protocol()+"://"+host+':'+std::to_string(port)+corrected_path; + if(!config.proxy_server.empty() && std::is_same::value) + corrected_path="http://"+host+':'+std::to_string(port)+corrected_path; boost::asio::streambuf write_buffer; std::ostream write_stream(&write_buffer); @@ -121,8 +122,8 @@ namespace SimpleWeb { auto corrected_path=path; if(corrected_path=="") corrected_path="/"; - if(!config.proxy_server.empty()) - corrected_path=protocol()+"://"+host+':'+std::to_string(port)+corrected_path; + if(!config.proxy_server.empty() && std::is_same::value) + corrected_path="http://"+host+':'+std::to_string(port)+corrected_path; content.seekp(0, std::ios::end); auto content_length=content.tellp(); @@ -199,7 +200,6 @@ namespace SimpleWeb { return parsed_host_port; } - virtual std::string protocol() const =0; virtual void connect()=0; std::shared_ptr get_timeout_timer() { @@ -366,10 +366,6 @@ namespace SimpleWeb { Client(const std::string& server_port_path) : ClientBase::ClientBase(server_port_path, 80) {} protected: - std::string protocol() const { - return "http"; - } - void connect() { if(!socket || !socket->is_open()) { std::unique_ptr query; diff --git a/client_https.hpp b/client_https.hpp index ec6ab15..bd67665 100644 --- a/client_https.hpp +++ b/client_https.hpp @@ -33,10 +33,6 @@ namespace SimpleWeb { protected: boost::asio::ssl::context context; - std::string protocol() const { - return "https"; - } - void connect() { if(!socket || !socket->lowest_layer().is_open()) { std::unique_ptr query; diff --git a/tests/parse_test.cpp b/tests/parse_test.cpp index d558da9..3eff774 100644 --- a/tests/parse_test.cpp +++ b/tests/parse_test.cpp @@ -48,10 +48,6 @@ class ClientTest : public ClientBase { public: ClientTest(const std::string& server_port_path) : ClientBase::ClientBase(server_port_path, 80) {} - std::string protocol() const { - return "http"; - } - void connect() {} bool constructor_parse_test1() {