changeset 3616:b6a569e6e85b

author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 23 Jan 2020 12:58:08 +0100
parents a77e7839012a
children afdda32d89e6 649489b9bfdb 427a13084241
files Core/HttpServer/HttpOutput.cpp NEWS
diffstat 2 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Core/HttpServer/HttpOutput.cpp	Thu Jan 16 12:50:06 2020 +0100
+++ b/Core/HttpServer/HttpOutput.cpp	Thu Jan 23 12:58:08 2020 +0100
@@ -463,6 +463,21 @@
     }
 
     boundary = Toolbox::GenerateUuid() + "-" + Toolbox::GenerateUuid();
+
+    /**
+     * Fix for issue #165: "Encapsulation boundaries must not appear
+     * within the encapsulations, and must be no longer than 70
+     * characters, not counting the two leading hyphens."
+     * https://tools.ietf.org/html/rfc1521
+     * https://bitbucket.org/sjodogne/orthanc/issues/165/
+     **/
+    if (boundary.size() != 36 + 1 + 36)  // one UUID contains 36 characters
+    {
+      throw OrthancException(ErrorCode_InternalError);
+    }
+    
+    boundary = boundary.substr(0, 70);
+    
     contentTypeHeader = ("multipart/" + subType + "; type=" + tmp + "; boundary=" + boundary);
   }
 
--- a/NEWS	Thu Jan 16 12:50:06 2020 +0100
+++ b/NEWS	Thu Jan 23 12:58:08 2020 +0100
@@ -15,6 +15,7 @@
 * C-Find SCU at Instance level now sets the 0008,0052 tag to IMAGE per default (was INSTANCE).
   Therefore, the "ClearCanvas" and "Dcm4Chee" modality manufacturer have now been deprecated.
 * Fix issue #156 (Chunked Dicom-web transfer uses 100% CPU)
+* Fix issue #165 (Boundary parameter in multipart Content-Type is too long)
 * /instances/{id}/preview route now takes the windowing into account
 
 Version 1.5.8 (2019-10-16)