# HG changeset patch # User Sebastien Jodogne # Date 1606311550 -3600 # Node ID a01b1c9cbef442bc951d087fc58450e78d011640 # Parent 9dc0e42f868b9cc9df1efde71f9689f4d0617f12 moving generic type definitions from IHttpHandler to HttpToolbox diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake --- a/OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancFramework/Resources/CMake/OrthancFrameworkConfiguration.cmake Wed Nov 25 14:39:10 2020 +0100 @@ -154,6 +154,7 @@ ${CMAKE_CURRENT_LIST_DIR}/../../Sources/Enumerations.cpp ${CMAKE_CURRENT_LIST_DIR}/../../Sources/FileStorage/MemoryStorageArea.cpp ${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/HttpContentNegociation.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/HttpToolbox.cpp ${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/MultipartStreamReader.cpp ${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/StringMatcher.cpp ${CMAKE_CURRENT_LIST_DIR}/../../Sources/Logging.cpp @@ -306,7 +307,6 @@ ${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/HttpOutput.cpp ${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/HttpServer.cpp ${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/HttpStreamTranscoder.cpp - ${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/HttpToolbox.cpp ${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/IHttpHandler.cpp ${CMAKE_CURRENT_LIST_DIR}/../../Sources/HttpServer/StringHttpOutput.cpp ${CMAKE_CURRENT_LIST_DIR}/../../Sources/RestApi/RestApi.cpp diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancFramework/Sources/HttpServer/FilesystemHttpHandler.cpp --- a/OrthancFramework/Sources/HttpServer/FilesystemHttpHandler.cpp Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancFramework/Sources/HttpServer/FilesystemHttpHandler.cpp Wed Nov 25 14:39:10 2020 +0100 @@ -41,7 +41,7 @@ static void OutputDirectoryContent(HttpOutput& output, - const IHttpHandler::Arguments& headers, + const HttpToolbox::Arguments& headers, const UriComponents& uri, const boost::filesystem::path& p) { @@ -117,17 +117,16 @@ } - bool FilesystemHttpHandler::Handle( - HttpOutput& output, - RequestOrigin /*origin*/, - const char* /*remoteIp*/, - const char* /*username*/, - HttpMethod method, - const UriComponents& uri, - const Arguments& headers, - const GetArguments& arguments, - const void* /*bodyData*/, - size_t /*bodySize*/) + bool FilesystemHttpHandler::Handle(HttpOutput& output, + RequestOrigin /*origin*/, + const char* /*remoteIp*/, + const char* /*username*/, + HttpMethod method, + const UriComponents& uri, + const HttpToolbox::Arguments& headers, + const HttpToolbox::GetArguments& arguments, + const void* /*bodyData*/, + size_t /*bodySize*/) { if (!Toolbox::IsChildUri(pimpl_->baseUri_, uri)) { diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancFramework/Sources/HttpServer/FilesystemHttpHandler.h --- a/OrthancFramework/Sources/HttpServer/FilesystemHttpHandler.h Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancFramework/Sources/HttpServer/FilesystemHttpHandler.h Wed Nov 25 14:39:10 2020 +0100 @@ -48,22 +48,21 @@ const char* username, HttpMethod method, const UriComponents& uri, - const Arguments& headers) + const HttpToolbox::Arguments& headers) { return false; } - virtual bool Handle( - HttpOutput& output, - RequestOrigin origin, - const char* remoteIp, - const char* username, - HttpMethod method, - const UriComponents& uri, - const Arguments& headers, - const GetArguments& arguments, - const void* /*bodyData*/, - size_t /*bodySize*/); + virtual bool Handle(HttpOutput& output, + RequestOrigin origin, + const char* remoteIp, + const char* username, + HttpMethod method, + const UriComponents& uri, + const HttpToolbox::Arguments& headers, + const HttpToolbox::GetArguments& arguments, + const void* /*bodyData*/, + size_t /*bodySize*/); bool IsListDirectoryContent() const { diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancFramework/Sources/HttpServer/HttpServer.cpp --- a/OrthancFramework/Sources/HttpServer/HttpServer.cpp Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancFramework/Sources/HttpServer/HttpServer.cpp Wed Nov 25 14:39:10 2020 +0100 @@ -31,6 +31,7 @@ #include "../OrthancException.h" #include "../TemporaryFile.h" #include "HttpToolbox.h" +#include "IHttpHandler.h" #if ORTHANC_ENABLE_PUGIXML == 1 # include "IWebDavBucket.h" @@ -379,9 +380,9 @@ static PostDataStatus ReadBodyToString(std::string& body, struct mg_connection *connection, - const IHttpHandler::Arguments& headers) + const HttpToolbox::Arguments& headers) { - IHttpHandler::Arguments::const_iterator contentLength = headers.find("content-length"); + HttpToolbox::Arguments::const_iterator contentLength = headers.find("content-length"); if (contentLength != headers.end()) { @@ -398,9 +399,9 @@ static PostDataStatus ReadBodyToStream(IHttpHandler::IChunkedRequestReader& stream, struct mg_connection *connection, - const IHttpHandler::Arguments& headers) + const HttpToolbox::Arguments& headers) { - IHttpHandler::Arguments::const_iterator contentLength = headers.find("content-length"); + HttpToolbox::Arguments::const_iterator contentLength = headers.find("content-length"); if (contentLength != headers.end()) { @@ -445,7 +446,7 @@ static PostDataStatus ParseMultipartForm(std::string &completedFile, struct mg_connection *connection, - const IHttpHandler::Arguments& headers, + const HttpToolbox::Arguments& headers, const std::string& contentType, ChunkStore& chunkStore) { @@ -459,13 +460,13 @@ return status; } - /*for (IHttpHandler::Arguments::const_iterator i = headers.begin(); i != headers.end(); i++) + /*for (HttpToolbox::Arguments::const_iterator i = headers.begin(); i != headers.end(); i++) { std::cout << "Header [" << i->first << "] = " << i->second << "\n"; } printf("CHUNK\n");*/ - typedef IHttpHandler::Arguments::const_iterator ArgumentIterator; + typedef HttpToolbox::Arguments::const_iterator ArgumentIterator; ArgumentIterator requestedWith = headers.find("x-requested-with"); ArgumentIterator fileName = headers.find("x-file-name"); @@ -545,11 +546,11 @@ static bool IsAccessGranted(const HttpServer& that, - const IHttpHandler::Arguments& headers) + const HttpToolbox::Arguments& headers) { bool granted = false; - IHttpHandler::Arguments::const_iterator auth = headers.find("authorization"); + HttpToolbox::Arguments::const_iterator auth = headers.find("authorization"); if (auth != headers.end()) { std::string s = auth->second; @@ -565,9 +566,9 @@ } - static std::string GetAuthenticatedUsername(const IHttpHandler::Arguments& headers) + static std::string GetAuthenticatedUsername(const HttpToolbox::Arguments& headers) { - IHttpHandler::Arguments::const_iterator auth = headers.find("authorization"); + HttpToolbox::Arguments::const_iterator auth = headers.find("authorization"); if (auth == headers.end()) { @@ -600,15 +601,15 @@ static bool ExtractMethod(HttpMethod& method, const struct mg_request_info *request, - const IHttpHandler::Arguments& headers, - const IHttpHandler::GetArguments& argumentsGET) + const HttpToolbox::Arguments& headers, + const HttpToolbox::GetArguments& argumentsGET) { std::string overriden; // Check whether some PUT/DELETE faking is done // 1. Faking with Google's approach - IHttpHandler::Arguments::const_iterator methodOverride = + HttpToolbox::Arguments::const_iterator methodOverride = headers.find("x-http-method-override"); if (methodOverride != headers.end()) @@ -679,11 +680,11 @@ static void ConfigureHttpCompression(HttpOutput& output, - const IHttpHandler::Arguments& headers) + const HttpToolbox::Arguments& headers) { // Look if the client wishes HTTP compression // https://en.wikipedia.org/wiki/HTTP_compression - IHttpHandler::Arguments::const_iterator it = headers.find("accept-encoding"); + HttpToolbox::Arguments::const_iterator it = headers.find("accept-encoding"); if (it != headers.end()) { std::vector encodings; @@ -720,7 +721,7 @@ static bool HandleWebDav(HttpOutput& output, const HttpServer::WebDavBuckets& buckets, const std::string& method, - const IHttpHandler::Arguments& headers, + const HttpToolbox::Arguments& headers, const std::string& uri, struct mg_connection *connection /* to read the PUT body if need be */) { @@ -801,7 +802,7 @@ if (method == "PROPFIND") { - IHttpHandler::Arguments::const_iterator i = headers.find("depth"); + HttpToolbox::Arguments::const_iterator i = headers.find("depth"); if (i == headers.end()) { throw OrthancException(ErrorCode_NetworkProtocol, "WebDAV PROPFIND without depth"); @@ -1080,7 +1081,7 @@ // Extract the HTTP headers - IHttpHandler::Arguments headers; + HttpToolbox::Arguments headers; for (int i = 0; i < request->num_headers; i++) { std::string name = request->http_headers[i].name; @@ -1098,7 +1099,7 @@ // Extract the GET arguments - IHttpHandler::GetArguments argumentsGET; + HttpToolbox::GetArguments argumentsGET; if (!strcmp(request->request_method, "GET")) { HttpToolbox::ParseGetArguments(argumentsGET, request->query_string); @@ -1241,7 +1242,7 @@ bool isMultipartForm = false; - IHttpHandler::Arguments::const_iterator ct = headers.find("content-type"); + HttpToolbox::Arguments::const_iterator ct = headers.find("content-type"); if (ct != headers.end() && ct->second.size() >= MULTIPART_FORM_LENGTH && !memcmp(ct->second.c_str(), MULTIPART_FORM, MULTIPART_FORM_LENGTH)) diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancFramework/Sources/HttpServer/HttpToolbox.cpp --- a/OrthancFramework/Sources/HttpServer/HttpToolbox.cpp Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancFramework/Sources/HttpServer/HttpToolbox.cpp Wed Nov 25 14:39:10 2020 +0100 @@ -25,10 +25,14 @@ #include +#if ORTHANC_SANDBOXED != 1 +# include "IHttpHandler.h" +#endif + namespace Orthanc { - static void SplitGETNameValue(IHttpHandler::GetArguments& result, + static void SplitGETNameValue(HttpToolbox::GetArguments& result, const char* start, const char* end) { @@ -53,7 +57,7 @@ } - void HttpToolbox::ParseGetArguments(IHttpHandler::GetArguments& result, + void HttpToolbox::ParseGetArguments(GetArguments& result, const char* query) { const char* pos = query; @@ -77,7 +81,7 @@ void HttpToolbox::ParseGetQuery(UriComponents& uri, - IHttpHandler::GetArguments& getArguments, + GetArguments& getArguments, const char* query) { const char *questionMark = ::strchr(query, '?'); @@ -95,11 +99,11 @@ } - std::string HttpToolbox::GetArgument(const IHttpHandler::Arguments& getArguments, + std::string HttpToolbox::GetArgument(const Arguments& getArguments, const std::string& name, const std::string& defaultValue) { - IHttpHandler::Arguments::const_iterator it = getArguments.find(name); + Arguments::const_iterator it = getArguments.find(name); if (it == getArguments.end()) { return defaultValue; @@ -111,7 +115,7 @@ } - std::string HttpToolbox::GetArgument(const IHttpHandler::GetArguments& getArguments, + std::string HttpToolbox::GetArgument(const GetArguments& getArguments, const std::string& name, const std::string& defaultValue) { @@ -128,12 +132,12 @@ - void HttpToolbox::ParseCookies(IHttpHandler::Arguments& result, - const IHttpHandler::Arguments& httpHeaders) + void HttpToolbox::ParseCookies(Arguments& result, + const Arguments& httpHeaders) { result.clear(); - IHttpHandler::Arguments::const_iterator it = httpHeaders.find("cookie"); + Arguments::const_iterator it = httpHeaders.find("cookie"); if (it != httpHeaders.end()) { const std::string& cookies = it->second; @@ -167,8 +171,8 @@ } - void HttpToolbox::CompileGetArguments(IHttpHandler::Arguments& compiled, - const IHttpHandler::GetArguments& source) + void HttpToolbox::CompileGetArguments(Arguments& compiled, + const GetArguments& source) { compiled.clear(); @@ -177,4 +181,47 @@ compiled[source[i].first] = source[i].second; } } + + + +#if ORTHANC_SANDBOXED != 1 + bool HttpToolbox::SimpleGet(std::string& result, + IHttpHandler& handler, + RequestOrigin origin, + const std::string& uri, + const Arguments& httpHeaders) + { + return IHttpHandler::SimpleGet(result, handler, origin, uri, httpHeaders); + } + + bool HttpToolbox::SimplePost(std::string& result, + IHttpHandler& handler, + RequestOrigin origin, + const std::string& uri, + const void* bodyData, + size_t bodySize, + const Arguments& httpHeaders) + { + return IHttpHandler::SimplePost(result, handler, origin, uri, bodyData, bodySize, httpHeaders); + } + + bool HttpToolbox::SimplePut(std::string& result, + IHttpHandler& handler, + RequestOrigin origin, + const std::string& uri, + const void* bodyData, + size_t bodySize, + const Arguments& httpHeaders) + { + return IHttpHandler::SimplePut(result, handler, origin, uri, bodyData, bodySize, httpHeaders); + } + + bool HttpToolbox::SimpleDelete(IHttpHandler& handler, + RequestOrigin origin, + const std::string& uri, + const Arguments& httpHeaders) + { + return IHttpHandler::SimpleDelete(handler, origin, uri, httpHeaders); + } +#endif } diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancFramework/Sources/HttpServer/HttpToolbox.h --- a/OrthancFramework/Sources/HttpServer/HttpToolbox.h Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancFramework/Sources/HttpServer/HttpToolbox.h Wed Nov 25 14:39:10 2020 +0100 @@ -22,33 +22,86 @@ #pragma once +#if !defined(ORTHANC_SANDBOXED) +# error Macro ORTHANC_SANDBOXED must be defined +#endif + +#include "../Compatibility.h" #include "../OrthancFramework.h" -#include "IHttpHandler.h" +#include "../Toolbox.h" + +#include +#include +#include namespace Orthanc { + class IHttpHandler; + class ORTHANC_PUBLIC HttpToolbox : public boost::noncopyable { public: - static void ParseGetArguments(IHttpHandler::GetArguments& result, + typedef std::map Arguments; + typedef std::vector< std::pair > GetArguments; + + static void ParseGetArguments(GetArguments& result, const char* query); static void ParseGetQuery(UriComponents& uri, - IHttpHandler::GetArguments& getArguments, + GetArguments& getArguments, const char* query); - static std::string GetArgument(const IHttpHandler::Arguments& getArguments, + static std::string GetArgument(const Arguments& getArguments, + const std::string& name, + const std::string& defaultValue); + + static std::string GetArgument(const GetArguments& getArguments, const std::string& name, const std::string& defaultValue); - static std::string GetArgument(const IHttpHandler::GetArguments& getArguments, - const std::string& name, - const std::string& defaultValue); + static void ParseCookies(Arguments& result, + const Arguments& httpHeaders); + + static void CompileGetArguments(Arguments& compiled, + const GetArguments& source); - static void ParseCookies(IHttpHandler::Arguments& result, - const IHttpHandler::Arguments& httpHeaders); +#if ORTHANC_SANDBOXED != 1 + ORTHANC_DEPRECATED + static bool SimpleGet(std::string& result, + IHttpHandler& handler, + RequestOrigin origin, + const std::string& uri, + const Arguments& httpHeaders); +#endif + +#if ORTHANC_SANDBOXED != 1 + ORTHANC_DEPRECATED + static bool SimplePost(std::string& result, + IHttpHandler& handler, + RequestOrigin origin, + const std::string& uri, + const void* bodyData, + size_t bodySize, + const Arguments& httpHeaders); +#endif - static void CompileGetArguments(IHttpHandler::Arguments& compiled, - const IHttpHandler::GetArguments& source); +#if ORTHANC_SANDBOXED != 1 + ORTHANC_DEPRECATED + static bool SimplePut(std::string& result, + IHttpHandler& handler, + RequestOrigin origin, + const std::string& uri, + const void* bodyData, + size_t bodySize, + const Arguments& httpHeaders); +#endif + +#if ORTHANC_SANDBOXED != 1 + ORTHANC_DEPRECATED + static bool SimpleDelete(IHttpHandler& handler, + RequestOrigin origin, + const std::string& uri, + const Arguments& httpHeaders); +#endif }; } diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancFramework/Sources/HttpServer/IHttpHandler.cpp --- a/OrthancFramework/Sources/HttpServer/IHttpHandler.cpp Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancFramework/Sources/HttpServer/IHttpHandler.cpp Wed Nov 25 14:39:10 2020 +0100 @@ -36,10 +36,10 @@ IHttpHandler& handler, RequestOrigin origin, const std::string& uri, - const IHttpHandler::Arguments& httpHeaders) + const HttpToolbox::Arguments& httpHeaders) { UriComponents curi; - IHttpHandler::GetArguments getArguments; + HttpToolbox::GetArguments getArguments; HttpToolbox::ParseGetQuery(curi, getArguments, uri.c_str()); StringHttpOutput stream; @@ -65,9 +65,9 @@ const std::string& uri, const void* bodyData, size_t bodySize, - const IHttpHandler::Arguments& httpHeaders) + const HttpToolbox::Arguments& httpHeaders) { - IHttpHandler::GetArguments getArguments; // No GET argument for POST/PUT + HttpToolbox::GetArguments getArguments; // No GET argument for POST/PUT UriComponents curi; Toolbox::SplitUriComponents(curi, uri); @@ -94,7 +94,7 @@ const std::string& uri, const void* bodyData, size_t bodySize, - const IHttpHandler::Arguments& httpHeaders) + const HttpToolbox::Arguments& httpHeaders) { return SimplePostOrPut(result, handler, origin, HttpMethod_Post, uri, bodyData, bodySize, httpHeaders); } @@ -106,7 +106,7 @@ const std::string& uri, const void* bodyData, size_t bodySize, - const IHttpHandler::Arguments& httpHeaders) + const HttpToolbox::Arguments& httpHeaders) { return SimplePostOrPut(result, handler, origin, HttpMethod_Put, uri, bodyData, bodySize, httpHeaders); } @@ -115,12 +115,12 @@ bool IHttpHandler::SimpleDelete(IHttpHandler& handler, RequestOrigin origin, const std::string& uri, - const IHttpHandler::Arguments& httpHeaders) + const HttpToolbox::Arguments& httpHeaders) { UriComponents curi; Toolbox::SplitUriComponents(curi, uri); - IHttpHandler::GetArguments getArguments; // No GET argument for DELETE + HttpToolbox::GetArguments getArguments; // No GET argument for DELETE StringHttpOutput stream; HttpOutput http(stream, false /* no keep alive */); diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancFramework/Sources/HttpServer/IHttpHandler.h --- a/OrthancFramework/Sources/HttpServer/IHttpHandler.h Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancFramework/Sources/HttpServer/IHttpHandler.h Wed Nov 25 14:39:10 2020 +0100 @@ -22,9 +22,14 @@ #pragma once +#if ORTHANC_SANDBOXED == 1 +# error This file cannot be used in sandboxed environments +#endif + #include "../Compatibility.h" #include "../Toolbox.h" #include "HttpOutput.h" +#include "HttpToolbox.h" #include #include @@ -37,10 +42,6 @@ class IHttpHandler : public boost::noncopyable { public: - typedef std::map Arguments; - typedef std::vector< std::pair > GetArguments; - - class IChunkedRequestReader : public boost::noncopyable { public: @@ -69,7 +70,7 @@ const char* username, HttpMethod method, const UriComponents& uri, - const Arguments& headers) = 0; + const HttpToolbox::Arguments& headers) = 0; virtual bool Handle(HttpOutput& output, RequestOrigin origin, @@ -77,8 +78,8 @@ const char* username, HttpMethod method, const UriComponents& uri, - const Arguments& headers, - const GetArguments& getArguments, + const HttpToolbox::Arguments& headers, + const HttpToolbox::GetArguments& getArguments, const void* bodyData, size_t bodySize) = 0; @@ -86,7 +87,7 @@ IHttpHandler& handler, RequestOrigin origin, const std::string& uri, - const Arguments& httpHeaders); + const HttpToolbox::Arguments& httpHeaders); static bool SimplePost(std::string& result, IHttpHandler& handler, @@ -94,7 +95,7 @@ const std::string& uri, const void* bodyData, size_t bodySize, - const Arguments& httpHeaders); + const HttpToolbox::Arguments& httpHeaders); static bool SimplePut(std::string& result, IHttpHandler& handler, @@ -102,11 +103,11 @@ const std::string& uri, const void* bodyData, size_t bodySize, - const Arguments& httpHeaders); + const HttpToolbox::Arguments& httpHeaders); static bool SimpleDelete(IHttpHandler& handler, RequestOrigin origin, const std::string& uri, - const Arguments& httpHeaders); + const HttpToolbox::Arguments& httpHeaders); }; } diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancFramework/Sources/HttpServer/IIncomingHttpRequestFilter.h --- a/OrthancFramework/Sources/HttpServer/IIncomingHttpRequestFilter.h Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancFramework/Sources/HttpServer/IIncomingHttpRequestFilter.h Wed Nov 25 14:39:10 2020 +0100 @@ -22,7 +22,7 @@ #pragma once -#include "IHttpHandler.h" +#include "HttpToolbox.h" namespace Orthanc { @@ -37,7 +37,7 @@ const char* uri, const char* ip, const char* username, - const IHttpHandler::Arguments& httpHeaders, - const IHttpHandler::GetArguments& getArguments) = 0; + const HttpToolbox::Arguments& httpHeaders, + const HttpToolbox::GetArguments& getArguments) = 0; }; } diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancFramework/Sources/RestApi/RestApi.cpp --- a/OrthancFramework/Sources/RestApi/RestApi.cpp Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancFramework/Sources/RestApi/RestApi.cpp Wed Nov 25 14:39:10 2020 +0100 @@ -42,8 +42,8 @@ const char* remoteIp_; const char* username_; HttpMethod method_; - const IHttpHandler::Arguments& headers_; - const IHttpHandler::Arguments& getArguments_; + const HttpToolbox::Arguments& headers_; + const HttpToolbox::Arguments& getArguments_; const void* bodyData_; size_t bodySize_; @@ -54,8 +54,8 @@ const char* remoteIp, const char* username, HttpMethod method, - const IHttpHandler::Arguments& headers, - const IHttpHandler::Arguments& getArguments, + const HttpToolbox::Arguments& headers, + const HttpToolbox::Arguments& getArguments, const void* bodyData, size_t bodySize) : api_(api), @@ -73,7 +73,7 @@ virtual bool Visit(const RestApiHierarchy::Resource& resource, const UriComponents& uri, - const IHttpHandler::Arguments& components, + const HttpToolbox::Arguments& components, const UriComponents& trailing) { if (resource.HasHandler(method_)) @@ -168,8 +168,8 @@ const char* username, HttpMethod method, const UriComponents& uri, - const Arguments& headers, - const GetArguments& getArguments, + const HttpToolbox::Arguments& headers, + const HttpToolbox::GetArguments& getArguments, const void* bodyData, size_t bodySize) { @@ -179,7 +179,7 @@ { // Look if the client wishes XML answers instead of JSON // http://www.w3.org/Protocols/HTTP/HTRQ_Headers.html#z3 - Arguments::const_iterator it = headers.find("accept"); + HttpToolbox::Arguments::const_iterator it = headers.find("accept"); if (it != headers.end()) { std::vector accepted; @@ -200,7 +200,7 @@ } #endif - Arguments compiled; + HttpToolbox::Arguments compiled; HttpToolbox::CompileGetArguments(compiled, getArguments); HttpHandlerVisitor visitor(*this, wrappedOutput, origin, remoteIp, username, diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancFramework/Sources/RestApi/RestApi.h --- a/OrthancFramework/Sources/RestApi/RestApi.h Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancFramework/Sources/RestApi/RestApi.h Wed Nov 25 14:39:10 2020 +0100 @@ -24,6 +24,7 @@ #include "RestApiHierarchy.h" #include "../Compatibility.h" +#include "../HttpServer/IHttpHandler.h" #include @@ -43,7 +44,7 @@ const char* username, HttpMethod method, const UriComponents& uri, - const Arguments& headers) + const HttpToolbox::Arguments& headers) { return false; } @@ -54,8 +55,8 @@ const char* username, HttpMethod method, const UriComponents& uri, - const Arguments& headers, - const GetArguments& getArguments, + const HttpToolbox::Arguments& headers, + const HttpToolbox::GetArguments& getArguments, const void* bodyData, size_t bodySize); diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancFramework/Sources/RestApi/RestApiCall.h --- a/OrthancFramework/Sources/RestApi/RestApiCall.h Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancFramework/Sources/RestApi/RestApiCall.h Wed Nov 25 14:39:10 2020 +0100 @@ -22,7 +22,6 @@ #pragma once -#include "../HttpServer/IHttpHandler.h" #include "../HttpServer/HttpToolbox.h" #include "RestApiPath.h" #include "RestApiOutput.h" @@ -41,8 +40,8 @@ RequestOrigin origin_; const char* remoteIp_; const char* username_; - const IHttpHandler::Arguments& httpHeaders_; - const IHttpHandler::Arguments& uriComponents_; + const HttpToolbox::Arguments& httpHeaders_; + const HttpToolbox::Arguments& uriComponents_; const UriComponents& trailing_; const UriComponents& fullUri_; @@ -57,8 +56,8 @@ RequestOrigin origin, const char* remoteIp, const char* username, - const IHttpHandler::Arguments& httpHeaders, - const IHttpHandler::Arguments& uriComponents, + const HttpToolbox::Arguments& httpHeaders, + const HttpToolbox::Arguments& uriComponents, const UriComponents& trailing, const UriComponents& fullUri) : output_(output), @@ -105,12 +104,12 @@ return HttpToolbox::GetArgument(httpHeaders_, name, defaultValue); } - const IHttpHandler::Arguments& GetHttpHeaders() const + const HttpToolbox::Arguments& GetHttpHeaders() const { return httpHeaders_; } - void ParseCookies(IHttpHandler::Arguments& result) const + void ParseCookies(HttpToolbox::Arguments& result) const { HttpToolbox::ParseCookies(result, httpHeaders_); } diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancFramework/Sources/RestApi/RestApiDeleteCall.h --- a/OrthancFramework/Sources/RestApi/RestApiDeleteCall.h Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancFramework/Sources/RestApi/RestApiDeleteCall.h Wed Nov 25 14:39:10 2020 +0100 @@ -36,8 +36,8 @@ RequestOrigin origin, const char* remoteIp, const char* username, - const IHttpHandler::Arguments& httpHeaders, - const IHttpHandler::Arguments& uriComponents, + const HttpToolbox::Arguments& httpHeaders, + const HttpToolbox::Arguments& uriComponents, const UriComponents& trailing, const UriComponents& fullUri) : RestApiCall(output, context, origin, remoteIp, username, diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancFramework/Sources/RestApi/RestApiGetCall.cpp --- a/OrthancFramework/Sources/RestApi/RestApiGetCall.cpp Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancFramework/Sources/RestApi/RestApiGetCall.cpp Wed Nov 25 14:39:10 2020 +0100 @@ -29,7 +29,7 @@ { result.clear(); - for (IHttpHandler::Arguments::const_iterator + for (HttpToolbox::Arguments::const_iterator it = getArguments_.begin(); it != getArguments_.end(); ++it) { result[it->first] = it->second; diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancFramework/Sources/RestApi/RestApiGetCall.h --- a/OrthancFramework/Sources/RestApi/RestApiGetCall.h Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancFramework/Sources/RestApi/RestApiGetCall.h Wed Nov 25 14:39:10 2020 +0100 @@ -29,7 +29,7 @@ class RestApiGetCall : public RestApiCall { private: - const IHttpHandler::Arguments& getArguments_; + const HttpToolbox::Arguments& getArguments_; public: typedef void (*Handler) (RestApiGetCall& call); @@ -39,11 +39,11 @@ RequestOrigin origin, const char* remoteIp, const char* username, - const IHttpHandler::Arguments& httpHeaders, - const IHttpHandler::Arguments& uriComponents, + const HttpToolbox::Arguments& httpHeaders, + const HttpToolbox::Arguments& uriComponents, const UriComponents& trailing, const UriComponents& fullUri, - const IHttpHandler::Arguments& getArguments) : + const HttpToolbox::Arguments& getArguments) : RestApiCall(output, context, origin, remoteIp, username, httpHeaders, uriComponents, trailing, fullUri), getArguments_(getArguments) diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancFramework/Sources/RestApi/RestApiHierarchy.cpp --- a/OrthancFramework/Sources/RestApi/RestApiHierarchy.cpp Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancFramework/Sources/RestApi/RestApiHierarchy.cpp Wed Nov 25 14:39:10 2020 +0100 @@ -210,10 +210,10 @@ } - bool RestApiHierarchy::LookupResource(IHttpHandler::Arguments& components, - const UriComponents& uri, - IVisitor& visitor, - size_t level) + bool RestApiHierarchy::LookupResource(HttpToolbox::Arguments& components, + const UriComponents& uri, + IVisitor& visitor, + size_t level) { if (uri.size() != 0 && level > uri.size()) @@ -224,8 +224,8 @@ UriComponents trailing; // Look for an exact match on the resource of interest - if (uri.size() == 0 || - level == uri.size()) + if (uri.size() == 0 || + level == uri.size()) { if (!handlers_.IsEmpty() && visitor.Visit(handlers_, uri, components, trailing)) @@ -251,7 +251,7 @@ for (child = wildcardChildren_.begin(); child != wildcardChildren_.end(); ++child) { - IHttpHandler::Arguments subComponents = components; + HttpToolbox::Arguments subComponents = components; subComponents[child->first] = uri[level]; if (child->second->LookupResource(subComponents, uri, visitor, level + 1)) @@ -420,7 +420,7 @@ bool RestApiHierarchy::LookupResource(const UriComponents& uri, IVisitor& visitor) { - IHttpHandler::Arguments components; + HttpToolbox::Arguments components; return LookupResource(components, uri, visitor, 0); } @@ -443,7 +443,7 @@ virtual bool Visit(const RestApiHierarchy::Resource& resource, const UriComponents& uri, - const IHttpHandler::Arguments& components, + const HttpToolbox::Arguments& components, const UriComponents& trailing) { if (trailing.size() == 0) // Ignore universal handlers @@ -477,7 +477,7 @@ void RestApiHierarchy::GetAcceptedMethods(std::set& methods, const UriComponents& uri) { - IHttpHandler::Arguments components; + HttpToolbox::Arguments components; AcceptedMethodsVisitor visitor(methods); if (LookupResource(components, uri, visitor, 0)) { diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancFramework/Sources/RestApi/RestApiHierarchy.h --- a/OrthancFramework/Sources/RestApi/RestApiHierarchy.h Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancFramework/Sources/RestApi/RestApiHierarchy.h Wed Nov 25 14:39:10 2020 +0100 @@ -76,7 +76,7 @@ virtual bool Visit(const Resource& resource, const UriComponents& uri, - const IHttpHandler::Arguments& components, + const HttpToolbox::Arguments& components, const UriComponents& trailing) = 0; }; @@ -101,7 +101,7 @@ bool CanGenerateDirectory() const; - bool LookupResource(IHttpHandler::Arguments& components, + bool LookupResource(HttpToolbox::Arguments& components, const UriComponents& uri, IVisitor& visitor, size_t level); diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancFramework/Sources/RestApi/RestApiPath.cpp --- a/OrthancFramework/Sources/RestApi/RestApiPath.cpp Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancFramework/Sources/RestApi/RestApiPath.cpp Wed Nov 25 14:39:10 2020 +0100 @@ -68,7 +68,7 @@ } } - bool RestApiPath::Match(IHttpHandler::Arguments& components, + bool RestApiPath::Match(HttpToolbox::Arguments& components, UriComponents& trailing, const std::string& uriRaw) const { @@ -77,7 +77,7 @@ return Match(components, trailing, uri); } - bool RestApiPath::Match(IHttpHandler::Arguments& components, + bool RestApiPath::Match(HttpToolbox::Arguments& components, UriComponents& trailing, const UriComponents& uri) const { @@ -125,7 +125,7 @@ bool RestApiPath::Match(const UriComponents& uri) const { - IHttpHandler::Arguments components; + HttpToolbox::Arguments components; UriComponents trailing; return Match(components, trailing, uri); } diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancFramework/Sources/RestApi/RestApiPath.h --- a/OrthancFramework/Sources/RestApi/RestApiPath.h Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancFramework/Sources/RestApi/RestApiPath.h Wed Nov 25 14:39:10 2020 +0100 @@ -22,8 +22,7 @@ #pragma once -#include "../Toolbox.h" -#include "../HttpServer/IHttpHandler.h" +#include "../HttpServer/HttpToolbox.h" #include @@ -40,11 +39,11 @@ explicit RestApiPath(const std::string& uri); // This version is slower - bool Match(IHttpHandler::Arguments& components, + bool Match(HttpToolbox::Arguments& components, UriComponents& trailing, const std::string& uriRaw) const; - bool Match(IHttpHandler::Arguments& components, + bool Match(HttpToolbox::Arguments& components, UriComponents& trailing, const UriComponents& uri) const; diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancFramework/Sources/RestApi/RestApiPostCall.h --- a/OrthancFramework/Sources/RestApi/RestApiPostCall.h Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancFramework/Sources/RestApi/RestApiPostCall.h Wed Nov 25 14:39:10 2020 +0100 @@ -40,8 +40,8 @@ RequestOrigin origin, const char* remoteIp, const char* username, - const IHttpHandler::Arguments& httpHeaders, - const IHttpHandler::Arguments& uriComponents, + const HttpToolbox::Arguments& httpHeaders, + const HttpToolbox::Arguments& uriComponents, const UriComponents& trailing, const UriComponents& fullUri, const void* bodyData, diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancFramework/Sources/RestApi/RestApiPutCall.h --- a/OrthancFramework/Sources/RestApi/RestApiPutCall.h Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancFramework/Sources/RestApi/RestApiPutCall.h Wed Nov 25 14:39:10 2020 +0100 @@ -40,8 +40,8 @@ RequestOrigin origin, const char* remoteIp, const char* username, - const IHttpHandler::Arguments& httpHeaders, - const IHttpHandler::Arguments& uriComponents, + const HttpToolbox::Arguments& httpHeaders, + const HttpToolbox::Arguments& uriComponents, const UriComponents& trailing, const UriComponents& fullUri, const void* bodyData, diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancFramework/UnitTestsSources/FrameworkTests.cpp --- a/OrthancFramework/UnitTestsSources/FrameworkTests.cpp Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancFramework/UnitTestsSources/FrameworkTests.cpp Wed Nov 25 14:39:10 2020 +0100 @@ -34,13 +34,13 @@ #include #include "../Sources/DicomFormat/DicomTag.h" +#include "../Sources/HttpServer/HttpToolbox.h" #include "../Sources/Logging.h" #include "../Sources/OrthancException.h" #include "../Sources/Toolbox.h" #if ORTHANC_SANDBOXED != 1 # include "../Sources/FileBuffer.h" -# include "../Sources/HttpServer/HttpToolbox.h" # include "../Sources/MetricsRegistry.h" # include "../Sources/SystemToolbox.h" # include "../Sources/TemporaryFile.h" @@ -101,13 +101,12 @@ } -#if ORTHANC_SANDBOXED != 1 TEST(ParseGetArguments, Basic) { - IHttpHandler::GetArguments b; + HttpToolbox::GetArguments b; HttpToolbox::ParseGetArguments(b, "aaa=baaa&bb=a&aa=c"); - IHttpHandler::Arguments a; + HttpToolbox::Arguments a; HttpToolbox::CompileGetArguments(a, b); ASSERT_EQ(3u, a.size()); @@ -115,15 +114,14 @@ ASSERT_EQ(a["bb"], "a"); ASSERT_EQ(a["aa"], "c"); } -#endif -#if ORTHANC_SANDBOXED != 1 + TEST(ParseGetArguments, BasicEmpty) { - IHttpHandler::GetArguments b; + HttpToolbox::GetArguments b; HttpToolbox::ParseGetArguments(b, "aaa&bb=aa&aa"); - IHttpHandler::Arguments a; + HttpToolbox::Arguments a; HttpToolbox::CompileGetArguments(a, b); ASSERT_EQ(3u, a.size()); @@ -131,44 +129,41 @@ ASSERT_EQ(a["bb"], "aa"); ASSERT_EQ(a["aa"], ""); } -#endif -#if ORTHANC_SANDBOXED != 1 + TEST(ParseGetArguments, Single) { - IHttpHandler::GetArguments b; + HttpToolbox::GetArguments b; HttpToolbox::ParseGetArguments(b, "aaa=baaa"); - IHttpHandler::Arguments a; + HttpToolbox::Arguments a; HttpToolbox::CompileGetArguments(a, b); ASSERT_EQ(1u, a.size()); ASSERT_EQ(a["aaa"], "baaa"); } -#endif -#if ORTHANC_SANDBOXED != 1 + TEST(ParseGetArguments, SingleEmpty) { - IHttpHandler::GetArguments b; + HttpToolbox::GetArguments b; HttpToolbox::ParseGetArguments(b, "aaa"); - IHttpHandler::Arguments a; + HttpToolbox::Arguments a; HttpToolbox::CompileGetArguments(a, b); ASSERT_EQ(1u, a.size()); ASSERT_EQ(a["aaa"], ""); } -#endif -#if ORTHANC_SANDBOXED != 1 + TEST(ParseGetQuery, Test1) { UriComponents uri; - IHttpHandler::GetArguments b; + HttpToolbox::GetArguments b; HttpToolbox::ParseGetQuery(uri, b, "/instances/test/world?aaa=baaa&bb=a&aa=c"); - IHttpHandler::Arguments a; + HttpToolbox::Arguments a; HttpToolbox::CompileGetArguments(a, b); ASSERT_EQ(3u, uri.size()); @@ -180,16 +175,15 @@ ASSERT_EQ(a["bb"], "a"); ASSERT_EQ(a["aa"], "c"); } -#endif -#if ORTHANC_SANDBOXED != 1 + TEST(ParseGetQuery, Test2) { UriComponents uri; - IHttpHandler::GetArguments b; + HttpToolbox::GetArguments b; HttpToolbox::ParseGetQuery(uri, b, "/instances/test/world"); - IHttpHandler::Arguments a; + HttpToolbox::Arguments a; HttpToolbox::CompileGetArguments(a, b); ASSERT_EQ(3u, uri.size()); @@ -198,7 +192,7 @@ ASSERT_EQ("world", uri[2]); ASSERT_EQ(0u, a.size()); } -#endif + TEST(Uri, SplitUriComponents) { diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancFramework/UnitTestsSources/RestApiTests.cpp --- a/OrthancFramework/UnitTestsSources/RestApiTests.cpp Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancFramework/UnitTestsSources/RestApiTests.cpp Wed Nov 25 14:39:10 2020 +0100 @@ -33,7 +33,6 @@ #include "../Sources/HttpServer/MultipartStreamReader.h" #include "../Sources/Logging.h" #include "../Sources/OrthancException.h" -#include "../Sources/RestApi/RestApi.h" #include "../Sources/RestApi/RestApiHierarchy.h" #include "../Sources/WebServiceParameters.h" @@ -41,6 +40,10 @@ #include #include +#if ORTHANC_SANDBOXED != 1 +# include "../Sources/RestApi/RestApi.h" +#endif + using namespace Orthanc; @@ -182,8 +185,8 @@ #if ORTHANC_SANDBOXED != 1 TEST(RestApi, ParseCookies) { - IHttpHandler::Arguments headers; - IHttpHandler::Arguments cookies; + HttpToolbox::Arguments headers; + HttpToolbox::Arguments cookies; headers["cookie"] = "a=b;c=d;;;e=f;;g=h;"; HttpToolbox::ParseCookies(cookies, headers); @@ -213,7 +216,7 @@ TEST(RestApi, RestApiPath) { - IHttpHandler::Arguments args; + HttpToolbox::Arguments args; UriComponents trail; { @@ -311,7 +314,7 @@ public: virtual bool Visit(const RestApiHierarchy::Resource& resource, const UriComponents& uri, - const IHttpHandler::Arguments& components, + const HttpToolbox::Arguments& components, const UriComponents& trailing) ORTHANC_OVERRIDE { return resource.Handle(*(RestApiGetCall*) NULL); @@ -979,6 +982,7 @@ #if ORTHANC_SANDBOXED != 1 + namespace { class TotoBody : public HttpClient::IRequestBody @@ -1034,7 +1038,7 @@ const char* username, HttpMethod method, const UriComponents& uri, - const Arguments& headers) ORTHANC_OVERRIDE + const HttpToolbox::Arguments& headers) ORTHANC_OVERRIDE { return false; } @@ -1045,8 +1049,8 @@ const char* username, HttpMethod method, const UriComponents& uri, - const Arguments& headers, - const GetArguments& getArguments, + const HttpToolbox::Arguments& headers, + const HttpToolbox::GetArguments& getArguments, const void* bodyData, size_t bodySize) ORTHANC_OVERRIDE { diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancServer/Plugins/Engine/OrthancPlugins.cpp --- a/OrthancServer/Plugins/Engine/OrthancPlugins.cpp Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancServer/Plugins/Engine/OrthancPlugins.cpp Wed Nov 25 14:39:10 2020 +0100 @@ -1495,13 +1495,13 @@ static void ArgumentsToPlugin(std::vector& keys, std::vector& values, - const IHttpHandler::Arguments& arguments) + const HttpToolbox::Arguments& arguments) { keys.resize(arguments.size()); values.resize(arguments.size()); size_t pos = 0; - for (IHttpHandler::Arguments::const_iterator + for (HttpToolbox::Arguments::const_iterator it = arguments.begin(); it != arguments.end(); ++it) { keys[pos] = it->first.c_str(); @@ -1513,7 +1513,7 @@ static void ArgumentsToPlugin(std::vector& keys, std::vector& values, - const IHttpHandler::GetArguments& arguments) + const HttpToolbox::GetArguments& arguments) { keys.resize(arguments.size()); values.resize(arguments.size()); @@ -1601,7 +1601,7 @@ public: HttpRequestConverter(const RestCallbackMatcher& matcher, HttpMethod method, - const IHttpHandler::Arguments& headers) + const HttpToolbox::Arguments& headers) { memset(&converted_, 0, sizeof(OrthancPluginHttpRequest)); @@ -1646,7 +1646,7 @@ } } - void SetGetArguments(const IHttpHandler::GetArguments& getArguments) + void SetGetArguments(const HttpToolbox::GetArguments& getArguments) { ArgumentsToPlugin(getKeys_, getValues_, getArguments); assert(getKeys_.size() == getValues_.size()); @@ -1714,8 +1714,8 @@ bool OrthancPlugins::HandleChunkedGetDelete(HttpOutput& output, HttpMethod method, const UriComponents& uri, - const Arguments& headers, - const GetArguments& getArguments) + const HttpToolbox::Arguments& headers, + const HttpToolbox::GetArguments& getArguments) { RestCallbackMatcher matcher(uri); @@ -1786,8 +1786,8 @@ const char* /*username*/, HttpMethod method, const UriComponents& uri, - const Arguments& headers, - const GetArguments& getArguments, + const HttpToolbox::Arguments& headers, + const HttpToolbox::GetArguments& getArguments, const void* bodyData, size_t bodySize) { @@ -2417,7 +2417,7 @@ CLOG(INFO, PLUGINS) << "Plugin making REST GET call on URI " << p.uri << (p.afterPlugins ? " (after plugins)" : " (built-in API)"); - IHttpHandler::Arguments headers; + HttpToolbox::Arguments headers; for (uint32_t i = 0; i < p.headersCount; i++) { @@ -4901,8 +4901,8 @@ const char* uri, const char* ip, const char* username, - const IHttpHandler::Arguments& httpHeaders, - const IHttpHandler::GetArguments& getArguments) + const HttpToolbox::Arguments& httpHeaders, + const HttpToolbox::GetArguments& getArguments) { OrthancPluginHttpMethod cMethod = Plugins::Convert(method); @@ -4910,7 +4910,7 @@ std::vector httpValues(httpHeaders.size()); size_t pos = 0; - for (IHttpHandler::Arguments::const_iterator + for (HttpToolbox::Arguments::const_iterator it = httpHeaders.begin(); it != httpHeaders.end(); ++it, pos++) { httpKeys[pos] = it->first.c_str(); @@ -5071,7 +5071,7 @@ const char* username, HttpMethod method, const UriComponents& uri, - const Arguments& headers) + const HttpToolbox::Arguments& headers) { if (method != HttpMethod_Post && method != HttpMethod_Put) diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancServer/Plugins/Engine/OrthancPlugins.h --- a/OrthancServer/Plugins/Engine/OrthancPlugins.h Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancServer/Plugins/Engine/OrthancPlugins.h Wed Nov 25 14:39:10 2020 +0100 @@ -109,8 +109,8 @@ bool HandleChunkedGetDelete(HttpOutput& output, HttpMethod method, const UriComponents& uri, - const Arguments& headers, - const GetArguments& getArguments); + const HttpToolbox::Arguments& headers, + const HttpToolbox::GetArguments& getArguments); void RegisterOnStoredInstanceCallback(const void* parameters); @@ -260,8 +260,8 @@ const char* username, HttpMethod method, const UriComponents& uri, - const Arguments& headers, - const GetArguments& getArguments, + const HttpToolbox::Arguments& headers, + const HttpToolbox::GetArguments& getArguments, const void* bodyData, size_t bodySize) ORTHANC_OVERRIDE; @@ -352,8 +352,8 @@ const char* uri, const char* ip, const char* username, - const IHttpHandler::Arguments& httpHeaders, - const IHttpHandler::GetArguments& getArguments) ORTHANC_OVERRIDE; + const HttpToolbox::Arguments& httpHeaders, + const HttpToolbox::GetArguments& getArguments) ORTHANC_OVERRIDE; bool HasFindHandler(); @@ -375,7 +375,7 @@ const char* username, HttpMethod method, const UriComponents& uri, - const Arguments& headers) ORTHANC_OVERRIDE; + const HttpToolbox::Arguments& headers) ORTHANC_OVERRIDE; // New in Orthanc 1.6.0 IStorageCommitmentFactory::ILookupHandler* CreateStorageCommitment( diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancServer/Sources/EmbeddedResourceHttpHandler.cpp --- a/OrthancServer/Sources/EmbeddedResourceHttpHandler.cpp Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancServer/Sources/EmbeddedResourceHttpHandler.cpp Wed Nov 25 14:39:10 2020 +0100 @@ -58,8 +58,8 @@ const char* /*username*/, HttpMethod method, const UriComponents& uri, - const Arguments& headers, - const GetArguments& arguments, + const HttpToolbox::Arguments& headers, + const HttpToolbox::GetArguments& arguments, const void* /*bodyData*/, size_t /*bodySize*/) { diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancServer/Sources/EmbeddedResourceHttpHandler.h --- a/OrthancServer/Sources/EmbeddedResourceHttpHandler.h Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancServer/Sources/EmbeddedResourceHttpHandler.h Wed Nov 25 14:39:10 2020 +0100 @@ -57,7 +57,7 @@ const char* username, HttpMethod method, const UriComponents& uri, - const Arguments& headers) + const HttpToolbox::Arguments& headers) { return false; } @@ -68,8 +68,8 @@ const char* username, HttpMethod method, const UriComponents& uri, - const Arguments& headers, - const GetArguments& arguments, + const HttpToolbox::Arguments& headers, + const HttpToolbox::GetArguments& arguments, const void* /*bodyData*/, size_t /*bodySize*/); }; diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancServer/Sources/OrthancHttpHandler.cpp --- a/OrthancServer/Sources/OrthancHttpHandler.cpp Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancServer/Sources/OrthancHttpHandler.cpp Wed Nov 25 14:39:10 2020 +0100 @@ -46,7 +46,7 @@ const char* username, HttpMethod method, const UriComponents& uri, - const Arguments& headers) + const HttpToolbox::Arguments& headers) { if (method != HttpMethod_Post && method != HttpMethod_Put) @@ -78,8 +78,8 @@ const char* username, HttpMethod method, const UriComponents& uri, - const Arguments& headers, - const GetArguments& getArguments, + const HttpToolbox::Arguments& headers, + const HttpToolbox::GetArguments& getArguments, const void* bodyData, size_t bodySize) { diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancServer/Sources/OrthancHttpHandler.h --- a/OrthancServer/Sources/OrthancHttpHandler.h Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancServer/Sources/OrthancHttpHandler.h Wed Nov 25 14:39:10 2020 +0100 @@ -56,7 +56,7 @@ const char* username, HttpMethod method, const UriComponents& uri, - const Arguments& headers); + const HttpToolbox::Arguments& headers); virtual bool Handle(HttpOutput& output, RequestOrigin origin, @@ -64,8 +64,8 @@ const char* username, HttpMethod method, const UriComponents& uri, - const Arguments& headers, - const GetArguments& getArguments, + const HttpToolbox::Arguments& headers, + const HttpToolbox::GetArguments& getArguments, const void* bodyData, size_t bodySize); diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancServer/Sources/OrthancRestApi/OrthancRestApi.cpp --- a/OrthancServer/Sources/OrthancRestApi/OrthancRestApi.cpp Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestApi.cpp Wed Nov 25 14:39:10 2020 +0100 @@ -181,8 +181,8 @@ const char* username, HttpMethod method, const UriComponents& uri, - const Arguments& headers, - const GetArguments& getArguments, + const HttpToolbox::Arguments& headers, + const HttpToolbox::GetArguments& getArguments, const void* bodyData, size_t bodySize) { diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancServer/Sources/OrthancRestApi/OrthancRestApi.h --- a/OrthancServer/Sources/OrthancRestApi/OrthancRestApi.h Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestApi.h Wed Nov 25 14:39:10 2020 +0100 @@ -83,8 +83,8 @@ const char* username, HttpMethod method, const UriComponents& uri, - const Arguments& headers, - const GetArguments& getArguments, + const HttpToolbox::Arguments& headers, + const HttpToolbox::GetArguments& getArguments, const void* bodyData, size_t bodySize) ORTHANC_OVERRIDE; diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp --- a/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp Wed Nov 25 14:39:10 2020 +0100 @@ -261,7 +261,7 @@ std::string publicId = call.GetUriComponent("id", ""); - IHttpHandler::Arguments::const_iterator accept = call.GetHttpHeaders().find("accept"); + HttpToolbox::Arguments::const_iterator accept = call.GetHttpHeaders().find("accept"); if (accept != call.GetHttpHeaders().end()) { // New in Orthanc 1.5.4 diff -r 9dc0e42f868b -r a01b1c9cbef4 OrthancServer/Sources/main.cpp --- a/OrthancServer/Sources/main.cpp Wed Nov 25 13:46:49 2020 +0100 +++ b/OrthancServer/Sources/main.cpp Wed Nov 25 14:39:10 2020 +0100 @@ -469,8 +469,8 @@ const char* uri, const char* ip, const char* username, - const IHttpHandler::Arguments& httpHeaders, - const IHttpHandler::GetArguments& getArguments) ORTHANC_OVERRIDE + const HttpToolbox::Arguments& httpHeaders, + const HttpToolbox::GetArguments& getArguments) ORTHANC_OVERRIDE { #if ORTHANC_ENABLE_PLUGINS == 1 if (plugins_ != NULL &&