diff OrthancFramework/Sources/HttpServer/HttpContentNegociation.cpp @ 5339:cb11e5ced4e3

added tests from issue #216
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 28 Jun 2023 10:32:58 +0200
parents 78c59b02b121
children f41e1f635c4d
line wrap: on
line diff
--- a/OrthancFramework/Sources/HttpServer/HttpContentNegociation.cpp	Wed Jun 28 08:29:43 2023 +0200
+++ b/OrthancFramework/Sources/HttpServer/HttpContentNegociation.cpp	Wed Jun 28 10:32:58 2023 +0200
@@ -66,7 +66,6 @@
     const Handler&  handler_;
     uint8_t         level_;
     float           quality_;
-    std::string     application_;
     Dictionary      parameters_;
 
     static float GetQuality(const Dictionary& parameters)
@@ -111,7 +110,6 @@
               const Dictionary& parameters) :
       handler_(handler),
       quality_(GetQuality(parameters)),
-      application_(type + "/" + subtype),
       parameters_(parameters)
     {
       if (type == "*" && subtype == "*")
@@ -248,7 +246,17 @@
         {
           std::string key, value;
           
-          if (!SplitPair(key, value, tokens[i], '='))
+          if (SplitPair(key, value, tokens[i], '='))
+          {
+            // Remove the enclosing quotes, if present
+            if (!value.empty() &&
+                value[0] == '"' &&
+                value[value.size() - 1] == '"')
+            {
+              value = value.substr(1, value.size() - 2);
+            }
+          }
+          else
           {
             key = Toolbox::StripSpaces(tokens[i]);
             value = "";