-fix
authorMartin Schanzenbach <mschanzenbach@posteo.de>
Sat, 14 Jul 2012 15:58:23 +0000 (15:58 +0000)
committerMartin Schanzenbach <mschanzenbach@posteo.de>
Sat, 14 Jul 2012 15:58:23 +0000 (15:58 +0000)
src/gns/gnunet-gns-proxy.c

index a2375e69580c9282945a39c5dac0e177b0ad74f9..d128b11fd48cbe9037445fcb2f2596cdf9d33487 100644 (file)
@@ -288,6 +288,9 @@ struct ProxyCurlTask
   struct ProxyPostData *post_data_tail;
 
   int post_done;
+
+  /* the type of POST encoding */
+  char* post_type;
   
 };
 
@@ -512,7 +515,11 @@ con_post_data_iter (void *cls,
               "Got POST data: '%s : %s' at offset %llu size %lld\n",
               key, data, off, size);
 
-  /* FIXME ! if transfer enc == urlenc! */
+  if (0 != strcasecmp (MHD_HTTP_POST_ENCODING_FORM_URLENCODED,
+                       ctask->post_type))
+  {
+    return MHD_NO;
+  }
 
   if (0 == off)
   {
@@ -607,6 +614,20 @@ con_val_iter (void *cls,
   else
     hdr_val = value;
 
+  if (0 == strcmp (MHD_HTTP_HEADER_CONTENT_TYPE,
+                   key))
+  {
+    if (0 == strcmp (value,
+                     MHD_HTTP_POST_ENCODING_FORM_URLENCODED))
+      ctask->post_type = MHD_HTTP_POST_ENCODING_FORM_URLENCODED;
+    else if (0 == strcmp (value,
+                          MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA))
+      ctask->post_type = MHD_HTTP_POST_ENCODING_MULTIPART_FORMDATA;
+    else
+      ctask->post_type = NULL;
+
+  }
+
   cstr = GNUNET_malloc (strlen (key) + strlen (hdr_val) + 3);
   GNUNET_snprintf (cstr, strlen (key) + strlen (hdr_val) + 3,
                    "%s: %s", key, hdr_val);