gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r29390 - gnunet/src/gns
Date: Wed, 18 Sep 2013 18:02:35 +0200

Author: grothoff
Date: 2013-09-18 18:02:34 +0200 (Wed, 18 Sep 2013)
New Revision: 29390

Modified:
   gnunet/src/gns/gnunet-gns-proxy.c
Log:
remove \r\n from values before giving them to MHD

Modified: gnunet/src/gns/gnunet-gns-proxy.c
===================================================================
--- gnunet/src/gns/gnunet-gns-proxy.c   2013-09-18 15:56:57 UTC (rev 29389)
+++ gnunet/src/gns/gnunet-gns-proxy.c   2013-09-18 16:02:34 UTC (rev 29390)
@@ -965,10 +965,18 @@
     }
     GNUNET_free (leho_host);
   }
-  GNUNET_break (MHD_YES ==
-               MHD_add_response_header (s5r->response,
-                                        hdr_type,
-                                        hdr_val));
+  /* MHD does not allow certain characters in values, remove those */
+  if (NULL != (tok = strchr (hdr_val, '\n')))
+    *tok = '\0';
+  if (NULL != (tok = strchr (hdr_val, '\r')))
+    *tok = '\0';
+  if (NULL != (tok = strchr (hdr_val, '\t')))
+    *tok = '\0';
+  if (0 != strlen (hdr_val))
+    GNUNET_break (MHD_YES ==
+                 MHD_add_response_header (s5r->response,
+                                          hdr_type,
+                                          hdr_val));
   GNUNET_free (ndup);
   GNUNET_free_non_null (new_cookie_hdr);
   GNUNET_free_non_null (new_location);
@@ -1226,7 +1234,9 @@
 /**
  * Read HTTP request header field from the request.  Copies the fields
  * over to the 'headers' that will be given to curl.  However, 'Host'
- * is substituted with the LEHO if present.
+ * is substituted with the LEHO if present.  We also change the
+ * 'Connection' header value to "close" as the proxy does not support
+ * pipelining.
  *
  * @param cls our `struct Socks5Request`
  * @param kind value kind
@@ -1246,6 +1256,8 @@
   if ( (0 == strcasecmp (MHD_HTTP_HEADER_HOST, key)) &&
        (NULL != s5r->leho) )
     value = s5r->leho;
+  if (0 == strcasecmp (MHD_HTTP_HEADER_CONNECTION, key))
+    value = "Close";
   GNUNET_asprintf (&hdr,
                   "%s: %s",
                   key,




reply via email to

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