# HG changeset patch # User Sebastien Jodogne # Date 1460039182 -7200 # Node ID 45c4387a379c24ded0789bd667fefb47c92db4cf # Parent c746e2d42ac89adafbf4b9f4257af4080b3bae5b Access to the HTTP headers in the "IncomingHttpRequestFilter()" callback diff -r c746e2d42ac8 -r 45c4387a379c Core/HttpServer/MongooseServer.cpp --- 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; diff -r c746e2d42ac8 -r 45c4387a379c Core/HttpServer/MongooseServer.h --- 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; }; diff -r c746e2d42ac8 -r 45c4387a379c Core/Lua/LuaFunctionCall.cpp --- 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& value) + { + Json::Value json = Json::objectValue; + + for (std::map::const_iterator + it = value.begin(); it != value.end(); ++it) + { + json[it->first] = it->second; + } + + PushJson(json); + } } diff -r c746e2d42ac8 -r 45c4387a379c Core/Lua/LuaFunctionCall.h --- 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& value); + void Execute() { ExecuteInternal(0); diff -r c746e2d42ac8 -r 45c4387a379c NEWS --- 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 diff -r c746e2d42ac8 -r 45c4387a379c OrthancServer/main.cpp --- 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()) {