Author: rhuijben
Date: Thu Nov  5 15:02:58 2015
New Revision: 1712790

URL: http://svn.apache.org/viewvc?rev=1712790&view=rev
Log:
Make serf_bucket_aggregate_prepend() behave properly when prepending
an bucket to an empty list.

It forgot to update last, which broke the next append.

Found by: r1712786

* buckets/aggregate_buckets.c
  (serf_bucket_aggregate_prepend): Set last when there was no list.
  (read_aggregate,
   serf_aggregate_readline): Properly reset last.

Modified:
    serf/trunk/buckets/aggregate_buckets.c

Modified: serf/trunk/buckets/aggregate_buckets.c
URL: 
http://svn.apache.org/viewvc/serf/trunk/buckets/aggregate_buckets.c?rev=1712790&r1=1712789&r2=1712790&view=diff
==============================================================================
--- serf/trunk/buckets/aggregate_buckets.c (original)
+++ serf/trunk/buckets/aggregate_buckets.c Thu Nov  5 15:02:58 2015
@@ -134,6 +134,8 @@ void serf_bucket_aggregate_prepend(
     new_list->bucket = prepend_bucket;
     new_list->next = ctx->list;
 
+    if (ctx->list == NULL)
+        ctx->last = new_list;
     ctx->list = new_list;
 
     /* Share our config with this new bucket */
@@ -270,6 +272,8 @@ static apr_status_t read_aggregate(serf_
 
             /* If we have no more in our list, return EOF. */
             if (!ctx->list) {
+                ctx->last = NULL;
+
                 if (ctx->hold_open) {
                     status = ctx->hold_open(ctx->hold_open_baton, bucket);
                     if (status || !ctx->list)
@@ -386,6 +390,8 @@ static apr_status_t serf_aggregate_readl
 
             /* If we have no more in our list, return EOF. */
             if (!ctx->list) {
+                ctx->last = NULL;
+
                 if (ctx->hold_open) {
                     return ctx->hold_open(ctx->hold_open_baton, bucket);
                 }


Reply via email to