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

Commit335dd84

Browse files
committed
WIP: Tons of logging, improving build times.
I've reorganized a few things trying to hunt down why certain thingsaren't happening as expected. I'm committing so that I can try and mergefrom cpp-netlib/cpp-netlib:master to catch what Glyn has pushed with theURI implementation. There's a few issues with trying to get the host andother parts of the message through the wrappers and I'm trying a mergeto figure out if this has been fixed.
1 parentfcf4888 commit335dd84

File tree

33 files changed

+270
-114
lines changed

33 files changed

+270
-114
lines changed

‎boost/network/include/http/client.hpp‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
// This is the modular include file for using the HTTP Client
1010

1111
#include<boost/network/protocol/http/client.hpp>
12+
#include<boost/network/message/wrappers.hpp>
13+
#include<boost/network/protocol/http/message/directives.hpp>
14+
#include<boost/network/protocol/http/message/modifiers.hpp>
15+
#include<boost/network/protocol/http/message/wrappers.hpp>
16+
#include<boost/network/message/directives.hpp>
17+
#include<boost/network/message/transformers.hpp>
1218

1319
#endif// BOOST_NETWORK_INCLUDE_HTTP_CLIENT_HPP_
1420

‎boost/network/protocol/http/client.ipp‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,20 @@
99

1010
#include<boost/network/protocol/http/client.hpp>
1111
#include<boost/network/protocol/http/client/options.hpp>
12+
#include<boost/network/detail/debug.hpp>
1213

