diff Core/HttpServer/HttpOutput.cpp @ 1832:b7da58699f92

Fix formatting of multipart HTTP answers
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 26 Nov 2015 19:09:15 +0100
parents 1558b3226b18
children aa95aea0a352
line wrap: on
line diff
--- a/Core/HttpServer/HttpOutput.cpp	Thu Nov 26 18:53:00 2015 +0100
+++ b/Core/HttpServer/HttpOutput.cpp	Thu Nov 26 19:09:15 2015 +0100
@@ -451,10 +451,10 @@
 
   void HttpOutput::StateMachine::SendMultipartItem(const void* item, size_t length)
   {
-    std::string header = "--" + multipartBoundary_ + "\n";
-    header += "Content-Type: " + multipartContentType_ + "\n";
-    header += "Content-Length: " + boost::lexical_cast<std::string>(length) + "\n";
-    header += "MIME-Version: 1.0\n\n";
+    std::string header = "--" + multipartBoundary_ + "\r\n";
+    header += "Content-Type: " + multipartContentType_ + "\r\n";
+    header += "Content-Length: " + boost::lexical_cast<std::string>(length) + "\r\n";
+    header += "MIME-Version: 1.0\r\n\r\n";
 
     stream_.Send(false, header.c_str(), header.size());
 
@@ -463,7 +463,7 @@
       stream_.Send(false, item, length);
     }
 
-    stream_.Send(false, "\n", 1);
+    stream_.Send(false, "\r\n", 1);
   }
 
 
@@ -478,7 +478,7 @@
     // closed the connection. Such an error is ignored.
     try
     {
-      std::string header = "--" + multipartBoundary_ + "--\n";
+      std::string header = "--" + multipartBoundary_ + "--\r\n";
       stream_.Send(false, header.c_str(), header.size());
     }
     catch (OrthancException&)