Skip to content

Commit 94fde6c

Browse files
committed
Incremental Progress on API.
This change basically brings the client type closer to full API parity only simpler than how it used to be. The next change completely removes the reliance on Boost.Parameter as that's largely unnecessary now with a more scalable way of providing options and evolving the implementation going forward.
1 parent a495a5b commit 94fde6c

File tree

9 files changed

+64
-1
lines changed

9 files changed

+64
-1
lines changed

boost/network/protocol/http/client.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,8 @@ struct client : basic_client_facade {
4646

4747
} // namespace boost
4848

49+
#ifdef BOOST_NETWORK_NO_LIB
50+
#include <boost/network/protocol/http/client.ipp>
51+
#endif
52+
4953
#endif // BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_20091215
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#ifndef BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_IPP_20120306
2+
#define BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_IPP_20120306
3+
4+
// Copyright 2012 Dean Michael Berris <dberris@google.com>.
5+
// Copyright 2012 Google, Inc.
6+
// Distributed under the Boost Software License, Version 1.0.
7+
// (See accompanying file LICENSE_1_0.txt or copy at
8+
// http://www.boost.org/LICENSE_1_0.txt)
9+
10+
#include <boost/network/protocol/http/client.hpp>
11+
#include <boost/network/protocol/http/client/options.hpp>
12+
13+
namespace boost { namespace network { namespace http {
14+
15+
client::client()
16+
: base_facade_type()
17+
{}
18+
19+
client::client(client_options const &options)
20+
: base_facade_type(options)
21+
{}
22+
23+
} // namespace http
24+
} // namespace network
25+
} // namespace boost
26+
27+
#endif // BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_IPP_20120306

boost/network/protocol/http/client/base.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ struct client_base {
2626
function<void(boost::iterator_range<char const *> const &, system::error_code const &)>
2727
body_callback_function_type;
2828

29+
client_base();
2930
explicit client_base(client_options const &options);
3031
~client_base();
3132
response const request_skeleton(request const & request_,

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ struct client_base_pimpl {
2828
bool get_body,
2929
body_callback_function_type callback,
3030
request_options const &options);
31+
void clear_resolved_cache();
3132
~client_base_pimpl();
3233
private:
3334
client_options options_;
@@ -37,10 +38,18 @@ struct client_base_pimpl {
3738
shared_ptr<connection_manager> connection_manager_;
3839
};
3940

41+
client_base::client_base()
42+
: pimpl(new (std::nothrow) client_base_pimpl(client_options()))
43+
{}
44+
4045
client_base::client_base(client_options const &options)
4146
: pimpl(new (std::nothrow) client_base_pimpl(options))
4247
{}
4348

49+
void client_base::clear_resolved_cache() {
50+
pimpl->clear_resolved_cache();
51+
}
52+
4453
response const client_base::request_skeleton(request const & request_,
4554
std::string const & method,
4655
bool get_body,
@@ -92,6 +101,10 @@ response const client_base_pimpl::request_skeleton(
92101
return connection_->send_request(method, request_, get_body, callback, options);
93102
}
94103

104+
void client_base_pimpl::clear_resolved_cache() {
105+
connection_manager_->clear_resolved_cache();
106+
}
107+
95108
} // namespace http
96109

97110
} // namespace network

boost/network/protocol/http/client/connection_manager.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ struct connection_manager {
2121
asio::io_service & service,
2222
request_base const & request,
2323
client_options const & options) = 0;
24+
virtual void clear_resolved_cache() = 0;
2425
virtual void reset() = 0;
2526
virtual ~connection_manager() = 0;
2627
};

boost/network/protocol/http/client/facade.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ namespace boost { namespace network { namespace http {
1616
struct basic_client_facade {
1717
typedef client_base::body_callback_function_type body_callback_function_type;
1818

19-
basic_client_facade(client_options const &options);
19+
basic_client_facade();
20+
explicit basic_client_facade(client_options const &options);
2021

2122
response const head(request const &request, request_options const&options=request_options());
2223
response const get(request const &request,

boost/network/protocol/http/client/simple_connection_manager.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ struct simple_connection_manager : connection_manager {
6161
*/
6262
virtual void reset(); // override
6363

64+
/** clear_resolved_cache
65+
*
66+
* This function resets all the resolved endpoints that have been cached.
67+
*/
68+
virtual void clear_resolved_cache();
69+
6470
/** Destructor.
6571
*/
6672
virtual ~simple_connection_manager(); // override

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ struct simple_connection_manager_pimpl {
2828
// do nothing here.
2929
}
3030

31+
void clear_resolved_cache() {
32+
// TODO(deanberris): Make this happen!
33+
}
34+
3135
~simple_connection_manager_pimpl() {
3236
// do nothing here.
3337
}
@@ -52,6 +56,10 @@ void simple_connection_manager::reset() {
5256
pimpl->reset();
5357
}
5458

59+
void simple_connection_manager::clear_resolved_cache() {
60+
pimpl->clear_resolved_cache();
61+
}
62+
5563
simple_connection_manager::~simple_connection_manager() {
5664
// do nothing here.
5765
}

libs/network/src/http/client.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#undef BOOST_NETWORK_NO_LIB
99
#endif
1010

11+
#include <boost/network/protocol/http/client.ipp>
1112
#include <boost/network/protocol/http/client/base.ipp>
1213
#include <boost/network/protocol/http/client/facade.ipp>
1314
#include <boost/network/protocol/http/client/options.ipp>
15+

0 commit comments

Comments
 (0)