1314
namespaceboost {namespacenetwork {namespacehttp {
1415

1516
client::client()
16-
: base_facade_type()
17-
{}
17+
: base_facade_type() {
18+
BOOST_NETWORK_MESSAGE("client::client()");
19+
}
1820

1921
client::client(client_optionsconst &options)
2022
: base_facade_type(options)
21-
{}
23+
{
24+
BOOST_NETWORK_MESSAGE("client::client(client_options const &)");
25+
}
2226

2327
}// namespace http
2428
}// namespace network

‎boost/network/protocol/http/client/base.ipp‎

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include<boost/network/protocol/http/client/connection_manager.hpp>
1717
#include<boost/network/protocol/http/client/simple_connection_manager.hpp>
1818
#include<boost/network/protocol/http/request.hpp>
19+
#include<boost/network/detail/debug.hpp>
1920

2021
namespaceboost {namespacenetwork {namespacehttp {
2122

@@ -41,12 +42,14 @@ struct client_base_pimpl {
4142
};
4243

4344
client_base::client_base()
44-
: pimpl(new (std::nothrow) client_base_pimpl(client_options()))
45-
{}
45+
: pimpl(new (std::nothrow) client_base_pimpl(client_options())) {
46+
BOOST_NETWORK_MESSAGE("client_base::client_base()");
47+
}
4648

4749
client_base::client_base(client_optionsconst &options)
48-
: pimpl(new (std::nothrow) client_base_pimpl(options))
49-
{}
50+
: pimpl(new (std::nothrow) client_base_pimpl(options)) {
51+
BOOST_NETWORK_MESSAGE("client_base::client_base(client_options const &)");
52+
}
5053

5154
voidclient_base::clear_resolved_cache() {
5255
pimpl->clear_resolved_cache();
@@ -57,10 +60,12 @@ response const client_base::request_skeleton(request const & request_,
5760
bool get_body,
5861
body_callback_function_type callback,
5962
request_optionsconst &options) {
63+
BOOST_NETWORK_MESSAGE("client_base::request_skeleton(...)");
6064
return pimpl->request_skeleton(request_, method, get_body, callback, options);
6165
}
6266

6367
client_base::~client_base() {
68+
BOOST_NETWORK_MESSAGE("client_base::~client_base()");
6469
delete pimpl;
6570
}
6671

@@ -70,13 +75,17 @@ client_base_pimpl::client_base_pimpl(client_options const &options)
7075
sentinel_(),
7176
connection_manager_(options.connection_manager()),
7277
owned_service_(false) {
78+
BOOST_NETWORK_MESSAGE("client_base_pimpl::client_base_pimpl(client_options const &)");
7379
if (service_ptr ==0) {
80+
BOOST_NETWORK_MESSAGE("creating owned io_service.");
7481
service_ptr =new(std::nothrow) asio::io_service;
7582
owned_service_ =true;
7683
}
77-
if (!connection_manager_.get())
84+
if (!connection_manager_.get()) {
85+
BOOST_NETWORK_MESSAGE("creating owned simple_connection_manager");
7886
connection_manager_.reset(
7987
new (std::nothrow)simple_connection_manager(options));
88+
}
8089
sentinel_.reset(new (std::nothrow)boost::asio::io_service::work(*service_ptr));
8190
lifetime_thread_.reset(new (std::nothrow)boost::thread(
8291
boost::bind(
@@ -89,6 +98,7 @@ client_base_pimpl::client_base_pimpl(client_options const &options)
8998

9099
client_base_pimpl::~client_base_pimpl()
91100
{
101+
BOOST_NETWORK_MESSAGE("client_base_pimpl::~client_base_pimpl()");
92102
sentinel_.reset();
93103
connection_manager_->reset();
94104
if (lifetime_thread_.get()) {
@@ -106,12 +116,14 @@ response const client_base_pimpl::request_skeleton(
106116
request_optionsconst &options
107117
)
108118
{
119+
BOOST_NETWORK_MESSAGE("client_base_pimpl::request_skeleton(...)");
109120
shared_ptr<client_connection> connection_;
110121
connection_ = connection_manager_->get_connection(*service_ptr, request_, options_);
111122
return connection_->send_request(method, request_, get_body, callback, options);
112123
}
113124

114125
voidclient_base_pimpl::clear_resolved_cache() {
126+
BOOST_NETWORK_MESSAGE("client_base_pimpl::clear_resolved_cache()");
115127
connection_manager_->clear_resolved_cache();
116128
}
117129

‎boost/network/protocol/http/client/client_connection.hpp‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
#include<boost/function.hpp>
1111
#include<boost/range/iterator_range.hpp>
1212
#include<boost/system/error_code.hpp>
13-
#include<boost/network/protocol/http/request.hpp>
14-
#include<boost/network/protocol/http/response.hpp>
1513

1614
namespaceboost {namespacenetwork {namespacehttp {
1715

16+
structrequest;
17+
structresponse;
18+
1819
classrequest_options;
1920

2021
structclient_connection {

‎boost/network/protocol/http/client/client_connection.ipp‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@
99

1010
#include<boost/network/protocol/http/client/client_connection.hpp>
1111
#include<boost/assert.hpp>
12+
#include<boost/network/detail/debug.hpp>
1213

1314
namespaceboost {namespacenetwork {namespacehttp {
1415

1516
client_connection::~client_connection() {
17+
BOOST_NETWORK_MESSAGE("client_connection::~client_connection()");
1618
// Do nothing here.
1719
}
1820

1921
client_connection *client_connection::clone()const {
22+
BOOST_NETWORK_MESSAGE("client_connection::clone()");
2023
// For exposition only.
2124
BOOST_ASSERT(false &&"This should not ever be called.");
2225
}

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

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ struct http_async_connection_pimpl : boost::enable_shared_from_this<http_async_c
3535
follow_redirect_(follow_redirect),
3636
request_strand_(io_service),
3737
resolver_delegate_(resolver_delegate),
38-
connection_delegate_(connection_delegate) {}
38+
connection_delegate_(connection_delegate) {
39+
BOOST_NETWORK_MESSAGE("http_async_connection_pimpl::http_async_connection_pimpl(...)");
40+
}
3941

4042
// This is the main entry point for the connection/request pipeline. We're
4143
// overriding async_connection_base<...>::start(...) here which is called
@@ -45,15 +47,25 @@ struct http_async_connection_pimpl : boost::enable_shared_from_this<http_async_c
4547
bool get_body,
4648
body_callback_function_type callback,
4749
request_optionsconst &options) {
50+
BOOST_NETWORK_MESSAGE("http_async_connection_pimpl::start(...)");
4851
response response_;
4952
this->init_response(response_);
5053
// Use HTTP/1.1 -- at some point we might want to implement a different
5154
// connection type just for HTTP/1.0.
5255
// TODO: Implement a different connection type and factory for HTTP/1.0.
5356
linearize(request, method,1,1,
5457
std::ostreambuf_iterator<char>(&command_streambuf));
58+
#ifdef BOOST_NETWORK_DEBUG
59+
{
60+
std::ostringstream linearized;
61+
linearized << &command_streambuf;
62+
BOOST_NETWORK_MESSAGE("linearized request: ['" << linearized.str() <<"']");
63+
}
64+
#endif
5565
this->method = method;
66+
BOOST_NETWORK_MESSAGE("method:" <<this->method);
5667
boost::uint16_t port_ =port(request);
68+
BOOST_NETWORK_MESSAGE("port:" << port_);
5769
resolver_delegate_->resolve(
5870
host(request),
5971
port_,
@@ -70,6 +82,7 @@ struct http_async_connection_pimpl : boost::enable_shared_from_this<http_async_c
7082
}
7183

7284
http_async_connection_pimpl *clone() {
85+
BOOST_NETWORK_MESSAGE("http_async_connection_pimpl::clone()");
7386
returnnew (std::nothrow)http_async_connection_pimpl(
7487
this->resolver_delegate_,
7588
this->connection_delegate_,
@@ -86,16 +99,20 @@ struct http_async_connection_pimpl : boost::enable_shared_from_this<http_async_c
8699
http_async_connection_pimpl(http_async_connection_pimplconst &);// = delete
87100

88101
voidinit_response(response &r) {
102+
BOOST_NETWORK_MESSAGE("http_async_connection_pimpl::init_response(...)");
89103
impl::setter_access accessor;
90104
accessor.set_source_promise(r,this->source_promise);
91105
accessor.set_destination_promise(r,this->destination_promise);
92106
accessor.set_headers_promise(r,this->headers_promise);
93107
accessor.set_body_promise(r,this->body_promise);
94108
accessor.set_version_promise(r,this->version_promise);
95109
accessor.set_status_message_promise(r,this->status_message_promise);
110+
BOOST_NETWORK_MESSAGE("futures and promises lined up.");
96111
}
97112

98113
voidset_errors(boost::system::error_codeconst & ec) {
114+
BOOST_NETWORK_MESSAGE("http_async_connection_pimpl::set_errors(...)");
115+
BOOST_NETWORK_MESSAGE("error:" << ec);
99116
boost::system::system_errorerror(ec);
100117
this->version_promise.set_exception(boost::copy_exception(error));
101118
this->status_promise.set_exception(boost::copy_exception(error));
@@ -104,17 +121,21 @@ struct http_async_connection_pimpl : boost::enable_shared_from_this<http_async_c
104121
this->source_promise.set_exception(boost::copy_exception(error));
105122
this->destination_promise.set_exception(boost::copy_exception(error));
106123
this->body_promise.set_exception(boost::copy_exception(error));
124+
BOOST_NETWORK_MESSAGE("promise+future exceptions set.");
107125
}
108126

109127
voidhandle_resolved(boost::uint16_t port,
110128
bool get_body,
111129
body_callback_function_type callback,
112130
boost::system::error_codeconst & ec,
113131
resolver_iterator_pair endpoint_range) {
132+
BOOST_NETWORK_MESSAGE("http_async_connection_pimpl::handle_resolved(...)");
114133
if (!ec && !boost::empty(endpoint_range)) {
115-
// Here we deal with the case that there wasan error encountered and
116-
// that there's still more endpoints to try connecting to.
134+
// Here we deal with the case that there wasno error encountered.
135+
BOOST_NETWORK_MESSAGE("resolved endpoint successfully");
117136
resolver_iterator iter =boost::begin(endpoint_range);
137+
BOOST_NETWORK_MESSAGE("trying connection to:"
138+
<< iter->endpoint().address() <<":" << port);
118139
asio::ip::tcp::endpointendpoint(iter->endpoint().address(), port);
119140
connection_delegate_->connect(endpoint,
120141
request_strand_.wrap(
@@ -128,6 +149,7 @@ struct http_async_connection_pimpl : boost::enable_shared_from_this<http_async_c
128149
resolver_iterator()),
129150
placeholders::error)));
130151
}else {
152+
BOOST_NETWORK_MESSAGE("error encountered while resolving.");
131153
set_errors(ec ? ec : boost::asio::error::host_not_found);
132154
}
133155
}
@@ -137,7 +159,9 @@ struct http_async_connection_pimpl : boost::enable_shared_from_this<http_async_c
137159
body_callback_function_type callback,
138160
resolver_iterator_pair endpoint_range,
139161
boost::system::error_codeconst & ec) {
162+
BOOST_NETWORK_MESSAGE("http_async_connection_pimpl::handle_connected(...)");
140163
if (!ec) {
164+
BOOST_NETWORK_MESSAGE("connected successfully");
141165
BOOST_ASSERT(connection_delegate_.get() !=0);
142166
connection_delegate_->write(command_streambuf,
143167
request_strand_.wrap(
@@ -149,8 +173,10 @@ struct http_async_connection_pimpl : boost::enable_shared_from_this<http_async_c
149173
placeholders::error,
150174
placeholders::bytes_transferred)));
151175
}else {
176+
BOOST_NETWORK_MESSAGE("connection unsuccessful");
152177
if (!boost::empty(endpoint_range)) {
153178
resolver_iterator iter =boost::begin(endpoint_range);
179+
BOOST_NETWORK_MESSAGE("trying:" << iter->endpoint().address() <<":" << port);
154180
asio::ip::tcp::endpointendpoint(iter->endpoint().address(), port);
155181
connection_delegate_->connect(endpoint,
156182
request_strand_.wrap(

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,4 @@ struct connection_delegate_factory {
3636
}/* network*/
3737
}/* boost*/
3838

39-
#ifdef BOOST_NETWORK_NO_LIB
40-
#include<boost/network/protocol/http/client/connection/connection_delegate_factory.ipp>
41-
#endif
42-
4339
#endif/* BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_CONNECTION_DELEGATE_FACTORY_HPP_20110819*/

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,40 @@
1414

1515
#include<boost/network/protocol/http/client/connection/connection_delegate_factory.hpp>
1616
#include<boost/network/protocol/http/client/options.hpp>
17+
#include<boost/network/detail/debug.hpp>
1718

1819
namespaceboost {namespacenetwork {namespacehttp {
1920

20-
connection_delegate_factory::connection_delegate_factory() {}
21+
connection_delegate_factory::connection_delegate_factory() {
22+
BOOST_NETWORK_MESSAGE("connection_delegate_factory::connection_delegate_factory()");
23+
}
2124

2225
connection_delegate_factory::connection_delegate_ptr
2326
connection_delegate_factory::create_connection_delegate(
2427
asio::io_service & service,
2528
bool https,
2629
client_optionsconst &options) {
30+
BOOST_NETWORK_MESSAGE("connection_delegate_factory::create_connection_delegate(...)");
2731
connection_delegate_ptr delegate;
2832
if (https) {
2933
#ifdef BOOST_NETWORK_ENABLE_HTTPS
34+
BOOST_NETWORK_MESSAGE("creating an SSL delegate");
3035
delegate.reset(newssl_delegate(service,
3136
options));
3237
#else
38+
BOOST_NETWORK_MESSAGE("creating an SSL delegate, but not supported");
3339
BOOST_THROW_EXCEPTION(std::runtime_error("HTTPS not supported."));
3440
#endif/* BOOST_NETWORK_ENABLE_HTTPS*/
3541
}else {
42+
BOOST_NETWORK_MESSAGE("creating a normal delegate");
3643
delegate.reset(newnormal_delegate(service));
3744
}
3845
return delegate;
3946
}
4047

41-
connection_delegate_factory::~connection_delegate_factory() {}
48+
connection_delegate_factory::~connection_delegate_factory() {
49+
BOOST_NETWORK_MESSAGE("connection_delegate_factory::~connection_delegate_factory()");
50+
}
4251

4352
}/* http*/
4453

‎boost/network/protocol/http/client/connection/connection_factory.hpp‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,20 @@
88
// http://www.boost.org/LICENSE_1_0.txt)
99

1010
#include<boost/shared_ptr.hpp>
11-
#include<boost/asio/io_service.hpp>
12-
#include<boost/network/protocol/http/client/client_connection.hpp>
11+
12+
namespaceboost {namespaceasio {
13+
14+
classio_service;
15+
16+
}// namespace asio
17+
18+
}// namespace boost
1319

1420
namespaceboost {namespacenetwork {namespacehttp {
1521

1622
classclient_options;
17-
1823
structclient_connection;
24+
structrequest_base;
1925

2026
structconnection_factory {
2127
virtual shared_ptr<client_connection>create_connection(asio::io_service &service,
@@ -30,8 +36,4 @@ struct connection_factory {
3036

3137
}/* boost*/
3238

33-
#ifdef BOOST_NETWORK_NO_LIB
34-
#include<boost/network/protocol/http/client/connection/connection_factory.ipp>
35-
#endif
36-
3739
#endif/* BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_CONNECTION_CONNECTION_FACTORY_HPP_20111112*/

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,4 @@ struct normal_delegate : connection_delegate {
3838

3939
}/* boost*/
4040

41-
#ifdef BOOST_NETWORK_NO_LIB
42-
#include<boost/network/protocol/http/client/connection/normal_delegate.ipp>
43-
#endif/* BOOST_NETWORK_NO_LIB*/
44-
4541
#endif/* BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_CONNECTION_NORMAL_DELEGATE_20110819*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp