File bsc1041216-part3.patch of Package libmicrohttpd

From b57456c2e6536764ad7b065c70b999f876269a2c Mon Sep 17 00:00:00 2001
From: Christian Grothoff <christian@grothoff.org>
Date: Mon, 24 Apr 2017 17:30:26 +0200
Subject: relax space-in-field-name checks only if new
 MHD_USE_PERMISSIVE_CHECKS flag is set


Index: libmicrohttpd-0.9.30/doc/libmicrohttpd.texi
===================================================================
--- libmicrohttpd-0.9.30.orig/doc/libmicrohttpd.texi
+++ libmicrohttpd-0.9.30/doc/libmicrohttpd.texi
@@ -455,7 +455,7 @@ that IPv4 addresses are returned by MHD
 (the 'struct sockaddr_in6' format will be used for IPv4 and IPv6).
 
 @item MHD_USE_PEDANTIC_CHECKS
-Be pedantic about the protocol (as opposed to as tolerant as possible).
+Be pedantic about the protocol.
 Specifically, at the moment, this flag causes MHD to reject HTTP
 1.1 connections without a @code{Host} header.  This is required by the
 standard, but of course in violation of the ``be as liberal as possible
@@ -463,6 +463,13 @@ in what you accept'' norm.  It is recomm
 if you are testing clients against MHD, and @strong{OFF} in
 production.
 
+@item MHD_USE_PERMISSIVE_CHECKS
+Be permissive about the protocol, allowing slight deviations that are
+technically not allowed by the RFC.  Specifically, at the moment, this
+flag causes MHD to allow spaces in header field names.  This is
+disallowed by the standard.
+
+
 @item MHD_USE_POLL
 @cindex FD_SETSIZE
 @cindex poll
Index: libmicrohttpd-0.9.30/src/include/microhttpd.h
===================================================================
--- libmicrohttpd-0.9.30.orig/src/include/microhttpd.h
+++ libmicrohttpd-0.9.30/src/include/microhttpd.h
@@ -517,8 +517,16 @@ enum MHD_FLAG
    * Enalbed always on W32 as winsock does not properly behave
    * with `shutdown()` and this then fixes potential problems.
    */
-  MHD_USE_EPOLL_TURBO = 4096
+  MHD_USE_EPOLL_TURBO = 4096,
 
+  /**
+   * Be permissive about the protocol, allowing slight deviations that
+   * are technically not allowed by the RFC.
+   * Specifically, at the moment, this flag causes MHD to
+   * allow spaces in header field names.  This is
+   * disallowed by the standard.
+   */
+  MHD_USE_PERMISSIVE_CHECKS = 131072
 };
 
 
Index: libmicrohttpd-0.9.30/src/microhttpd/connection.c
===================================================================
--- libmicrohttpd-0.9.30.orig/src/microhttpd/connection.c
+++ libmicrohttpd-0.9.30/src/microhttpd/connection.c
@@ -1625,7 +1625,7 @@ process_header_line (struct MHD_Connecti
 			      "Received malformed line (no colon), closing connection.\n");
       return MHD_NO;
     }
-  if (0 != (MHD_USE_PEDANTIC_CHECKS & connection->daemon->options))
+  if (0 == (MHD_USE_PERMISSIVE_CHECKS & connection->daemon->options))
     {
       /* check for whitespace before colon, which is not allowed
 	 by RFC 7230 section 3.2.4; we count space ' ' and