# HG changeset patch # User Sebastien Jodogne # Date 1687945390 -7200 # Node ID 1a5b52c8e78528064c9ca71035668dc533167fa6 # Parent 9fa6f509812793b99cba3a047cccb61db230ad69 removed useless function ParseContentType diff -r 9fa6f5098127 -r 1a5b52c8e785 Plugin/Configuration.cpp --- a/Plugin/Configuration.cpp Wed Jun 28 11:40:34 2023 +0200 +++ b/Plugin/Configuration.cpp Wed Jun 28 11:43:10 2023 +0200 @@ -67,37 +67,6 @@ } - void ParseContentType(std::string& application, - std::map& attributes, - const std::string& header) - { - application.clear(); - attributes.clear(); - - std::vector tokens; - Orthanc::Toolbox::TokenizeString(tokens, header, ';'); - - assert(tokens.size() > 0); - application = tokens[0]; - application = Orthanc::Toolbox::StripSpaces(application); - Orthanc::Toolbox::ToLowerCase(application); - - boost::regex pattern("\\s*([^=]+)\\s*=\\s*(([^=\"]+)|\"([^=\"]+)\")\\s*"); - - for (size_t i = 1; i < tokens.size(); i++) - { - boost::cmatch what; - if (boost::regex_match(tokens[i].c_str(), what, pattern)) - { - std::string key(what[1]); - std::string value(what.length(3) != 0 ? what[3] : what[4]); - Orthanc::Toolbox::ToLowerCase(key); - attributes[key] = value; - } - } - } - - void ParseAssociativeArray(std::map& target, const Json::Value& value) { diff -r 9fa6f5098127 -r 1a5b52c8e785 Plugin/Configuration.h --- a/Plugin/Configuration.h Wed Jun 28 11:40:34 2023 +0200 +++ b/Plugin/Configuration.h Wed Jun 28 11:43:10 2023 +0200 @@ -58,10 +58,6 @@ const OrthancPluginHttpRequest* request, const std::string& header); - void ParseContentType(std::string& application, - std::map& attributes, - const std::string& header); - void ParseAssociativeArray(std::map& target, const Json::Value& value, const std::string& key); diff -r 9fa6f5098127 -r 1a5b52c8e785 UnitTestsSources/UnitTestsMain.cpp --- a/UnitTestsSources/UnitTestsMain.cpp Wed Jun 28 11:40:34 2023 +0200 +++ b/UnitTestsSources/UnitTestsMain.cpp Wed Jun 28 11:43:10 2023 +0200 @@ -32,37 +32,6 @@ OrthancPluginContext* context_ = NULL; -// TODO => Remove this test (now in Orthanc core) -TEST(Toolbox, ParseContentType) -{ - std::string c; - std::map a; - - ParseContentType(c, a, " Multipart/Related ; TYPE=Application/Dicom; Boundary=heLLO"); - ASSERT_EQ(c, "multipart/related"); - ASSERT_EQ(2u, a.size()); - ASSERT_EQ(a["type"], "Application/Dicom"); - ASSERT_EQ(a["boundary"], "heLLO"); - - // The WADO-RS client must support the case where the WADO-RS server - // escapes the "type" subfield in the Content-Type header - // cf. https://tools.ietf.org/html/rfc7231#section-3.1.1.1 - ParseContentType(c, a, "Multipart/Related; TYPE=\"Application/Dicom\" ; Boundary=heLLO"); - ASSERT_EQ(c, "multipart/related"); - ASSERT_EQ(2u, a.size()); - ASSERT_EQ(a["type"], "Application/Dicom"); - ASSERT_EQ(a["boundary"], "heLLO"); - - ParseContentType(c, a, ""); - ASSERT_TRUE(c.empty()); - ASSERT_EQ(0u, a.size()); - - ParseContentType(c, a, "multipart/related"); - ASSERT_EQ(c, "multipart/related"); - ASSERT_EQ(0u, a.size()); -} - - TEST(DicomWebServers, Serialization) { std::list servers;