Skip to content

Several fixes to address OS X breakage in master #595

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 8, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Use std::shared_ptr properly for libc++ compatibility
  • Loading branch information
deanberris committed Feb 8, 2016
commit 5531b2d4dbcbf78116003b0fd7e8b0965d197050
15 changes: 7 additions & 8 deletions boost/network/protocol/http/client/connection/async_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,13 @@ struct async_connection_base {
typedef http_async_connection<Tag, version_major, version_minor>
async_connection;
typedef typename delegate_factory<Tag>::type delegate_factory_type;
connection_ptr temp;
temp.reset(new async_connection(
resolver, resolve, follow_redirect, timeout,
delegate_factory_type::new_connection_delegate(
resolver.get_io_service(), https, always_verify_peer,
certificate_filename, verify_path, certificate_file,
private_key_file, ciphers, ssl_options)));
BOOST_ASSERT(temp.get() != 0);
auto delegate = delegate_factory_type::new_connection_delegate(
resolver.get_io_service(), https, always_verify_peer,
certificate_filename, verify_path, certificate_file, private_key_file,
ciphers, ssl_options);
auto temp = std::make_shared<async_connection>(
resolver, resolve, follow_redirect, timeout, std::move(delegate));
BOOST_ASSERT(temp != nullptr);
return temp;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ struct connection_delegate_factory {
typedef std::shared_ptr<connection_delegate> connection_delegate_ptr;
typedef typename string<Tag>::type string_type;

// This is the factory method that actually returns the delegate
// instance.
// This is the factory method that actually returns the delegate instance.
// TODO(dberris): Support passing in proxy settings when crafting connections.
static connection_delegate_ptr new_connection_delegate(
asio::io_service& service, bool https, bool always_verify_peer,
Expand All @@ -43,27 +42,23 @@ struct connection_delegate_factory {
connection_delegate_ptr delegate;
if (https) {
#ifdef BOOST_NETWORK_ENABLE_HTTPS
delegate.reset(new ssl_delegate(
delegate = std::make_shared<ssl_delegate>(
service, always_verify_peer, certificate_filename, verify_path,
certificate_file, private_key_file, ciphers, ssl_options));
certificate_file, private_key_file, ciphers, ssl_options);
#else
BOOST_THROW_EXCEPTION(std::runtime_error("HTTPS not supported."));
#endif /* BOOST_NETWORK_ENABLE_HTTPS */
} else {
delegate.reset(new normal_delegate(service));
delegate = std::make_shared<normal_delegate>(service);
}
return delegate;
}
};

} // namespace impl
/* impl */
} // namespace http
/* http */
} // namespace network
/* network */
} // namespace boost
/* boost */
} // namespace http
} // namespace network
} // namespace boost

#endif /* BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_CONNECTION_DELEGATE_FACTORY_HPP_20110819 \
*/
27 changes: 11 additions & 16 deletions boost/network/protocol/http/client/connection/ssl_delegate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ namespace network {
namespace http {
namespace impl {

struct ssl_delegate : connection_delegate,
std::enable_shared_from_this<ssl_delegate> {
struct ssl_delegate : public connection_delegate,
public std::enable_shared_from_this<ssl_delegate> {
ssl_delegate(asio::io_service &service, bool always_verify_peer,
optional<std::string> certificate_filename,
optional<std::string> verify_path,
Expand All @@ -32,14 +32,14 @@ struct ssl_delegate : connection_delegate,
optional<std::string> ciphers, long ssl_options);

void connect(asio::ip::tcp::endpoint &endpoint, std::string host,
std::uint16_t source_port,
std::function<void(std::error_code const &)> handler) override;
void write(asio::streambuf &command_streambuf,
std::function<void(std::error_code const &, size_t)> handler)
override;
void read_some(asio::mutable_buffers_1 const &read_buffer,
std::function<void(std::error_code const &, size_t)> handler)
override;
std::uint16_t source_port,
std::function<void(std::error_code const &)> handler) override;
void write(
asio::streambuf &command_streambuf,
std::function<void(std::error_code const &, size_t)> handler) override;
void read_some(
asio::mutable_buffers_1 const &read_buffer,
std::function<void(std::error_code const &, size_t)> handler) override;
void disconnect() override;
~ssl_delegate() override;

Expand Down Expand Up @@ -68,9 +68,4 @@ struct ssl_delegate : connection_delegate,
} // namespace network
} // namespace boost

#ifdef BOOST_NETWORK_NO_LIB
#include <boost/network/protocol/http/client/connection/ssl_delegate.ipp>
#endif /* BOOST_NETWORK_NO_LIB */

#endif /* BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_CONNECTION_SSL_DELEGATE_20110819 \
*/
#endif // BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_CONNECTION_SSL_DELEGATE_20110819