Mercurial > hg > orthanc
changeset 1959:45c4387a379c
Access to the HTTP headers in the "IncomingHttpRequestFilter()" callback
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 07 Apr 2016 16:26:22 +0200 |
parents | c746e2d42ac8 |
children | 239e50b3792f |
files | Core/HttpServer/MongooseServer.cpp Core/HttpServer/MongooseServer.h Core/Lua/LuaFunctionCall.cpp Core/Lua/LuaFunctionCall.h NEWS OrthancServer/main.cpp |
diffstat | 6 files changed, 31 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/Core/HttpServer/MongooseServer.cpp Wed Apr 06 14:41:26 2016 +0200 +++ b/Core/HttpServer/MongooseServer.cpp Thu Apr 07 16:26:22 2016 +0200 @@ -645,7 +645,7 @@ const IIncomingHttpRequestFilter *filter = that->GetIncomingHttpRequestFilter(); if (filter != NULL) { - if (!filter->IsAllowed(method, request->uri, remoteIp, username.c_str())) + if (!filter->IsAllowed(method, request->uri, remoteIp, username.c_str(), headers)) { output.SendUnauthorized(ORTHANC_REALM); return;
--- a/Core/HttpServer/MongooseServer.h Wed Apr 06 14:41:26 2016 +0200 +++ b/Core/HttpServer/MongooseServer.h Thu Apr 07 16:26:22 2016 +0200 @@ -56,7 +56,8 @@ virtual bool IsAllowed(HttpMethod method, const char* uri, const char* ip, - const char* username) const = 0; + const char* username, + const IHttpHandler::Arguments& httpHeaders) const = 0; };
--- a/Core/Lua/LuaFunctionCall.cpp Wed Apr 06 14:41:26 2016 +0200 +++ b/Core/Lua/LuaFunctionCall.cpp Thu Apr 07 16:26:22 2016 +0200 @@ -152,4 +152,18 @@ throw OrthancException(ErrorCode_LuaReturnsNoString); } } + + + void LuaFunctionCall::PushStringMap(const std::map<std::string, std::string>& value) + { + Json::Value json = Json::objectValue; + + for (std::map<std::string, std::string>::const_iterator + it = value.begin(); it != value.end(); ++it) + { + json[it->first] = it->second; + } + + PushJson(json); + } }
--- a/Core/Lua/LuaFunctionCall.h Wed Apr 06 14:41:26 2016 +0200 +++ b/Core/Lua/LuaFunctionCall.h Thu Apr 07 16:26:22 2016 +0200 @@ -62,6 +62,8 @@ void PushJson(const Json::Value& value); + void PushStringMap(const std::map<std::string, std::string>& value); + void Execute() { ExecuteInternal(0);
--- a/NEWS Wed Apr 06 14:41:26 2016 +0200 +++ b/NEWS Thu Apr 07 16:26:22 2016 +0200 @@ -6,6 +6,15 @@ * Support of optional tags for counting resources in C-Find: 0008-0061, 0008-0062, 0020-1200, 0020-1202, 0020-1204, 0020-1206, 0020-1208, 0020-1209 * Support of Move Originator Message ID (0000,1031) in C-Store responses driven by C-Move + +Lua +--- + +* Access to the HTTP headers in the "IncomingHttpRequestFilter()" callback + +Image decoding +-------------- + * Huge speedup if decoding the family of JPEG transfer syntaxes * Refactoring leading to speedups with custom image decoders (including Web viewer plugin) * Support decoding of RLE Lossless transfer syntax
--- a/OrthancServer/main.cpp Wed Apr 06 14:41:26 2016 +0200 +++ b/OrthancServer/main.cpp Thu Apr 07 16:26:22 2016 +0200 @@ -287,7 +287,8 @@ virtual bool IsAllowed(HttpMethod method, const char* uri, const char* ip, - const char* username) const + const char* username, + const IHttpHandler::Arguments& httpHeaders) const { static const char* HTTP_FILTER = "IncomingHttpRequestFilter"; @@ -323,6 +324,7 @@ call.PushString(uri); call.PushString(ip); call.PushString(username); + call.PushStringMap(httpHeaders); if (!call.ExecutePredicate()) {