Yann, care to apply your eyeballs to this one? Old one is reverted. Thanks!

Index: modules/http2/h2_util.c
===================================================================
--- modules/http2/h2_util.c     (revision 1707479)
+++ modules/http2/h2_util.c     (working copy)
@@ -539,14 +539,36 @@
                               apr_size_t *plen, int *peos)
 {
     apr_status_t status;
+    apr_off_t blen = 0;
+
     /* test read to determine available length */
-    apr_off_t blen = 0;
-    status = apr_brigade_length(bb, 0, &blen);
-    if (blen < (apr_off_t)*plen) {
-        *plen = blen;
+    status = apr_brigade_length(bb, 1, &blen);
+    if (status != APR_SUCCESS) {
+        return status;
     }
-    *peos = h2_util_has_eos(bb, *plen);
-    return status;
+    else if (blen == 0) {
+        /* empty brigade, does it have an EOS bucket somwhere? */
+        *plen = 0;
+        *peos = h2_util_has_eos(bb, 0);
+    }
+    else if (blen > 0) {
+        /* data in the brigade, limit the length returned. Check for EOS
+         * bucket only if we indicate data. This is required since plen == 0
+         * means "the whole brigade" for h2_util_hash_eos()
+         */
+        if (blen < (apr_off_t)*plen) {
+            *plen = blen;
+        }
+        *peos = (*plen > 0)? h2_util_has_eos(bb, *plen) : 0;
+    }
+    else if (blen < 0) {
+        /* famous SHOULD NOT HAPPEN, sinc we told apr_brigade_length to readall
+         */
+        *plen = 0;
+        *peos = h2_util_has_eos(bb, 0);
+        return APR_EINVAL;
+    }
+    return APR_SUCCESS;
 }
 
 apr_status_t h2_util_bb_readx(apr_bucket_brigade *bb, 
Index: modules/http2/h2_version.h
===================================================================
--- modules/http2/h2_version.h  (revision 1707479)
+++ modules/http2/h2_version.h  (working copy)
@@ -20,7 +20,7 @@
  * @macro
  * Version number of the h2 module as c string
  */
-#define MOD_HTTP2_VERSION "0.9.9"
+#define MOD_HTTP2_VERSION "1.0.0"
 
 /**
  * @macro
@@ -28,7 +28,7 @@
  * 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 MOD_HTTP2_VERSION_NUM 0x000909
+#define MOD_HTTP2_VERSION_NUM 0x010000
 

> Am 08.10.2015 um 12:30 schrieb Yann Ylavic <ylavic....@gmail.com>:
> 
> On Thu, Oct 8, 2015 at 12:06 PM, Stefan Eissing
> <stefan.eiss...@greenbytes.de> wrote:
>> I need a tiny patch for mod_http2 that solves an empty response problem with 
>> the latest nghttp2 libraries:
>> 
>> Jim, can we get that still in? Commited in trunk as r1707468.
> 
> I quickly ask (since I did not check all the h2_util_has_eos(bb, 0)
> callers paths and you may know that already), what happens to the EOS
> bucket it is in the brigade along with other non-empty buckets and
> hence the callers consider we are not EOS?
> Does it get stripped somehow or the next run will find it?

Reply via email to