gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r23074 - gnunet/src/gns


From: gnunet
Subject: [GNUnet-SVN] r23074 - gnunet/src/gns
Date: Fri, 3 Aug 2012 20:38:11 +0200

Author: schanzen
Date: 2012-08-03 20:38:11 +0200 (Fri, 03 Aug 2012)
New Revision: 23074

Modified:
   gnunet/src/gns/gnunet-gns-proxy.c
Log:
-actually add CORS header

Modified: gnunet/src/gns/gnunet-gns-proxy.c
===================================================================
--- gnunet/src/gns/gnunet-gns-proxy.c   2012-08-03 18:32:45 UTC (rev 23073)
+++ gnunet/src/gns/gnunet-gns-proxy.c   2012-08-03 18:38:11 UTC (rev 23074)
@@ -772,6 +772,7 @@
   char* hdr_val;
   int delta_cdomain;
   size_t offset = 0;
+  char cors_hdr[strlen (ctask->leho) + strlen ("https://";)];
   
   if (NULL == ctask->response)
   {
@@ -783,8 +784,30 @@
                                                         &mhd_content_cb,
                                                         ctask,
                                                         NULL);
+
+    /* if we have a leho add a CORS header */
+    if (0 != strcmp ("", ctask->leho))
+    {
+      /* We could also allow ssl and http here */
+      if (ctask->mhd->is_ssl)
+        sprintf (cors_hdr, "https://%s";, ctask->leho);
+      else
+        sprintf (cors_hdr, "http://%s";, ctask->leho);
+
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "MHD: Adding CORS header field %s\n",
+                  cors_hdr);
+
+      if (GNUNET_NO == MHD_add_response_header (ctask->response,
+                                              "Access-Control-Allow-Origin",
+                                              cors_hdr))
+      {
+        GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                  "MHD: Error adding CORS header field %s\n",
+                  cors_hdr);
+      }
+    }
     ctask->ready_to_queue = GNUNET_YES;
-    
   }
   
   if (html_mime_len <= bytes)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]