changeset 181:35ef213139df

WADO-RS client: support for servers that quote their content-type header
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 02 Feb 2017 15:22:45 +0100 (2017-02-02)
parents 7e1fc6a3eb45
children e351748bdbd4
files Plugin/DicomWebClient.cpp
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Plugin/DicomWebClient.cpp	Tue Jan 24 16:16:29 2017 +0100
+++ b/Plugin/DicomWebClient.cpp	Thu Feb 02 15:22:45 2017 +0100
@@ -518,6 +518,18 @@
       if (s == "type")
       {
         type = Orthanc::Toolbox::StripSpaces(tokens[1]);
+
+        // This covers the case where the content-type is quoted,
+        // which COULD be the case 
+        // cf. https://tools.ietf.org/html/rfc7231#section-3.1.1.1
+        size_t len = type.length();
+        if (len >= 2 &&
+            type[0] == '"' &&
+            type[len - 1] == '"')
+        {
+          type = type.substr(1, len - 2);
+        }
+        
         Orthanc::Toolbox::ToLowerCase(type);
       }
       else if (s == "boundary")