aboutsummaryrefslogtreecommitdiff
path: root/buckets/request_buckets.c
diff options
context:
space:
mode:
Diffstat (limited to 'buckets/request_buckets.c')
-rw-r--r--buckets/request_buckets.c43
1 files changed, 31 insertions, 12 deletions
diff --git a/buckets/request_buckets.c b/buckets/request_buckets.c
index 912da8ad6df7..8d1a963efc0d 100644
--- a/buckets/request_buckets.c
+++ b/buckets/request_buckets.c
@@ -1,16 +1,21 @@
-/* Copyright 2002-2004 Justin Erenkrantz and Greg Stein
+/* ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
*/
#include <apr_pools.h>
@@ -190,6 +195,20 @@ static apr_status_t serf_request_peek(serf_bucket_t *bucket,
return serf_bucket_peek(bucket, data, len);
}
+/* Note that this function is only called when serialize_data()
+ hasn't been called on the bucket */
+static void serf_request_destroy(serf_bucket_t *bucket)
+{
+ request_context_t *ctx = bucket->data;
+
+ serf_bucket_destroy(ctx->headers);
+
+ if (ctx->body)
+ serf_bucket_destroy(ctx->body);
+
+ serf_default_destroy_and_data(bucket);
+}
+
void serf_bucket_request_become(
serf_bucket_t *bucket,
const char *method,
@@ -218,6 +237,6 @@ const serf_bucket_type_t serf_bucket_type_request = {
serf_default_read_for_sendfile,
serf_default_read_bucket,
serf_request_peek,
- serf_default_destroy_and_data,
+ serf_request_destroy,
};