|
24 | 24 | #include <boost/utility/typed_in_place_factory.hpp>
|
25 | 25 | #include <boost/thread/locks.hpp>
|
26 | 26 | #include <boost/thread/recursive_mutex.hpp>
|
| 27 | +#include <boost/utility/enable_if.hpp> |
27 | 28 | #include <list>
|
28 | 29 | #include <vector>
|
29 | 30 | #include <iterator>
|
|
35 | 36 | * This is the maximum size though and Boost.Asio's internal representation
|
36 | 37 | * of a streambuf would make appropriate decisions on how big a buffer
|
37 | 38 | * is to begin with.
|
| 39 | + * |
| 40 | + * This kinda assumes that a page is by default 4096. Since we're using |
| 41 | + * the default allocator with the static buffers, it's not guaranteed that |
| 42 | + * the static buffers will be page-aligned when they are allocated. |
38 | 43 | */
|
39 | 44 | #define BOOST_NETWORK_HTTP_SERVER_CONNECTION_HEADER_BUFFER_MAX_SIZE 4096
|
40 | 45 | #endif /* BOOST_NETWORK_HTTP_SERVER_CONNECTION_HEADER_BUFFER_MAX_SIZE */
|
@@ -211,14 +216,16 @@ namespace boost { namespace network { namespace http {
|
211 | 216 | }
|
212 | 217 |
|
213 | 218 | template <class Range, class Callback>
|
214 |
| - void write(Range const & range, Callback const & callback) { |
| 219 | + typename disable_if<is_base_of<asio::const_buffer, Range>, void>::type |
| 220 | + write(Range const & range, Callback const & callback) { |
215 | 221 | lock_guard lock(headers_mutex);
|
216 | 222 | if (error_encountered) boost::throw_exception(boost::system::system_error(*error_encountered));
|
217 | 223 | write_impl(boost::make_iterator_range(range), callback);
|
218 | 224 | }
|
219 | 225 |
|
220 | 226 | template <class ConstBufferSeq, class Callback>
|
221 |
| - void write_vec(ConstBufferSeq const & seq, Callback const & callback) |
| 227 | + typename enable_if<is_base_of<asio::const_buffer, ConstBufferSeq>, void>::type |
| 228 | + write(ConstBufferSeq const & seq, Callback const & callback) |
222 | 229 | {
|
223 | 230 | write_vec_impl(seq, callback, shared_array_list(), shared_buffers());
|
224 | 231 | }
|
|
0 commit comments