Browse Source

show recived page 'as is'

pull/11/merge
orignal 11 years ago
parent
commit
d4d1c2f427
  1. 7
      HTTPServer.cpp

7
HTTPServer.cpp

@ -24,6 +24,8 @@ namespace util @@ -24,6 +24,8 @@ namespace util
std::vector<boost::asio::const_buffer> HTTPConnection::reply::to_buffers()
{
std::vector<boost::asio::const_buffer> buffers;
if (headers.size () > 0)
{
buffers.push_back (boost::asio::buffer ("HTTP/1.0 200 OK\r\n")); // always OK
for (std::size_t i = 0; i < headers.size(); ++i)
{
@ -34,6 +36,7 @@ namespace util @@ -34,6 +36,7 @@ namespace util
buffers.push_back(boost::asio::buffer(misc_strings::crlf));
}
buffers.push_back(boost::asio::buffer(misc_strings::crlf));
}
buffers.push_back(boost::asio::buffer(content));
return buffers;
}
@ -185,6 +188,10 @@ namespace util @@ -185,6 +188,10 @@ namespace util
ss << std::string ((char *)buf, r);
while (s->IsOpen () && (r = s->Receive (buf, 8192, 30)) > 0)
ss << std::string ((char *)buf,r);
m_Reply.content = ss.str (); // send "as is"
m_Reply.headers.resize(0); // no headers
return;
}
else // nothing received
ss << "<html>Not responding</html>";

Loading…
Cancel
Save