@@ -38,8 +38,8 @@ namespace boost { namespace network { namespace http {
38
38
typedef typename ostringstream<Tag>::type output_stream;
39
39
typedef constants<Tag> consts;
40
40
output_stream header_line;
41
- header_line << name (header)
42
- << consts::colon () << consts::space ()
41
+ header_line << name (header)
42
+ << consts::colon () << consts::space ()
43
43
<< value (header) << consts::crlf ();
44
44
return header_line.str ();
45
45
}
@@ -50,17 +50,17 @@ namespace boost { namespace network { namespace http {
50
50
((ClientRequest<Request>)),
51
51
(OutputIterator)
52
52
) linearize(
53
- Request const & request,
53
+ Request const & request,
54
54
typename Request::string_type const & method,
55
- unsigned version_major,
56
- unsigned version_minor,
55
+ unsigned version_major,
56
+ unsigned version_minor,
57
57
OutputIterator oi
58
- )
58
+ )
59
59
{
60
60
typedef typename Request::tag Tag;
61
61
typedef constants<Tag> consts;
62
62
typedef typename string<Tag>::type string_type;
63
- static string_type
63
+ static string_type
64
64
http_slash = consts::http_slash ()
65
65
, accept = consts::accept ()
66
66
, accept_mime = consts::default_accept_mime ()
@@ -73,7 +73,7 @@ namespace boost { namespace network { namespace http {
73
73
;
74
74
boost::copy (method, oi);
75
75
*oi = consts::space_char ();
76
- if (request.path ().empty () || request.path ()[0 ] != consts::slash_char ())
76
+ if (request.path ().empty () || request.path ()[0 ] != consts::slash_char ())
77
77
*oi = consts::slash_char ();
78
78
boost::copy (request.path (), oi);
79
79
if (!request.query ().empty ()) {
@@ -116,13 +116,11 @@ namespace boost { namespace network { namespace http {
116
116
boost::copy (crlf, oi);
117
117
}
118
118
typedef typename headers_range<Request>::type headers_range;
119
- typedef typename range_iterator<headers_range>::type headers_iterator;
120
- headers_range request_headers = headers (request);
121
- headers_iterator iterator = boost::begin (request_headers),
122
- end = boost::end (request_headers);
123
- for (; iterator != end; ++iterator) {
124
- string_type header_name = name (*iterator),
125
- header_value = value (*iterator);
119
+ typedef typename range_value<headers_range>::type headers_value;
120
+ BOOST_FOREACH (const headers_value &header, headers (request))
121
+ {
122
+ string_type header_name = name (header),
123
+ header_value = value (header);
126
124
boost::copy (header_name, oi);
127
125
*oi = consts::colon_char ();
128
126
*oi = consts::space_char ();
@@ -140,11 +138,11 @@ namespace boost { namespace network { namespace http {
140
138
typename body_range<Request>::type body_data = body (request).range ();
141
139
return boost::copy (body_data, oi);
142
140
}
143
-
141
+
144
142
} /* http */
145
-
143
+
146
144
} /* net */
147
-
145
+
148
146
} /* boost */
149
147
150
148
#endif /* BOOST_NETWORK_PROTOCOL_HTTP_ALGORITHMS_LINEARIZE_HPP_20101028 */
0 commit comments