libmicrohttpd: upgrade to 0.9.54 49/9349/3
authorJosé Bollo <jose.bollo@iot.bzh>
Tue, 11 Apr 2017 16:25:32 +0000 (18:25 +0200)
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>
Sat, 13 May 2017 08:16:15 +0000 (08:16 +0000)
This version of libmicrohttpd includes facilities
for upgrading connections to websockets.
Adopting it in advance allows to remove a patch
specific to AGL needed by app-framework-binder.

The patch applied here is a backport from the
upstream (see https://gnunet.org/git/libmicrohttpd.git/
commit b4216c60fdb5b48f6cfec416301fc63a1167e6cd).

Change-Id: I0a00752f1fe0a3e2a5a182ce687c55037345c5f7
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Reviewed-on: https://gerrit.automotivelinux.org/gerrit/9349
ci-image-build: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org>
Tested-by: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org>
ci-image-boot-test: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org>
Reviewed-by: Romain Forlot <romain.forlot@iot.bzh>
Reviewed-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
meta-app-framework/recipes-support/libmicrohttpd/libmicrohttpd/Check-response-existence-on-upgrade.patch [new file with mode: 0644]
meta-app-framework/recipes-support/libmicrohttpd/libmicrohttpd/allows-upgrade.patch [deleted file]
meta-app-framework/recipes-support/libmicrohttpd/libmicrohttpd_0.9.49.bbappend [deleted file]
meta-app-framework/recipes-support/libmicrohttpd/libmicrohttpd_0.9.54.bb [moved from meta-app-framework/recipes-support/libmicrohttpd/libmicrohttpd_0.9.49.bb with 73% similarity]

