Skip to content

Commit 030de04

Browse files
author
Dean Michael Berris
committed
More GCC changes, integrating HTTP incremental parser to the HTTP client.
1 parent f7679a7 commit 030de04

File tree

19 files changed

+519
-143
lines changed

19 files changed

+519
-143
lines changed

boost/network/message/directives/source.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
#include <boost/network/message/directives/detail/string_directive.hpp>
1111
#include <boost/network/message/directives/detail/string_value.hpp>
1212

13+
#include <boost/network/support/is_default_string.hpp>
14+
1315
namespace boost { namespace network {
1416

1517
namespace impl {
@@ -26,8 +28,8 @@ namespace boost { namespace network {
2628
void operator()(typename detail::string_value<typename Message::tag>::type const & source) const {
2729
message_.source(source);
2830
}
29-
template <class T> void operator()(T const &) const {
30-
// FIXME -- fail here!
31+
template <class T> void operator()(T const & source) const {
32+
// fail at compile time?
3133
}
3234
};
3335

boost/network/protocol/http/client.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
#include <boost/network/protocol/http/client/facade.hpp>
2727
#include <boost/network/protocol/http/client/pimpl.hpp>
2828

29+
#include <boost/network/support/sync_only.hpp>
30+
31+
2932
namespace boost { namespace network { namespace http {
3033

3134
template <class Tag, unsigned version_major, unsigned version_minor>
@@ -36,7 +39,7 @@ namespace boost { namespace network { namespace http {
3639
typedef basic_client_impl<Tag,version_major,version_minor> pimpl_type;
3740
typedef basic_client_facade<Tag, basic_client<Tag,version_major,version_minor> > base_facade_type;
3841
public:
39-
typedef basic_request<Tag> request;
42+
typedef basic_request<typename sync_only<Tag>::type> request;
4043
typedef basic_response<Tag> response;
4144
typedef typename string<Tag>::type string_type;
4245
typedef Tag tag_type;
@@ -87,7 +90,7 @@ namespace boost { namespace network { namespace http {
8790

8891
friend struct basic_client_facade<Tag,basic_client<Tag,version_major,version_minor> > ;
8992

90-
basic_response<Tag> const request_skeleton(basic_request<Tag> const & request_, string_type method, bool get_body) {
93+
basic_response<Tag> const request_skeleton(request const & request_, string_type method, bool get_body) {
9194
return pimpl->request_skeleton(request_, method, get_body);
9295
}
9396

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <boost/asio/strand.hpp>
1111
#include <boost/thread/thread.hpp>
1212
#include <boost/bind.hpp>
13+
#include <boost/network/support/sync_only.hpp>
1314

1415
namespace boost { namespace network { namespace http {
1516

@@ -55,7 +56,7 @@ namespace boost { namespace network { namespace http {
5556
}
5657

5758
basic_response<Tag> const request_skeleton(
58-
basic_request<Tag> const & request_,
59+
basic_request<typename sync_only<Tag>::type> const & request_,
5960
string_type const & method,
6061
bool get_body
6162
)

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <boost/network/protocol/http/request.hpp>
1010
#include <boost/network/protocol/http/response.hpp>
11+
#include <boost/network/support/sync_only.hpp>
1112

1213
namespace boost { namespace network { namespace http {
1314

@@ -21,7 +22,7 @@ namespace boost { namespace network { namespace http {
2122
struct basic_client_facade {
2223

2324
typedef typename string<Tag>::type string_type;
24-
typedef basic_request<Tag> request;
25+
typedef basic_request<typename sync_only<Tag>::type> request;
2526
typedef basic_response<Tag> response;
2627

2728
basic_client_facade()

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include <boost/network/protocol/http/traits/connection_policy.hpp>
1717
#include <boost/network/protocol/http/client/async_impl.hpp>
18+
#include <boost/network/support/sync_only.hpp>
1819

1920
namespace boost { namespace network { namespace http {
2021

@@ -46,7 +47,7 @@ namespace boost { namespace network { namespace http {
4647

4748
~sync_client() {}
4849

49-
basic_response<Tag> const request_skeleton(basic_request<Tag> const & request_, string_type method, bool get_body) {
50+
basic_response<Tag> const request_skeleton(basic_request<typename sync_only<Tag>::type> const & request_, string_type method, bool get_body) {
5051
typename connection_base::connection_ptr connection_;
5152
connection_ = connection_base::get_connection(resolver_, request_);
5253
return connection_->send_request(method, request_, get_body);

boost/network/protocol/http/detail/connection_helper.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <boost/network/protocol/http/traits/connection_keepalive.hpp>
1212
#include <boost/asio/streambuf.hpp>
1313
#include <boost/network/traits/string.hpp>
14+
#include <boost/network/support/sync_only.hpp>
1415

1516
namespace boost { namespace network { namespace http { namespace detail {
1617

@@ -20,7 +21,7 @@ namespace boost { namespace network { namespace http { namespace detail {
2021

2122
typedef typename string<Tag>::type string_type;
2223

23-
void create_request(boost::asio::streambuf & request_buffer, string_type const & method, basic_request<Tag> request_) const {
24+
void create_request(boost::asio::streambuf & request_buffer, string_type const & method, basic_request<typename sync_only<Tag>::type> request_) const {
2425
// TODO make this use Boost.Karma instead of an ad-hoc implementation
2526
std::ostream request_stream(&request_buffer);
2627

boost/network/protocol/http/impl/async_connection_base.hpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ namespace boost { namespace network { namespace http { namespace impl {
2121
typedef typename resolver_base::resolver_type resolver_type;
2222
typedef typename resolver_base::resolve_function resolve_function;
2323
typedef typename string<Tag>::type string_type;
24-
typedef basic_request<Tag> request;
24+
typedef basic_request<typename sync_only<Tag>::type> request;
2525
typedef basic_response<Tag> response;
2626

27-
static async_connection_base<Tag,version_major,version_minor> * new_connection(resolve_function resolve, boost::shared_ptr<resolver_type> resolver, bool follow_redirect, bool https) {
27+
static boost::shared_ptr<async_connection_base<Tag,version_major,version_minor> > new_connection(resolve_function resolve, boost::shared_ptr<resolver_type> resolver, bool follow_redirect, bool https) {
2828
if (https) {
2929
#ifdef BOOST_NETWORK_ENABLE_HTTPS
3030
// FIXME fill this up with the HTTPS implementation.
@@ -33,7 +33,10 @@ namespace boost { namespace network { namespace http { namespace impl {
3333
throw std::runtime_error("HTTPS not supported.");
3434
#endif
3535
}
36-
return dynamic_cast<async_connection_base<Tag,version_major,version_minor>*>(new http_async_connection<Tag,version_major,version_minor>(resolver, resolve, follow_redirect));
36+
boost::shared_ptr<async_connection_base<Tag,version_major,version_minor> > temp;
37+
temp.reset(new http_async_connection<Tag,version_major,version_minor>(resolver, resolve, follow_redirect));
38+
assert(temp.get() != 0);
39+
return temp;
3740
}
3841

3942
virtual response start(request const & request, string_type const & method, bool get_body) = 0;

0 commit comments

Comments
 (0)