Skip to content

Commit 71227af

Browse files
committed
Merge pull request #595 from deanberris/osx-fixes
Several fixes to address OS X breakage in master
2 parents 17de32d + 5531b2d commit 71227af

File tree

6 files changed

+29
-39
lines changed

6 files changed

+29
-39
lines changed

.ycm_extra_conf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
'-I', 'deps/googletest/googletest/include',
3535
'-I', 'deps/googletest/googlemock/include',
3636

37+
# add dependency to asio
38+
'-I', 'deps/asio/asio/include',
39+
3740
# Always enable debugging for the project when building for semantic
3841
# completion.
3942
'-DBOOST_NETWORK_DEBUG',

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ elseif (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
7979
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
8080
# Use libc++ only in OS X.
8181
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
82+
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lc++")
8283
endif()
8384
endif()
8485

boost/network/protocol/http/client/connection/async_base.hpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,13 @@ struct async_connection_base {
5050
typedef http_async_connection<Tag, version_major, version_minor>
5151
async_connection;
5252
typedef typename delegate_factory<Tag>::type delegate_factory_type;
53-
connection_ptr temp;
54-
temp.reset(new async_connection(
55-
resolver, resolve, follow_redirect, timeout,
56-
delegate_factory_type::new_connection_delegate(
57-
resolver.get_io_service(), https, always_verify_peer,
58-
certificate_filename, verify_path, certificate_file,
59-
private_key_file, ciphers, ssl_options)));
60-
BOOST_ASSERT(temp.get() != 0);
53+
auto delegate = delegate_factory_type::new_connection_delegate(
54+
resolver.get_io_service(), https, always_verify_peer,
55+
certificate_filename, verify_path, certificate_file, private_key_file,
56+
ciphers, ssl_options);
57+
auto temp = std::make_shared<async_connection>(
58+
resolver, resolve, follow_redirect, timeout, std::move(delegate));
59+
BOOST_ASSERT(temp != nullptr);
6160
return temp;
6261
}
6362

boost/network/protocol/http/client/connection/connection_delegate_factory.hpp

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ struct connection_delegate_factory {
3131
typedef std::shared_ptr<connection_delegate> connection_delegate_ptr;
3232
typedef typename string<Tag>::type string_type;
3333

34-
// This is the factory method that actually returns the delegate
35-
// instance.
34+
// This is the factory method that actually returns the delegate instance.
3635
// TODO(dberris): Support passing in proxy settings when crafting connections.
3736
static connection_delegate_ptr new_connection_delegate(
3837
asio::io_service& service, bool https, bool always_verify_peer,
@@ -43,27 +42,23 @@ struct connection_delegate_factory {
4342
connection_delegate_ptr delegate;
4443
if (https) {
4544
#ifdef BOOST_NETWORK_ENABLE_HTTPS
46-
delegate.reset(new ssl_delegate(
45+
delegate = std::make_shared<ssl_delegate>(
4746
service, always_verify_peer, certificate_filename, verify_path,
48-
certificate_file, private_key_file, ciphers, ssl_options));
47+
certificate_file, private_key_file, ciphers, ssl_options);
4948
#else
5049
BOOST_THROW_EXCEPTION(std::runtime_error("HTTPS not supported."));
5150
#endif /* BOOST_NETWORK_ENABLE_HTTPS */
5251
} else {
53-
delegate.reset(new normal_delegate(service));
52+
delegate = std::make_shared<normal_delegate>(service);
5453
}
5554
return delegate;
5655
}
5756
};
5857

5958
} // namespace impl
60-
/* impl */
61-
} // namespace http
62-
/* http */
63-
} // namespace network
64-
/* network */
65-
} // namespace boost
66-
/* boost */
59+
} // namespace http
60+
} // namespace network
61+
} // namespace boost
6762

6863
#endif /* BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_CONNECTION_DELEGATE_FACTORY_HPP_20110819 \
6964
*/

boost/network/protocol/http/client/connection/ssl_delegate.hpp

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ namespace network {
2222
namespace http {
2323
namespace impl {
2424

25-
struct ssl_delegate : connection_delegate,
26-
std::enable_shared_from_this<ssl_delegate> {
25+
struct ssl_delegate : public connection_delegate,
26+
public std::enable_shared_from_this<ssl_delegate> {
2727
ssl_delegate(asio::io_service &service, bool always_verify_peer,
2828
optional<std::string> certificate_filename,
2929
optional<std::string> verify_path,
@@ -32,14 +32,14 @@ struct ssl_delegate : connection_delegate,
3232
optional<std::string> ciphers, long ssl_options);
3333

3434
void connect(asio::ip::tcp::endpoint &endpoint, std::string host,
35-
std::uint16_t source_port,
36-
std::function<void(std::error_code const &)> handler) override;
37-
void write(asio::streambuf &command_streambuf,
38-
std::function<void(std::error_code const &, size_t)> handler)
39-
override;
40-
void read_some(asio::mutable_buffers_1 const &read_buffer,
41-
std::function<void(std::error_code const &, size_t)> handler)
42-
override;
35+
std::uint16_t source_port,
36+
std::function<void(std::error_code const &)> handler) override;
37+
void write(
38+
asio::streambuf &command_streambuf,
39+
std::function<void(std::error_code const &, size_t)> handler) override;
40+
void read_some(
41+
asio::mutable_buffers_1 const &read_buffer,
42+
std::function<void(std::error_code const &, size_t)> handler) override;
4343
void disconnect() override;
4444
~ssl_delegate() override;
4545

@@ -68,9 +68,4 @@ struct ssl_delegate : connection_delegate,
6868
} // namespace network
6969
} // namespace boost
7070

71-
#ifdef BOOST_NETWORK_NO_LIB
72-
#include <boost/network/protocol/http/client/connection/ssl_delegate.ipp>
73-
#endif /* BOOST_NETWORK_NO_LIB */
74-
75-
#endif /* BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_CONNECTION_SSL_DELEGATE_20110819 \
76-
*/
71+
#endif // BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_CONNECTION_SSL_DELEGATE_20110819

libs/network/src/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ set_target_properties(cppnetlib-client-connections
4444
if (OPENSSL_FOUND)
4545
target_link_libraries(cppnetlib-client-connections ${OPENSSL_LIBRARIES})
4646
endif ()
47-
if (Boost_FOUND)
48-
target_link_libraries(cppnetlib-client-connections)
49-
endif ()
5047
install(TARGETS cppnetlib-client-connections
5148
EXPORT cppnetlibTargets
5249
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}

0 commit comments

Comments
 (0)