From 523fa56d889ce364fb1e107a8177ed1619d24b3e Mon Sep 17 00:00:00 2001 From: Nathan Hourt Date: Wed, 23 Jul 2014 11:56:57 -0400 Subject: [PATCH] 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. --- src/network/http/http_server.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/network/http/http_server.cpp b/src/network/http/http_server.cpp index 2ad966a..b9c7302 100644 --- a/src/network/http/http_server.cpp +++ b/src/network/http/http_server.cpp @@ -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 ) {