connection_ptr get_connection(resolver_type & resolver, basic_request<Tag> const & request_, optional<string_type> const & certificate_filename = optional<string_type>(), optional<string_type> const & verify_path = optional<string_type>()) { string_type index = (request_.host() + ':') + lexical_cast<string_type>(request_.port()); connection_ptr connection_; typename host_connection_map::iterator it = host_connections.find(index); if (it == host_connections.end()) { connection_.reset(new connection_impl( resolver , follow_redirect_ , request_.host() , lexical_cast<string_type>(request_.port()) , boost::bind( &pooled_connection_policy<Tag,version_major,version_minor>::resolve, this, _1, _2, _3 ) , boost::bind( &pooled_connection_policy<Tag,version_major,version_minor>::get_connection, this, _1, _2, _3, _4 ) , boost::iequals(request_.protocol(), string_type("https")) , certificate_filename , verify_path ) ); host_connections.insert(std::make_pair(index, connection_)); return connection_; } return it->second; }
connection_ptr get_connection(resolver_type & resolver, basic_request<Tag> const & request_) { connection_ptr connection_( new connection_impl( resolver , follow_redirect_ , request_.host() , lexical_cast<string_type>(request_.port()) , boost::bind( &simple_connection_policy<Tag,version_major,version_minor>::resolve, this, _1, _2, _3 ) , boost::iequals(request_.protocol(), string_type("https")) ) ); return connection_; }
connection_ptr get_connection( resolver_type& resolver, basic_request<Tag> const& request_, bool always_verify_peer, optional<string_type> /*unused*/ const& certificate_filename = optional<string_type>(), optional<string_type> const& verify_path = optional<string_type>(), optional<string_type> const& certificate_file = optional<string_type>(), optional<string_type> const& private_key_file = optional<string_type>(), optional<string_type> const& ciphers = optional<string_type>(), long ssl_options = 0) { namespace ph = std::placeholders; connection_ptr connection_(new connection_impl( resolver, follow_redirect_, always_verify_peer, request_.host(), std::to_string(request_.port()), [this](resolver_type& resolver, string_type const& host, std::uint16_t port, resolver_completion_function once_resolved) { this->resolve(resolver, host, port, once_resolved); }, boost::iequals(request_.protocol(), string_type("https")), timeout_, certificate_filename, verify_path, certificate_file, private_key_file, ciphers, ssl_options)); return connection_; }