36
36
37
37
#ifndef BOOST_NETWORK_HTTP_SERVER_CONNECTION_HEADER_BUFFER_MAX_SIZE
38
38
/* * Here we define a page's worth of header connection buffer data.
39
- * This can be tuned to reduce the memory cost of connections, but this
39
+ * This can be tuned to reduce the memory cost of connections, but this
40
40
* default size is set to be friendly to typical service applications.
41
41
* This is the maximum size though and Boost.Asio's internal representation
42
42
* of a streambuf would make appropriate decisions on how big a buffer
@@ -91,7 +91,7 @@ namespace boost { namespace network { namespace http {
91
91
92
92
private:
93
93
static char const * status_message (status_t status) {
94
- static char const
94
+ static char const
95
95
ok_[] = " OK"
96
96
, created_[] = " Created"
97
97
, accepted_[] = " Accepted"
@@ -172,9 +172,9 @@ namespace boost { namespace network { namespace http {
172
172
173
173
/* * Function: template <class Range> set_headers(Range headers)
174
174
* Precondition: headers have not been sent yet
175
- * Postcondition: headers have been linearized to a buffer,
175
+ * Postcondition: headers have been linearized to a buffer,
176
176
* and assumed to have been sent already when the function exits
177
- * Throws: std::logic_error in case the headers have already been sent.
177
+ * Throws: std::logic_error in case the headers have already been sent.
178
178
*
179
179
* A call to set_headers takes a Range where each element models the
180
180
* Header concept. This Range will be linearized onto a buffer, which is
@@ -183,7 +183,7 @@ namespace boost { namespace network { namespace http {
183
183
template <class Range >
184
184
void set_headers (Range headers) {
185
185
lock_guard lock (headers_mutex);
186
- if (headers_in_progress || headers_already_sent)
186
+ if (headers_in_progress || headers_already_sent)
187
187
boost::throw_exception (std::logic_error (" Headers have already been sent." ));
188
188
189
189
if (error_encountered)
@@ -199,7 +199,7 @@ namespace boost { namespace network { namespace http {
199
199
if (!boost::empty (headers)) {
200
200
typedef typename Range::const_iterator iterator;
201
201
typedef typename string<Tag>::type string_type;
202
- boost::transform (headers,
202
+ boost::transform (headers,
203
203
std::ostream_iterator<string_type>(stream),
204
204
linearize_header<Tag>());
205
205
} else {
@@ -228,11 +228,11 @@ namespace boost { namespace network { namespace http {
228
228
lock_guard lock (headers_mutex);
229
229
if (error_encountered) boost::throw_exception (boost::system::system_error (*error_encountered));
230
230
231
- boost::function<void (boost::system::error_code)> f =
231
+ boost::function<void (boost::system::error_code)> f =
232
232
boost::bind (
233
233
&async_connection<Tag,Handler>::default_error
234
234
, async_connection<Tag,Handler>::shared_from_this ()
235
- , _1 );
235
+ , boost::arg< 1 >() );
236
236
237
237
write_impl (
238
238
boost::make_iterator_range (range)
@@ -390,7 +390,7 @@ namespace boost { namespace network { namespace http {
390
390
new_start, data_end);
391
391
fusion::tie (parsed_ok, result_range) = parser.parse_until (
392
392
request_parser_type::method_done, input_range);
393
- if (!parsed_ok) {
393
+ if (!parsed_ok) {
394
394
client_error ();
395
395
break ;
396
396
} else if (parsed_ok == true ) {
@@ -497,7 +497,7 @@ namespace boost { namespace network { namespace http {
497
497
}
498
498
499
499
void client_error () {
500
- static char const * bad_request =
500
+ static char const * bad_request =
501
501
" HTTP/1.0 400 Bad Request\r\n Connection: close\r\n Content-Type: text/plain\r\n Content-Length: 12\r\n\r\n Bad Request." ;
502
502
503
503
asio::async_write (
@@ -583,17 +583,17 @@ namespace boost { namespace network { namespace http {
583
583
584
584
static std::size_t const connection_buffer_size =
585
585
BOOST_NETWORK_HTTP_SERVER_CONNECTION_BUFFER_SIZE;
586
- shared_array_list temporaries =
586
+ shared_array_list temporaries =
587
587
boost::make_shared<array_list>();
588
- shared_buffers buffers =
588
+ shared_buffers buffers =
589
589
boost::make_shared<std::vector<asio::const_buffer> >(0 );
590
590
591
591
std::size_t range_size = boost::distance (range);
592
592
buffers->reserve (
593
593
(range_size / connection_buffer_size)
594
594
+ ((range_size % connection_buffer_size)?1 :0 )
595
595
);
596
- std::size_t slice_size =
596
+ std::size_t slice_size =
597
597
std::min (range_size,connection_buffer_size);
598
598
typename boost::range_iterator<Range>::type
599
599
start = boost::begin (range)
@@ -667,11 +667,11 @@ namespace boost { namespace network { namespace http {
667
667
}
668
668
}
669
669
};
670
-
670
+
671
671
} /* http */
672
-
672
+
673
673
} /* network */
674
-
674
+
675
675
} /* boost */
676
676
677
677
#endif /* BOOST_NETWORK_PROTOCOL_HTTP_SERVER_CONNECTION_HPP_20101027 */
0 commit comments