3
3
4
4
// Copyright 2010 Dean Michael Berris.
5
5
// Copyright 2014 Jussi Lyytinen
6
+ // Copyright 2015 Google, Inc.
6
7
// Distributed under the Boost Software License, Version 1.0.
7
8
// (See accompanying file LICENSE_1_0.txt or copy at
8
9
// http://www.boost.org/LICENSE_1_0.txt)
11
12
#include < bitset>
12
13
#include < boost/algorithm/string/compare.hpp>
13
14
#include < boost/concept/requires.hpp>
15
+ #include < boost/lexical_cast.hpp>
14
16
#include < boost/network/constants.hpp>
17
+ #include < boost/network/message/wrappers/body.hpp>
15
18
#include < boost/network/protocol/http/message/header/name.hpp>
16
19
#include < boost/network/protocol/http/message/header/value.hpp>
17
- #include < boost/network/protocol/http/message/header_concept.hpp>
18
- #include < boost/network/protocol/http/request_concept.hpp>
19
- #include < boost/network/traits/string.hpp>
20
+ #include < boost/network/protocol/http/message/wrappers/headers.hpp>
21
+ #include < boost/network/protocol/http/message/wrappers/port.hpp>
22
+ #include < boost/network/protocol/http/traits/connection_keepalive.hpp>
23
+ #include < boost/network/traits/headers_container.hpp>
20
24
#include < boost/network/traits/ostringstream.hpp>
25
+ #include < boost/network/traits/string.hpp>
21
26
#include < boost/optional.hpp>
22
27
#include < boost/range/algorithm/copy.hpp>
23
28
#include < boost/version.hpp>
24
- #include < boost/lexical_cast.hpp>
25
29
26
30
namespace boost {
27
31
namespace network {
@@ -40,9 +44,7 @@ struct linearize_header {
40
44
};
41
45
42
46
template <class ValueType >
43
- BOOST_CONCEPT_REQUIRES (((Header<typename boost::remove_cv<ValueType>::type>)),
44
- (string_type))
45
- operator ()(ValueType& header) {
47
+ string_type operator ()(ValueType& header) {
46
48
typedef typename ostringstream<Tag>::type output_stream;
47
49
typedef constants<Tag> consts;
48
50
output_stream header_line;
@@ -53,11 +55,10 @@ struct linearize_header {
53
55
};
54
56
55
57
template <class Request , class OutputIterator >
56
- BOOST_CONCEPT_REQUIRES (((ClientRequest<Request>)), (OutputIterator))
57
- linearize (Request const & request,
58
- typename Request::string_type const & method,
59
- unsigned version_major, unsigned version_minor,
60
- OutputIterator oi) {
58
+ OutputIterator linearize (Request const & request,
59
+ typename Request::string_type const & method,
60
+ unsigned version_major, unsigned version_minor,
61
+ OutputIterator oi) {
61
62
typedef typename Request::tag Tag;
62
63
typedef constants<Tag> consts;
63
64
typedef typename string<Tag>::type string_type;
@@ -97,13 +98,7 @@ BOOST_CONCEPT_REQUIRES(((ClientRequest<Request>)), (OutputIterator))
97
98
// We need to determine whether we've seen any of the following headers
98
99
// before setting the defaults. We use a bitset to keep track of the
99
100
// defaulted headers.
100
- enum {
101
- ACCEPT,
102
- ACCEPT_ENCODING,
103
- HOST,
104
- CONNECTION,
105
- MAX
106
- };
101
+ enum { ACCEPT, ACCEPT_ENCODING, HOST, CONNECTION, MAX };
107
102
std::bitset<MAX> found_headers;
108
103
static char const * defaulted_headers[][2 ] = {
109
104
{consts::accept (), consts::accept () + std::strlen (consts::accept ())},
@@ -182,12 +177,12 @@ BOOST_CONCEPT_REQUIRES(((ClientRequest<Request>)), (OutputIterator))
182
177
}
183
178
184
179
boost::copy (crlf, oi);
185
- typename body_range<Request>::type body_data = body (request).range ();
180
+ auto body_data = body (request).range ();
186
181
return boost::copy (body_data, oi);
187
182
}
188
183
189
184
} // namespace http
190
185
} // namespace network
191
186
} // namespace boost
192
187
193
- #endif /* BOOST_NETWORK_PROTOCOL_HTTP_ALGORITHMS_LINEARIZE_HPP_20101028 */
188
+ #endif // BOOST_NETWORK_PROTOCOL_HTTP_ALGORITHMS_LINEARIZE_HPP_20101028
0 commit comments