Skip to content

Commit 28e523f

Browse files
committed
Fixes to the linearize implementation, and the request include header.
1 parent 3049355 commit 28e523f

File tree

5 files changed

+37
-19
lines changed

5 files changed

+37
-19
lines changed

boost/network/protocol/http/algorithms/linearize.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
// (See accompanying file LICENSE_1_0.txt or copy at
77
// http://www.boost.org/LICENSE_1_0.txt)
88

9+
#include <boost/network/traits/string.hpp>
910
#include <boost/network/protocol/http/message/header/name.hpp>
1011
#include <boost/network/protocol/http/message/header/value.hpp>
1112
#include <boost/network/protocol/http/message/header_concept.hpp>
1213
#include <boost/network/constants.hpp>
13-
#include <boost/concept_check.hpp>
14+
#include <boost/concept/requires.hpp>
1415
#include <boost/range/algorithm/copy.hpp>
1516

1617
namespace boost { namespace network { namespace http {
@@ -89,7 +90,7 @@ namespace boost { namespace network { namespace http {
8990
*oi = consts::colon_char();
9091
*oi = consts::space_char();
9192
boost::copy(request.host(), oi);
92-
boost::copy(host, oi);
93+
boost::copy(crlf, oi);
9394
boost::copy(accept, oi);
9495
*oi = consts::colon_char();
9596
*oi = consts::space_char();

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

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#define __NETWORK_PROTOCOL_HTTP_REQUEST_IMPL_20070908_1_HPP__
1010

1111
#include <boost/network/protocol/http/message.hpp>
12+
#include <boost/network/protocol/http/message/header.hpp>
1213

1314
#include <boost/fusion/container/map.hpp>
1415
#include <boost/fusion/sequence/intrinsic/at_key.hpp>
@@ -23,7 +24,20 @@
2324

2425
#include <boost/cstdint.hpp>
2526

26-
namespace boost { namespace network { namespace http {
27+
namespace boost { namespace network {
28+
29+
/** Specialize the traits for the http_server tag. */
30+
template <>
31+
struct headers_container<http::tags::http_server> :
32+
vector<http::tags::http_server>::apply<http::request_header<http::tags::http_server> >
33+
{};
34+
35+
template <>
36+
struct headers_container<http::tags::http_async_server> :
37+
vector<http::tags::http_async_server>::apply<http::request_header<http::tags::http_async_server> >
38+
{};
39+
40+
namespace http {
2741

2842
/** request.hpp
2943
*
@@ -123,7 +137,7 @@ namespace boost { namespace network { namespace http {
123137
typedef Tag tag;
124138
typedef typename string<Tag>::type string_type;
125139
typedef request_header<Tag> header_type;
126-
typedef typename vector<tags::http_server>::
140+
typedef typename vector<Tag>::
127141
template apply<header_type>::type
128142
vector_type;
129143
typedef vector_type headers_container_type;
@@ -171,17 +185,6 @@ namespace boost { namespace network { namespace http {
171185

172186
} // namespace http
173187

174-
/** Specialize the traits for the http_server tag. */
175-
template <>
176-
struct headers_container<http::tags::http_server> :
177-
vector<http::tags::http_server>::apply<http::request_header<http::tags::http_server> >
178-
{};
179-
180-
template <>
181-
struct headers_container<http::tags::http_async_server> :
182-
vector<http::tags::http_async_server>::apply<http::request_header<http::tags::http_async_server> >
183-
{};
184-
185188
namespace http { namespace impl {
186189

187190
template <>

boost/network/protocol/http/request.hpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,20 @@
2727
#include <boost/network/protocol/http/message/wrappers/body.hpp>
2828
#include <boost/network/protocol/http/message/wrappers/version.hpp>
2929
#include <boost/network/protocol/http/message/wrappers/method.hpp>
30-
#include <boost/network/protocol/http/message/modifiers/method.hpp>
3130
#include <boost/network/protocol/http/message/directives/method.hpp>
3231
#include <boost/network/protocol/http/message/directives/major_version.hpp>
3332
#include <boost/network/protocol/http/message/directives/minor_version.hpp>
33+
#include <boost/network/protocol/http/message/modifiers/method.hpp>
3434
#include <boost/network/protocol/http/message/modifiers/major_version.hpp>
3535
#include <boost/network/protocol/http/message/modifiers/minor_version.hpp>
36+
#include <boost/network/protocol/http/message/modifiers/source.hpp>
37+
#include <boost/network/protocol/http/message/modifiers/destination.hpp>
38+
#include <boost/network/protocol/http/message/modifiers/headers.hpp>
39+
#include <boost/network/protocol/http/message/modifiers/body.hpp>
3640
#include <boost/network/protocol/http/message/wrappers/major_version.hpp>
3741
#include <boost/network/protocol/http/message/wrappers/minor_version.hpp>
42+
#include <boost/network/protocol/http/message/wrappers/source.hpp>
43+
#include <boost/network/protocol/http/message/wrappers/destination.hpp>
3844

3945
#include <boost/network/message/directives.hpp>
4046
#include <boost/network/message/transformers.hpp>

boost/network/traits/vector.hpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
#ifndef BOOST_NETWORK_TRAITS_VECTOR_HPP
77
#define BOOST_NETWORK_TRAITS_VECTOR_HPP
88

9+
#include <boost/network/support/is_default_string.hpp>
10+
#include <vector>
11+
912
namespace boost { namespace network {
1013

1114
template <class Tag>
@@ -15,9 +18,13 @@ namespace boost { namespace network {
1518
struct vector {
1619

1720
template <class Type>
18-
struct apply {
19-
typedef unsupported_tag<Tag> type;
20-
};
21+
struct apply :
22+
mpl::if_<
23+
is_default_string<Tag>
24+
, std::vector<Type>
25+
, unsupported_tag<Tag>
26+
>
27+
{};
2128

2229
};
2330

libs/network/test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ if (Boost_FOUND)
3030
http_url_test
3131
utils_thread_pool
3232
http_async_message_ready
33+
http_request_linearize
3334
)
3435
foreach (test ${TESTS})
3536
set_source_files_properties(${test}.cpp

0 commit comments

Comments
 (0)