diff Plugins/Samples/Basic/Plugin.c @ 1042:8d1845feb277

set cookies, not allowed methods, unauthorized in plugins
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 17 Jul 2014 15:55:40 +0200
parents 2c49b7dffcec
children be849646b2bf
line wrap: on
line diff
--- a/Plugins/Samples/Basic/Plugin.c	Thu Jul 17 14:14:15 2014 +0200
+++ b/Plugins/Samples/Basic/Plugin.c	Thu Jul 17 15:55:40 2014 +0200
@@ -43,6 +43,7 @@
   sprintf(buffer, "Callback on URL [%s] with body [%s]\n", url, request->body);
   OrthancPluginLogWarning(context, buffer);
 
+  OrthancPluginSetCookie(context, output, "hello", "world");
   OrthancPluginAnswerBuffer(context, output, buffer, strlen(buffer), "text/plain");
 
   OrthancPluginLogWarning(context, "");    
@@ -69,7 +70,7 @@
     OrthancPluginLogWarning(context, buffer);    
   }
 
-  OrthancPluginLogWarning(context, "");    
+  OrthancPluginLogWarning(context, "");
 
   return 1;
 }
@@ -84,6 +85,12 @@
   uint16_t buffer[256 * 256];
   uint32_t x, y, value;
 
+  if (request->method != OrthancPluginHttpMethod_Get)
+  {
+    OrthancPluginSendMethodNotAllowed(context, output, "GET");
+    return -1;
+  }
+
   value = 0;
   for (y = 0; y < 256; y++)
   {