diff Plugins/Samples/Basic/Plugin.c @ 1041:2c49b7dffcec

plugins have access to the HTTP headers
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 17 Jul 2014 14:14:15 +0200
parents d06186cdc502
children 8d1845feb277
line wrap: on
line diff
--- a/Plugins/Samples/Basic/Plugin.c	Thu Jul 17 13:04:02 2014 +0200
+++ b/Plugins/Samples/Basic/Plugin.c	Thu Jul 17 14:14:15 2014 +0200
@@ -40,23 +40,37 @@
   char buffer[1024];
   uint32_t i;
 
-  sprintf(buffer, "Callback on URL [%s] with body [%s]", url, request->body);
-  OrthancPluginLogInfo(context, buffer);
+  sprintf(buffer, "Callback on URL [%s] with body [%s]\n", url, request->body);
+  OrthancPluginLogWarning(context, buffer);
 
   OrthancPluginAnswerBuffer(context, output, buffer, strlen(buffer), "text/plain");
 
+  OrthancPluginLogWarning(context, "");    
+
+  for (i = 0; i < request->groupsCount; i++)
+  {
+    sprintf(buffer, "  REGEX GROUP %d = [%s]", i, request->groups[i]);
+    OrthancPluginLogWarning(context, buffer);    
+  }
+
+  OrthancPluginLogWarning(context, "");    
+
   for (i = 0; i < request->getCount; i++)
   {
-    sprintf(buffer, "  [%s] = [%s]", request->getKeys[i], request->getValues[i]);
-    OrthancPluginLogInfo(context, buffer);    
+    sprintf(buffer, "  GET [%s] = [%s]", request->getKeys[i], request->getValues[i]);
+    OrthancPluginLogWarning(context, buffer);    
   }
 
-  printf("** %d\n", request->groupsCount);
-  for (i = 0; i < request->groupsCount; i++)
+  OrthancPluginLogWarning(context, "");    
+
+  for (i = 0; i < request->headersCount; i++)
   {
-    printf("** [%s]\n",  request->groups[i]);
+    sprintf(buffer, "  HEADERS [%s] = [%s]", request->headersKeys[i], request->headersValues[i]);
+    OrthancPluginLogWarning(context, buffer);    
   }
 
+  OrthancPluginLogWarning(context, "");    
+
   return 1;
 }