Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0dc7308

Browse files
deanberristorbjoernk
authored andcommitted
Remove boost::bind/shared_ptr from client
From here on out only use the standard-provided shared pointerimplementations. Also use the native C++11 features for deleting specialmember implementations.
1 parent7af8275 commit0dc7308

File tree

6 files changed

+13
-17
lines changed

6 files changed

+13
-17
lines changed

‎http/src/network/protocol/http/client/connection/async_normal.ipp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,19 +246,18 @@ struct http_async_connection_pimpl
246246
boost::system::error_codeconst& ec,
247247
std::size_t bytes_transferred) {
248248
NETWORK_MESSAGE("http_async_connection_pimpl::handle_received_data(...)");
249+
#ifdef NETWORK_ENABLE_HTTPS
249250
// Okay, there's some weirdness with Boost.Asio's handling of SSL errors
250251
// so we need to do some acrobatics to make sure that we're handling the
251252
// short-read errors correctly. This is such a PITA that we have to deal
252253
// with this here.
253-
staticlong short_read_error =335544539;
254+
constexprstaticlong short_read_error =335544539;
254255
bool is_short_read_error =
255-
#ifdef NETWORK_ENABLE_HTTPS
256-
ec.category() == boost::asio::error::ssl_category &&
257-
ec.value() == short_read_error
256+
(ec.category() == boost::asio::error::ssl_category) &&
257+
(ec.value() == short_read_error);
258258
#else
259-
false
259+
constexprbool is_short_read_error =false;
260260
#endif
261-
;
262261
if (!ec || ec == boost::asio::error::eof || is_short_read_error) {
263262
NETWORK_MESSAGE("processing data chunk, no error encountered so far...");
264263
boost::logic::tribool parsed_ok;

‎http/src/network/protocol/http/client/connection/connection_delegate_factory.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ struct connection_delegate_factory {
3030
virtual~connection_delegate_factory();
3131

3232
private:
33-
connection_delegate_factory(connection_delegate_factoryconst&);// = delete
34-
connection_delegate_factory&operator=(
35-
connection_delegate_factory);// = delete
33+
connection_delegate_factory(connection_delegate_factoryconst &) =delete;
34+
connection_delegate_factory &operator=(connection_delegate_factory) =delete;
3635
};
3736

3837
}// namespace http

‎http/src/network/protocol/http/client/connection/connection_delegate_factory.ipp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ connection_delegate_factory::connection_delegate_ptr connection_delegate_factory
3333
if (https) {
3434
#ifdef NETWORK_ENABLE_HTTPS
3535
NETWORK_MESSAGE("creating an SSL delegate");
36-
delegate.reset(newssl_delegate(service, options));
36+
std::shared_ptr<ssl_delegate>delegate_ptr(newssl_delegate(service, options));
37+
delegate =std::move(delegate_ptr);
3738
#else
3839
NETWORK_MESSAGE("creating an SSL delegate, but not supported");
3940
BOOST_THROW_EXCEPTION(std::runtime_error("HTTPS not supported."));

‎http/src/network/protocol/http/client/connection/normal_delegate.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ struct normal_delegate : connection_delegate {
4141
boost::asio::io_service& service_;
4242
std::unique_ptr<boost::asio::ip::tcp::socket> socket_;
4343

44-
normal_delegate(normal_delegateconst&);//= delete
45-
normal_delegate&operator=(normal_delegate);//= delete
44+
normal_delegate(normal_delegateconst&)=delete;
45+
normal_delegate&operator=(normal_delegate)=delete;
4646
};
4747

4848
}// namespace http

‎http/src/network/protocol/http/client/connection/ssl_delegate.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#include<boost/asio/ssl.hpp>
1212
#include<network/protocol/http/client/connection/connection_delegate.hpp>
1313
#include<network/protocol/http/client/options.hpp>
14-
#include<boost/enable_shared_from_this.hpp>
1514

1615
namespaceboost {
1716
namespaceasio {
@@ -23,7 +22,7 @@ namespace network {
2322
namespacehttp {
2423

2524
structssl_delegate : connection_delegate,
26-
boost::enable_shared_from_this<ssl_delegate> {
25+
std::enable_shared_from_this<ssl_delegate> {
2726
ssl_delegate(boost::asio::io_service& service, client_optionsconst& options);
2827

2928
virtualvoidconnect(

‎http/src/network/protocol/http/client/connection/ssl_delegate.ipp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include<network/protocol/http/client/options.hpp>
1111
#include<network/protocol/http/client/connection/ssl_delegate.hpp>
1212
#include<boost/asio/placeholders.hpp>
13-
#include<functional>
1413
#include<network/detail/debug.hpp>
1514

1615
network::http::ssl_delegate::ssl_delegate(boost::asio::io_service& service,
@@ -48,8 +47,7 @@ void network::http::ssl_delegate::connect(
4847
}else {
4948
NETWORK_MESSAGE("not verifying peer");
5049
context_->set_default_verify_paths();
51-
context_->set_verify_mode(boost::asio::ssl::context::verify_peer);
52-
context_->set_verify_callback(boost::asio::ssl::rfc2818_verification(host));
50+
context_->set_verify_mode(boost::asio::ssl::context::verify_none);
5351
}
5452
socket_.reset(new boost::asio::ssl::stream<
5553
boost::asio::ip::tcp::socket>(service_, *context_));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp