Browse Source

* HTTPServer : keep response data for async_write()

pull/623/head
hagen 8 years ago
parent
commit
26440d94f1
  1. 4
      HTTPServer.cpp
  2. 1
      HTTPServer.h

4
HTTPServer.cpp

@ -762,8 +762,8 @@ namespace http {
reply.add_header("Content-Type", "text/html"); reply.add_header("Content-Type", "text/html");
reply.body = content; reply.body = content;
std::string res = reply.to_string(); m_SendBuffer = reply.to_string();
boost::asio::async_write (*m_Socket, boost::asio::buffer(res), boost::asio::async_write (*m_Socket, boost::asio::buffer(m_SendBuffer),
std::bind (&HTTPConnection::Terminate, shared_from_this (), std::placeholders::_1)); std::bind (&HTTPConnection::Terminate, shared_from_this (), std::placeholders::_1));
} }

1
HTTPServer.h

@ -31,6 +31,7 @@ namespace http {
boost::asio::deadline_timer m_Timer; boost::asio::deadline_timer m_Timer;
char m_Buffer[HTTP_CONNECTION_BUFFER_SIZE + 1]; char m_Buffer[HTTP_CONNECTION_BUFFER_SIZE + 1];
size_t m_BufferLen; size_t m_BufferLen;
std::string m_SendBuffer;
bool needAuth; bool needAuth;
std::string user; std::string user;
std::string pass; std::string pass;

Loading…
Cancel
Save