HTTP2: Update to libnghttp2 1.0.4
authorAlexis La Goutte <alexis.lagoutte@gmail.com>
Tue, 23 Jun 2015 13:17:10 +0000 (15:17 +0200)
committerAnders Broman <a.broman58@gmail.com>
Wed, 24 Jun 2015 03:27:49 +0000 (03:27 +0000)
Change-Id: Ia92d183b7e7b5a604d75eee13b64b827ad0af903
Reviewed-on: https://code.wireshark.org/review/9054
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
epan/nghttp2/README.nghttp2
epan/nghttp2/nghttp2.h
epan/nghttp2/nghttp2_hd.c
epan/nghttp2/nghttp2_helper.h
epan/nghttp2/nghttp2ver.h

index ae238333dd61d0b9309d3adea4ab8a7e0eb5cef0..68d0b2c620658d0678bf9b480a72fd363e7cab24 100644 (file)
@@ -29,8 +29,6 @@ find . -name "nghttp2*" -type f -exec sed -i 's/"nghttp2_net.h"/<glib.h>/g'  {}
 
 Fix c++-compat error and documentation (struct => typedef) error
 
-in nghttp2/nghttp2_helper.h remove check for CONFIG.H
-
 in nghttp2/nghttp2.h
 
 Add on the top
index cf23cc97b7a0c0f01855f0da94ccf222a7a7d737..6cf04a48b7d51057b1041b74c20aae95102cf9b0 100644 (file)
@@ -53,8 +53,12 @@ extern "C" {
 #ifdef NGHTTP2_STATICLIB
 #define NGHTTP2_EXTERN
 #elif defined(WIN32)
+#ifdef BUILDING_NGHTTP2
 #define NGHTTP2_EXTERN __declspec(dllexport)
-#else /* !defined(WIN32) */
+#else /* !BUILDING_NGHTTP2 */
+#define NGHTTP2_EXTERN __declspec(dllimport)
+#endif /* !BUILDING_NGHTTP2 */
+#else  /* !defined(WIN32) */
 #define NGHTTP2_EXTERN
 #endif /* !defined(WIN32) */
 
@@ -1150,6 +1154,15 @@ typedef union {
  *
  * To set this callback to :type:`nghttp2_session_callbacks`, use
  * `nghttp2_session_callbacks_set_send_callback()`.
+ *
+ * .. note::
+ *
+ *   The |length| may be very small.  If that is the case, and
+ *   application disables Nagle algorithm (``TCP_NODELAY``), then just
+ *   writing |data| to the network stack leads to very small packet,
+ *   and it is very inefficient.  An application should be responsible
+ *   to buffer up small chunks of data as necessary to avoid this
+ *   situation.
  */
 typedef ssize_t (*nghttp2_send_callback)(nghttp2_session *session,
                                          const uint8_t *data, size_t length,
@@ -2258,6 +2271,15 @@ NGHTTP2_EXTERN int nghttp2_session_send(nghttp2_session *session);
  *
  * :enum:`NGHTTP2_ERR_NOMEM`
  *     Out of memory.
+ *
+ * .. note::
+ *
+ *   This function may produce very small byte string.  If that is the
+ *   case, and application disables Nagle algorithm (``TCP_NODELAY``),
+ *   then writing this small chunk leads to very small packet, and it
+ *   is very inefficient.  An application should be responsible to
+ *   buffer up small chunks of data as necessary to avoid this
+ *   situation.
  */
 NGHTTP2_EXTERN ssize_t nghttp2_session_mem_send(nghttp2_session *session,
                                                 const uint8_t **data_ptr);
index 9dbc9ea98fce09ef5319f8ba7264567e243170b1..ff818fedd47a500637adb7157bedd269ad01953e 100644 (file)
@@ -544,7 +544,8 @@ int nghttp2_hd_entry_init(nghttp2_hd_entry *ent, uint8_t flags, uint8_t *name,
   return 0;
 
 fail2:
-  if (flags & NGHTTP2_HD_FLAG_NAME_ALLOC) {
+  if ((flags & NGHTTP2_HD_FLAG_NAME_ALLOC) &&
+      (flags & NGHTTP2_HD_FLAG_NAME_GIFT) == 0) {
     nghttp2_mem_free(mem, ent->nv.name);
   }
 fail:
@@ -1894,7 +1895,11 @@ static int hd_inflate_commit_indname(nghttp2_hd_inflater *inflater,
       return 0;
     }
 
-    nghttp2_mem_free(mem, nv.value);
+    if (inflater->index < NGHTTP2_STATIC_TABLE_LENGTH) {
+      nghttp2_mem_free(mem, nv.value);
+    } else {
+      nghttp2_mem_free(mem, nv.name);
+    }
 
     return NGHTTP2_ERR_NOMEM;
   }
index 19595b0cf8ad481d19ef49da197a5d5ed652a740..de2d8c0a14b9274c619184143d157d27e1622f25 100644 (file)
@@ -25,7 +25,9 @@
 #ifndef NGHTTP2_HELPER_H
 #define NGHTTP2_HELPER_H
 
+#ifdef HAVE_CONFIG_H
 #include <config.h>
+#endif /* HAVE_CONFIG_H */
 
 #include <string.h>
 
index 09be018c1d451160deb06aa8933382ccaa928431..17a010e15aa2cdadccb2587f9ac700886493110a 100644 (file)
@@ -29,7 +29,7 @@
  * @macro
  * Version number of the nghttp2 library release
  */
-#define NGHTTP2_VERSION "1.0.0"
+#define NGHTTP2_VERSION "1.0.4"
 
 /**
  * @macro
@@ -37,6 +37,6 @@
  * release. This is a 24 bit number with 8 bits for major number, 8 bits
  * for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.
  */
-#define NGHTTP2_VERSION_NUM 0x010000
+#define NGHTTP2_VERSION_NUM 0x010004
 
 #endif /* NGHTTP2VER_H */