forked from boostorg/beast
HTTP tidying
This commit is contained in:
@@ -19,6 +19,7 @@ Version 200
|
||||
* Tidy up multi_buffer
|
||||
* Refactor ostream
|
||||
* Refactor static_buffer
|
||||
* HTTP tidying
|
||||
|
||||
API Changes:
|
||||
|
||||
|
@@ -48,7 +48,7 @@ struct chunk_crlf
|
||||
#if BOOST_BEAST_DOXYGEN
|
||||
using value_type = __implementation_defined__;
|
||||
#else
|
||||
using value_type = detail::chunk_crlf_iter::value_type;
|
||||
using value_type = net::const_buffer;
|
||||
#endif
|
||||
|
||||
/// Required for @b ConstBufferSequence
|
||||
@@ -61,7 +61,8 @@ struct chunk_crlf
|
||||
const_iterator
|
||||
begin() const
|
||||
{
|
||||
return &detail::chunk_crlf_iter::value;
|
||||
static net::const_buffer const cb{"\r\n", 2};
|
||||
return &cb;
|
||||
}
|
||||
|
||||
/// Required for @b ConstBufferSequence
|
||||
|
@@ -136,22 +136,25 @@ public:
|
||||
|
||||
/// Returns a buffer sequence holding a CRLF for chunk encoding
|
||||
inline
|
||||
net::const_buffer
|
||||
net::const_buffer const&
|
||||
chunk_crlf()
|
||||
{
|
||||
return {"\r\n", 2};
|
||||
static net::const_buffer const cb{"\r\n", 2};
|
||||
return cb;
|
||||
}
|
||||
|
||||
/// Returns a buffer sequence holding a final chunk header
|
||||
inline
|
||||
net::const_buffer
|
||||
net::const_buffer const&
|
||||
chunk_last()
|
||||
{
|
||||
return {"0\r\n", 3};
|
||||
static net::const_buffer const cb{"0\r\n", 3};
|
||||
return cb;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#if 0
|
||||
template<class = void>
|
||||
struct chunk_crlf_iter_type
|
||||
{
|
||||
@@ -176,44 +179,19 @@ typename chunk_crlf_iter_type<T>::value_type
|
||||
chunk_crlf_iter_type<T>::value;
|
||||
|
||||
using chunk_crlf_iter = chunk_crlf_iter_type<void>;
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
template<class = void>
|
||||
struct chunk_size0_iter_type
|
||||
{
|
||||
class value_type
|
||||
{
|
||||
char const s[3] = {'0', '\r', '\n'};
|
||||
|
||||
public:
|
||||
value_type() = default;
|
||||
|
||||
operator
|
||||
net::const_buffer() const
|
||||
{
|
||||
return {s, sizeof(s)};
|
||||
}
|
||||
};
|
||||
static value_type value;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
typename chunk_size0_iter_type<T>::value_type
|
||||
chunk_size0_iter_type<T>::value;
|
||||
|
||||
using chunk_size0_iter = chunk_size0_iter_type<void>;
|
||||
|
||||
struct chunk_size0
|
||||
{
|
||||
using value_type = chunk_size0_iter::value_type;
|
||||
|
||||
using value_type = net::const_buffer;
|
||||
using const_iterator = value_type const*;
|
||||
|
||||
const_iterator
|
||||
begin() const
|
||||
{
|
||||
return &chunk_size0_iter::value;
|
||||
return &chunk_last();
|
||||
}
|
||||
|
||||
const_iterator
|
||||
|
@@ -130,7 +130,7 @@ private:
|
||||
using cb4_t = buffers_suffix<buffers_cat_view<
|
||||
typename Fields::writer::const_buffers_type,// header
|
||||
detail::chunk_size, // chunk-size
|
||||
net::const_buffer, // chunk-ext
|
||||
net::const_buffer, // chunk-ext
|
||||
chunk_crlf, // crlf
|
||||
typename writer::const_buffers_type, // body
|
||||
chunk_crlf>>; // crlf
|
||||
@@ -138,7 +138,7 @@ private:
|
||||
|
||||
using cb5_t = buffers_suffix<buffers_cat_view<
|
||||
detail::chunk_size, // chunk-header
|
||||
net::const_buffer, // chunk-ext
|
||||
net::const_buffer, // chunk-ext
|
||||
chunk_crlf, // crlf
|
||||
typename writer::const_buffers_type, // body
|
||||
chunk_crlf>>; // crlf
|
||||
@@ -146,30 +146,30 @@ private:
|
||||
|
||||
using cb6_t = buffers_suffix<buffers_cat_view<
|
||||
detail::chunk_size, // chunk-header
|
||||
net::const_buffer, // chunk-size
|
||||
net::const_buffer, // chunk-size
|
||||
chunk_crlf, // crlf
|
||||
typename writer::const_buffers_type, // body
|
||||
chunk_crlf, // crlf
|
||||
net::const_buffer, // chunk-final
|
||||
net::const_buffer, // trailers
|
||||
net::const_buffer, // chunk-final
|
||||
net::const_buffer, // trailers
|
||||
chunk_crlf>>; // crlf
|
||||
using pcb6_t = buffers_prefix_view<cb6_t const&>;
|
||||
|
||||
using cb7_t = buffers_suffix<buffers_cat_view<
|
||||
typename Fields::writer::const_buffers_type,// header
|
||||
detail::chunk_size, // chunk-size
|
||||
net::const_buffer, // chunk-ext
|
||||
net::const_buffer, // chunk-ext
|
||||
chunk_crlf, // crlf
|
||||
typename writer::const_buffers_type, // body
|
||||
chunk_crlf, // crlf
|
||||
net::const_buffer, // chunk-final
|
||||
net::const_buffer, // trailers
|
||||
net::const_buffer, // chunk-final
|
||||
net::const_buffer, // trailers
|
||||
chunk_crlf>>; // crlf
|
||||
using pcb7_t = buffers_prefix_view<cb7_t const&>;
|
||||
|
||||
using cb8_t = buffers_suffix<buffers_cat_view<
|
||||
net::const_buffer, // chunk-final
|
||||
net::const_buffer, // trailers
|
||||
net::const_buffer, // chunk-final
|
||||
net::const_buffer, // trailers
|
||||
chunk_crlf>>; // crlf
|
||||
using pcb8_t = buffers_prefix_view<cb8_t const&>;
|
||||
|
||||
|
Reference in New Issue
Block a user