comparison Core/HttpServer/HttpOutput.cpp @ 3616:b6a569e6e85b

author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 23 Jan 2020 12:58:08 +0100
parents f6fe095f7130
children 94f4a18a79cc
comparison
equal deleted inserted replaced
3601:a77e7839012a 3616:b6a569e6e85b
461 // Quote the content type because of the forward slash 461 // Quote the content type because of the forward slash
462 tmp = "\"" + contentType + "\""; 462 tmp = "\"" + contentType + "\"";
463 } 463 }
464 464
465 boundary = Toolbox::GenerateUuid() + "-" + Toolbox::GenerateUuid(); 465 boundary = Toolbox::GenerateUuid() + "-" + Toolbox::GenerateUuid();
466
467 /**
468 * Fix for issue #165: "Encapsulation boundaries must not appear
469 * within the encapsulations, and must be no longer than 70
470 * characters, not counting the two leading hyphens."
471 * https://tools.ietf.org/html/rfc1521
472 * https://bitbucket.org/sjodogne/orthanc/issues/165/
473 **/
474 if (boundary.size() != 36 + 1 + 36) // one UUID contains 36 characters
475 {
476 throw OrthancException(ErrorCode_InternalError);
477 }
478
479 boundary = boundary.substr(0, 70);
480
466 contentTypeHeader = ("multipart/" + subType + "; type=" + tmp + "; boundary=" + boundary); 481 contentTypeHeader = ("multipart/" + subType + "; type=" + tmp + "; boundary=" + boundary);
467 } 482 }
468 483
469 484
470 void HttpOutput::StateMachine::StartMultipart(const std::string& subType, 485 void HttpOutput::StateMachine::StartMultipart(const std::string& subType,