11 #include <sys/socket.h>
12 #include <boost/algorithm/string/predicate.hpp>
46 std::streamsize towrite = 0, bytes = 0;
61 tdbg(
"http_response: read data successfully, " << bytes <<
" bytes" << std::endl);
69 }
while (towrite == bytes);
91 "http_response: Chunked transfer encoding needs to be implemented!");
94 "http_response: Invalid response: Content-Length header missing");
122 tdbg(
"http_response: Status is " << m_status << std::endl);
123 if (m_status_code < 100 || m_status_code > 999) {
125 "http_response: Invalid status code " + std::to_string(
m_status_code));
135 }
while (*eq ==
' ');
139 tdbg(
"http_response: Header: " << pair.first->first <<
" = " << pair.first->second << std::endl);
140 if (boost::iequals(pair.first->first,
"Content-Length")) {
144 }
else if (boost::iequals(pair.first->first,
"Transfer-Encoding")) {
145 if (pair.first->second ==
"chunked") {
tasks::tools::buffer m_data_buffer
std::size_t m_content_length
std::size_t m_content_start
std::streamsize read(char *data, std::size_t len)
std::unordered_map< std::string, std::string > m_headers
tasks::tools::buffer m_content_buffer
std::size_t m_last_line_start
void read_data(net::socket &sock)
Read an HTTP response from a socket.
void prepare_data_buffer()
Prepare a HTTP request/response to be sent.
Error on chunked encoding, that is not available yet.
bool m_content_length_exists
#define READ_BUFFER_SIZE_BLOCK