diff --git a/meta-app-framework/recipes-support/libmicrohttpd/libmicrohttpd/Check-response-existence-on-upgrade.patch b/meta-app-framework/recipes-support/libmicrohttpd/libmicrohttpd/Check-response-existence-on-upgrade.patch
new file mode 100644 (file)
index 0000000..de7ff30
--- /dev/null
@@ -0,0 +1,49 @@
+From: jose.bollo@iot.bzh
+Date: Thu, 4 May 2017 21:47:38 +0200
+Subject: [PATCH] Check response existence on upgrade
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+When a connection upgrade is requested and when the
+request sent an error reply, the response is most of
+the time already sent when the test on
+connection->response->upgrade_handler is made, leading
+to dereferencing NULL.
+
+Two possibilities exist:
+
+  NULL == connection->response || NULL == connection->response->upgrade_handler
+
+or
+
+  NULL != connection->response && NULL == connection->response->upgrade_handler
+
+The first is prefered because it is probably safer to close the connection
+in that case.
+
+Upstream-Status: Accepted [https://gnunet.org/git/libmicrohttpd.git/commit/?id=b4216c60fdb5b48f6cfec416301fc63a1167e6cd]
+
+Change-Id: Ie6e7fc165f7fe3635ade0952bb34a0b937d38716
+Signed-off-by: José Bollo <jobol@nonadev.net>
+Signed-off-by: José Bollo <jose.bollo@iot.bzh>
+---
+ src/microhttpd/connection.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
+index 4753d6e..91a4492 100644
+--- a/src/microhttpd/connection.c
++++ b/src/microhttpd/connection.c
+@@ -882,7 +882,7 @@ keepalive_possible (struct MHD_Connection *connection)
+ #ifdef UPGRADE_SUPPORT
+     if ( (MHD_str_equal_caseless_ (end,
+                                    "upgrade")) &&
+-         (NULL == connection->response->upgrade_handler) )
++         (NULL == connection->response || NULL == connection->response->upgrade_handler) )
+       return MHD_NO;
+ #endif /* UPGRADE_SUPPORT */
+-- 
+2.9.3
+
diff --git a/meta-app-framework/recipes-support/libmicrohttpd/libmicrohttpd/allows-upgrade.patch b/meta-app-framework/recipes-support/libmicrohttpd/libmicrohttpd/allows-upgrade.patch
deleted file mode 100644 (file)
index 19601a5..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-diff -Naur a/src/microhttpd/connection.c b/src/microhttpd/connection.c
---- a/src/microhttpd/connection.c      2016-04-08 21:02:26.000000000 +0200
-+++ b/src/microhttpd/connection.c      2016-08-29 22:41:53.790560238 +0200
-@@ -708,6 +708,8 @@
-  * "keep-alive", we proceed to use the default for the respective HTTP
-  * version (which is conservative for HTTP 1.0, but might be a bit
-  * optimistic for HTTP 1.1).
-+ * In the case of Upgrade, the header  Connection should not be set
-+ * to keep-alive.
-  *
-  * @param connection the connection to check for keepalive
-  * @return #MHD_YES if (based on the request), a keepalive is
-@@ -750,6 +752,59 @@
- /**
-+ * Should we try to keep the given connection alive?  We can use the
-+ * TCP stream for a second request if the connection is HTTP 1.1 and
-+ * the "Connection" header either does not exist or is not set to
-+ * "close", or if the connection is HTTP 1.0 and the "Connection"
-+ * header is explicitly set to "keep-alive".  If no HTTP version is
-+ * specified (or if it is not 1.0 or 1.1), we definitively close the
-+ * connection.  If the "Connection" header is not exactly "close" or
-+ * "keep-alive", we proceed to use the default for the respective HTTP
-+ * version (which is conservative for HTTP 1.0, but might be a bit
-+ * optimistic for HTTP 1.1).
-+ * In the case of Upgrade, the connection should be kept alive even if
-+ * the header Connection is not keep-alive.
-+ *
-+ * @param connection the connection to check for keepalive
-+ * @return #MHD_YES if (based on the request), a keepalive is
-+ *        legal
-+ */
-+static int
-+should_keepalive (struct MHD_Connection *connection)
-+{
-+  const char *end;
-+
-+  if (NULL == connection->version)
-+    return MHD_NO;
-+  if ( (NULL != connection->response) &&
-+       (0 != (connection->response->flags & MHD_RF_HTTP_VERSION_1_0_ONLY) ) )
-+    return MHD_NO;
-+  end = MHD_lookup_connection_value (connection,
-+                                     MHD_HEADER_KIND,
-+                                     MHD_HTTP_HEADER_CONNECTION);
-+  if (MHD_str_equal_caseless_(connection->version,
-+                       MHD_HTTP_VERSION_1_1))
-+  {
-+    if (NULL == end)
-+      return MHD_YES;
-+    if ( (MHD_str_equal_caseless_ (end, "close")) )
-+      return MHD_NO;
-+   return MHD_YES;
-+  }
-+  if (MHD_str_equal_caseless_(connection->version,
-+                       MHD_HTTP_VERSION_1_0))
-+  {
-+    if (NULL == end)
-+      return MHD_NO;
-+    if (MHD_str_equal_caseless_(end, "Keep-Alive"))
-+      return MHD_YES;
-+    return MHD_NO;
-+  }
-+  return MHD_NO;
-+}
-+
-+
-+/**
-  * Produce HTTP "Date:" header.
-  *
-  * @param date where to write the header, with
-@@ -2795,7 +2850,7 @@
-             }
-           if (((MHD_YES == connection->read_closed) &&
-                (0 == connection->read_buffer_offset)) ||
--              (MHD_NO == keepalive_possible (connection)))
-+              (MHD_NO == should_keepalive (connection)))
-             {
-               /* have to close for some reason */
-               MHD_connection_close_ (connection,
diff --git a/meta-app-framework/recipes-support/libmicrohttpd/libmicrohttpd_0.9.49.bbappend b/meta-app-framework/recipes-support/libmicrohttpd/libmicrohttpd_0.9.49.bbappend
deleted file mode 100644 (file)
index c26b811..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-
-FILESEXTRAPATHS_append := ":${THISDIR}/${PN}"
-SRC_URI += " file://allows-upgrade.patch"
-
-
@@ -6,10 +6,13 @@ SECTION = "net"
 DEPENDS = "libgcrypt gnutls file"
 
 SRC_URI = "http://ftp.gnu.org/gnu/libmicrohttpd/${BPN}-${PV}.tar.gz"
-SRC_URI[md5sum] = "3209aa2ac6199b874a6325342b86edbc"
-SRC_URI[sha256sum] = "9407d8252548ab97ace3276e0032f073820073c0599d43baff832902a8dab11c"
+SRC_URI[md5sum] = "9ed8171c7ee8cedce86959635c1db3ae"
+SRC_URI[sha256sum] = "bcc721895d4a114b0548a39d2241c35caacb9e2e072d40e11b55c60e3d5ddcbe"
 
-inherit autotools lib_package pkgconfig
+FILESEXTRAPATHS_append := ":${THISDIR}/${PN}"
+SRC_URI += " file://Check-response-existence-on-upgrade.patch"
+
+inherit autotools lib_package pkgconfig gettext
 
 EXTRA_OECONF += "--disable-static --with-gnutls=${STAGING_LIBDIR}/../"