Added proxy server support to Client. Based on #83
This commit is contained in:
parent
59bf48b37f
commit
9d9a8622d5
3 changed files with 61 additions and 17 deletions
|
|
@ -33,9 +33,23 @@ namespace SimpleWeb {
|
|||
protected:
|
||||
boost::asio::ssl::context context;
|
||||
|
||||
std::string protocol() {
|
||||
return "https";
|
||||
}
|
||||
|
||||
void connect() {
|
||||
if(!socket || !socket->lowest_layer().is_open()) {
|
||||
boost::asio::ip::tcp::resolver::query query(host, std::to_string(port));
|
||||
std::string host, port;
|
||||
if(config.proxy_server.empty()) {
|
||||
host=this->host;
|
||||
port=std::to_string(this->port);
|
||||
}
|
||||
else {
|
||||
auto proxy_host_port=parse_host_port(config.proxy_server, 0);
|
||||
host=proxy_host_port.first;
|
||||
port=std::to_string(proxy_host_port.second);
|
||||
}
|
||||
boost::asio::ip::tcp::resolver::query query(host, port);
|
||||
|
||||
resolver.async_resolve(query, [this]
|
||||
(const boost::system::error_code &ec, boost::asio::ip::tcp::resolver::iterator it){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue