avoid assertions from adding headers that MHD deals with internally
authorChristian Grothoff <christian@grothoff.org>
Sat, 9 Feb 2019 14:43:47 +0000 (15:43 +0100)
committerChristian Grothoff <christian@grothoff.org>
Sat, 9 Feb 2019 14:43:47 +0000 (15:43 +0100)
src/gns/gnunet-gns-proxy.c

index e21deabde2298d84c4c33ff507bfb6c6fdc2dd4c..21451651d5a40845218180cfa4f336d56c50d700 100644 (file)
@@ -1362,11 +1362,27 @@ create_mhd_response_from_s5r (struct Socks5Request *s5r)
        NULL != header;
        header = header->next)
   {
-    GNUNET_break (MHD_YES ==
-                  MHD_add_response_header (s5r->response,
-                                           header->type,
-                                           header->value));
-
+    if (0 == strcasecmp (header->type,
+                         MHD_HTTP_HEADER_CONTENT_LENGTH))
+      continue; /* MHD won't let us mess with those, for good reason */
+    if ( (0 == strcasecmp (header->type,
+                           MHD_HTTP_HEADER_TRANSFER_ENCODING)) &&
+         ( (0 == strcasecmp (header->value,
+                             "identity")) ||
+           (0 == strcasecmp (header->value,
+                             "chunked")) ) )
+      continue; /* MHD won't let us mess with those, for good reason */
+    if (MHD_YES !=
+        MHD_add_response_header (s5r->response,
+                                 header->type,
+                                 header->value))
+    {
+      GNUNET_break (0);
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                  "Failed to add header `%s:%s'\n",
+                  header->type,
+                  header->value);
+    }
   }
   /* force connection to be closed after each request, as we
      do not support HTTP pipelining (yet, FIXME!) */