10 #include <boost/asio.hpp> 11 #include <pion/http/writer.hpp> 12 #include <pion/http/message.hpp> 22 const bool send_final_chunk)
25 if (! m_sent_headers) {
30 m_sent_headers =
true;
38 if (m_content_length > 0) {
43 sprintf(cast_buf,
"%lx", static_cast<long>(m_content_length));
46 m_text_cache.push_back(cast_buf);
48 write_buffers.push_back(boost::asio::buffer(m_text_cache.back()));
50 write_buffers.push_back(boost::asio::buffer(http::types::STRING_CRLF));
53 write_buffers.insert(write_buffers.end(), m_content_buffers.begin(),
54 m_content_buffers.end());
56 write_buffers.push_back(boost::asio::buffer(http::types::STRING_CRLF));
59 write_buffers.insert(write_buffers.end(), m_content_buffers.begin(),
60 m_content_buffers.end());
67 m_text_cache.push_back(
"0");
69 write_buffers.push_back(boost::asio::buffer(m_text_cache.back()));
71 write_buffers.push_back(boost::asio::buffer(http::types::STRING_CRLF));
72 write_buffers.push_back(boost::asio::buffer(http::types::STRING_CRLF));
virtual void prepare_buffers_for_send(http::message::write_buffers_t &write_buffers)=0
bool sending_chunked_message() const
returns true if we are sending a chunked message to the client
std::vector< boost::asio::const_buffer > write_buffers_t
data type for I/O write buffers (these wrap existing data to be sent)
bool supports_chunked_messages() const
returns true if the client supports chunked messages