changeset 580:1a5b52c8e785

removed useless function ParseContentType
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 28 Jun 2023 11:43:10 +0200
parents 9fa6f5098127
children d32e224e1758
files Plugin/Configuration.cpp Plugin/Configuration.h UnitTestsSources/UnitTestsMain.cpp
diffstat 3 files changed, 0 insertions(+), 66 deletions(-) [+]
line wrap: on
line diff
--- 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<std::string, std::string>& attributes,
-                        const std::string& header)
-  {
-    application.clear();
-    attributes.clear();
-
-    std::vector<std::string> 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<std::string, std::string>& target,
                              const Json::Value& value)
   {
--- 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<std::string, std::string>& attributes,
-                        const std::string& header);
-
   void ParseAssociativeArray(std::map<std::string, std::string>& target,
                              const Json::Value& value,
                              const std::string& key);
--- 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<std::string, std::string> 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<std::string> servers;