changeset 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 3ae2ff249675
children 47d032c48818
files Core/HttpServer/HttpOutput.cpp NEWS
diffstat 2 files changed, 7 insertions(+), 6 deletions(-) [+]
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&)
--- a/NEWS	Thu Nov 26 18:53:00 2015 +0100
+++ b/NEWS	Thu Nov 26 19:09:15 2015 +0100
@@ -67,6 +67,7 @@
 * Many refactorings, notably of the searching features and of the image decoding
 * C-Move SCP for studies using AccessionNumber tag
 * Fix issue 4 (C-Store Association not renegotiated on Specific-to-specific transfer syntax change)
+* Fix formatting of multipart HTTP answers
 * "--logdir" flag creates a single log file instead of 3 separate files for errors/warnings/infos
 * "--errors" flag lists the error codes that could be returned by Orthanc
 * Under Windows, the exit status of Orthanc corresponds to the encountered error code