Author: joes
Date: Mon May 16 17:37:16 2005
New Revision: 170495

URL: http://svn.apache.org/viewcvs?rev=170495&view=rev
Log:
Copy the custom brigade argument, so the caller can't muck
with it during parsing.

Modified:
    httpd/apreq/trunk/library/module_custom.c

Modified: httpd/apreq/trunk/library/module_custom.c
URL: 
http://svn.apache.org/viewcvs/httpd/apreq/trunk/library/module_custom.c?rev=170495&r1=170494&r2=170495&view=diff
==============================================================================
--- httpd/apreq/trunk/library/module_custom.c (original)
+++ httpd/apreq/trunk/library/module_custom.c Mon May 16 17:37:16 2005
@@ -265,7 +265,11 @@
     req->handle.bucket_alloc = in->bucket_alloc;
     req->read_limit = read_limit;
     req->parser = parser;
-    req->in = in;
+    req->in = apr_brigade_create(pool, in->bucket_alloc);
+    req->tmpbb = apr_brigade_create(pool, in->bucket_alloc);
+    req->body = apr_table_make(pool, APREQ_DEFAULT_NELTS);
+    req->body_status = APR_INCOMPLETE;
+    APR_BRIGADE_CONCAT(req->in, in);
 
     if (cookie != NULL) {
         req->jar = apr_table_make(pool, APREQ_DEFAULT_NELTS);
@@ -288,14 +292,9 @@
         req->args_status = APREQ_ERROR_NODATA;
     }
 
-    if (in != NULL) {
-        req->tmpbb = apr_brigade_create(pool, in->bucket_alloc);
-        req->body = apr_table_make(pool, APREQ_DEFAULT_NELTS);
-        req->body_status = APR_INCOMPLETE;
-    }
-    else {
-        req->body = NULL;
-        req->body_status = APREQ_ERROR_NODATA;
+    if (!APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(req->in))) {
+        apr_bucket *eos = apr_bucket_eos_create(in->bucket_alloc);
+        APR_BRIGADE_INSERT_TAIL(req->in, eos);
     }
 
     return &req->handle;


Reply via email to