diff Plugins/Engine/OrthancPlugins.cpp @ 1571:3232f1c995a5

provide the origin of the requests to HTTP handlers
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 25 Aug 2015 11:04:19 +0200
parents 89ab71a68fcf
children 904096e7367e
line wrap: on
line diff
--- a/Plugins/Engine/OrthancPlugins.cpp	Sun Aug 23 11:13:03 2015 +0200
+++ b/Plugins/Engine/OrthancPlugins.cpp	Tue Aug 25 11:04:19 2015 +0200
@@ -229,6 +229,9 @@
 
 
   bool OrthancPlugins::Handle(HttpOutput& output,
+                              RequestOrigin /*origin*/,
+                              const char* /*remoteIp*/,
+                              const char* /*username*/,
                               HttpMethod method,
                               const UriComponents& uri,
                               const Arguments& headers,
@@ -627,7 +630,7 @@
     IHttpHandler& handler = pimpl_->context_->GetHttpHandler().RestrictToOrthancRestApi(!afterPlugins);
 
     std::string result;
-    if (HttpToolbox::SimpleGet(result, handler, p.uri))
+    if (HttpToolbox::SimpleGet(result, handler, RequestOrigin_Plugins, p.uri))
     {
       CopyToMemoryBuffer(*p.target, result);
     }
@@ -653,8 +656,8 @@
 
     std::string result;
     if (isPost ? 
-        HttpToolbox::SimplePost(result, handler, p.uri, p.body, p.bodySize) :
-        HttpToolbox::SimplePut (result, handler, p.uri, p.body, p.bodySize))
+        HttpToolbox::SimplePost(result, handler, RequestOrigin_Plugins, p.uri, p.body, p.bodySize) :
+        HttpToolbox::SimplePut (result, handler, RequestOrigin_Plugins, p.uri, p.body, p.bodySize))
     {
       CopyToMemoryBuffer(*p.target, result);
     }
@@ -675,7 +678,7 @@
     CheckContextAvailable();
     IHttpHandler& handler = pimpl_->context_->GetHttpHandler().RestrictToOrthancRestApi(!afterPlugins);
 
-    if (!HttpToolbox::SimpleDelete(handler, uri))
+    if (!HttpToolbox::SimpleDelete(handler, RequestOrigin_Plugins, uri))
     {
       throw OrthancException(ErrorCode_BadRequest);
     }