diff Core/HttpServer/HttpHandler.cpp @ 912:dcb2469f00f4 plugins

PluginsHttpHandler::RestApiGet
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 20 Jun 2014 14:55:24 +0200
parents a811bdf8b8eb
children 6e7e5ed91c2d
line wrap: on
line diff
--- a/Core/HttpServer/HttpHandler.cpp	Fri Jun 20 13:45:22 2014 +0200
+++ b/Core/HttpServer/HttpHandler.cpp	Fri Jun 20 14:55:24 2014 +0200
@@ -34,6 +34,8 @@
 #include "HttpHandler.h"
 
 #include <string.h>
+#include <iostream>
+
 
 namespace Orthanc
 {
@@ -62,7 +64,7 @@
   }
 
 
-  void HttpHandler::ParseGetQuery(HttpHandler::Arguments& result, const char* query)
+  void HttpHandler::ParseGetArguments(HttpHandler::Arguments& result, const char* query)
   {
     const char* pos = query;
 
@@ -84,6 +86,24 @@
   }
 
 
+  void  HttpHandler::ParseGetQuery(UriComponents& uri,
+                                   HttpHandler::Arguments& getArguments, 
+                                   const char* query)
+  {
+    const char *questionMark = ::strchr(query, '?');
+    if (questionMark == NULL)
+    {
+      // No question mark in the string
+      Toolbox::SplitUriComponents(uri, query);
+      getArguments.clear();
+    }
+    else
+    {
+      Toolbox::SplitUriComponents(uri, std::string(query, questionMark));
+      HttpHandler::ParseGetArguments(getArguments, questionMark + 1);
+    }    
+  }
+
 
   std::string HttpHandler::GetArgument(const Arguments& getArguments,
                                        const std::string& name,