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

Commita97ab01

Browse files
authored
Merge pull request#679 from vovams/0.13-release-integration
Fix#677 in 0.13: Exception in async_server_base/async_connection during port scanning (nmap)
2 parents87dd551 +524b999 commita97ab01

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

‎boost/network/protocol/http/server/async_connection.hpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -462,11 +462,18 @@ struct async_connection
462462
enumstate_t { method, uri, version, headers };
463463

464464
voidstart() {
465-
typename ostringstream<Tag>::type ip_stream;
466-
ip_stream << socket_.remote_endpoint().address().to_string() <<':'
467-
<< socket_.remote_endpoint().port();
468-
request_.source = ip_stream.str();
469-
read_more(method);
465+
boost::system::error_code ec;
466+
auto remote_endpoint = socket_.remote_endpoint(ec);
467+
468+
if (ec) {
469+
error_encountered = in_place<boost::system::system_error>(ec);
470+
}else {
471+
typename ostringstream<Tag>::type ip_stream;
472+
ip_stream << remote_endpoint.address().to_string() <<':'
473+
<< remote_endpoint.port();
474+
request_.source = ip_stream.str();
475+
read_more(method);
476+
}
470477
}
471478

472479
voidread_more(state_t state) {

‎boost/network/protocol/stream_handler.hpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,21 @@ struct stream_handler {
103103
}
104104
}
105105

106-
tcp_socket::endpoint_typeremote_endpoint()const {
106+
tcp_socket::endpoint_typeremote_endpoint(boost::system::error_code& ec)const {
107107
if (ssl_enabled) {
108-
return ssl_sock_->next_layer().remote_endpoint();
108+
return ssl_sock_->next_layer().remote_endpoint(ec);
109109
}else {
110-
return tcp_sock_->remote_endpoint();
110+
return tcp_sock_->remote_endpoint(ec);
111+
}
112+
}
113+
114+
tcp_socket::endpoint_typeremote_endpoint()const {
115+
boost::system::error_code ec;
116+
tcp_socket::endpoint_type r =remote_endpoint(ec);
117+
if (ec) {
118+
boost::asio::detail::throw_error(ec,"remote_endpoint");
111119
}
120+
return r;
112121
}
113122

114123
voidshutdown(boost::asio::socket_base::shutdown_type st,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp