serf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1711729 - /serf/trunk/buckets/request_buckets.c
Date Sun, 01 Nov 2015 09:40:40 GMT
Author: rhuijben
Date: Sun Nov  1 09:40:40 2015
New Revision: 1711729

URL: http://svn.apache.org/viewvc?rev=1711729&view=rev
Log:
On the request bucket: Implement reading a bucket, like how we implement other
read operations: serialize and then delegate to the aggregate bucket.

This 'fix' allow the http2 code to read the headers as bucket and reuse the
body within a httpv2 request.

* buckets/request_buckets.c
  (serialize_data): Copy config to new aggregate.
  (serf_request_read_bucket): New function.
  (serf_bucket_type_request): Add serf_request_read_bucket.

Modified:
    serf/trunk/buckets/request_buckets.c

Modified: serf/trunk/buckets/request_buckets.c
URL: http://svn.apache.org/viewvc/serf/trunk/buckets/request_buckets.c?rev=1711729&r1=1711728&r2=1711729&view=diff
==============================================================================
--- serf/trunk/buckets/request_buckets.c (original)
+++ serf/trunk/buckets/request_buckets.c Sun Nov  1 09:40:40 2015
@@ -132,6 +132,8 @@ static void serialize_data(serf_bucket_t
      * pointer to self still represents the "right" data.
      */
     serf_bucket_aggregate_become(bucket);
+    if (ctx->config)
+      serf_set_config(bucket, ctx->config);
 
     /* Insert the two buckets. */
     serf_bucket_aggregate_append(bucket, new_bucket);
@@ -195,6 +197,15 @@ static apr_status_t serf_request_read_io
                                   vecs_size, vecs, vecs_used);
 }
 
+static serf_bucket_t * serf_request_read_bucket(serf_bucket_t *bucket,
+                                                const serf_bucket_type_t *type)
+{
+    /* Luckily we don't have to be affraid for bucket_v2 tests here */
+    serialize_data(bucket);
+
+    return serf_bucket_read_bucket(bucket, type);
+}
+
 static apr_status_t serf_request_peek(serf_bucket_t *bucket,
                                       const char **data,
                                       apr_size_t *len)
@@ -260,7 +271,7 @@ const serf_bucket_type_t serf_bucket_typ
     serf_buckets_are_v2,
     serf_request_peek,
     serf_request_destroy,
-    serf_default_read_bucket,
+    serf_request_read_bucket,
     serf_default_get_remaining,
     serf_request_set_config,
 };



Mime
View raw message