Mercurial > hg > orthanc
diff Core/HttpServer/HttpOutput.cpp @ 3786:3801435e34a1 SylvainRouquette/fix-issue169-95b752c
integration Orthanc-1.6.0->SylvainRouquette
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 19 Mar 2020 11:48:30 +0100 |
parents | 94f4a18a79cc |
children |
line wrap: on
line diff
--- a/Core/HttpServer/HttpOutput.cpp Wed Mar 18 08:59:06 2020 +0100 +++ b/Core/HttpServer/HttpOutput.cpp Thu Mar 19 11:48:30 2020 +0100 @@ -2,7 +2,7 @@ * Orthanc - A Lightweight, RESTful DICOM Store * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium - * Copyright (C) 2017-2019 Osimis S.A., Belgium + * Copyright (C) 2017-2020 Osimis S.A., Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -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); }