Bugfix: Incorrect ordering of newline and carriage return in HTTP server

The HTTP server was printing "\n\r" at the end of lines in the response
headers, which is invalid and caused some HTTP clients to detect an end
to the headers after the first header line.

The server now prints the proper "\r\n" sequence, which is parsed
correctly by clients.
This commit is contained in:
Nathan Hourt 2014-07-23 11:56:57 -04:00
parent eb022cef27
commit 523fa56d88

View file

@ -21,10 +21,10 @@ namespace fc { namespace http {
fc::stringstream ss;
ss << "HTTP/1.1 " << rep.status << " ";
switch( rep.status ) {
case fc::http::reply::OK: ss << "OK\n\r"; break;
case fc::http::reply::RecordCreated: ss << "Record Created\n\r"; break;
case fc::http::reply::NotFound: ss << "Not Found\n\r"; break;
case fc::http::reply::Found: ss << "Found\n\r"; break;
case fc::http::reply::OK: ss << "OK\r\n"; break;
case fc::http::reply::RecordCreated: ss << "Record Created\r\n"; break;
case fc::http::reply::NotFound: ss << "Not Found\r\n"; break;
case fc::http::reply::Found: ss << "Found\r\n"; break;
case fc::http::reply::InternalServerError: ss << "Internal Server Error\r\n"; break;
}
for( uint32_t i = 0; i < rep.headers.size(); ++i ) {