httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Prud'hommeaux" <e...@w3.org>
Subject appending to the content brigade
Date Fri, 24 Aug 2001 18:27:02 GMT
I'm implementing a content filter which wraps the content in multipart
mime. I can generate a separator, my data, separator, original payload
and separator. The problem is that if I just concatonate the brigades,
I end up with an EOS before my final separator. This works (the final
bucket gets sent down the wire) but, if I understand the meaning of
EOS I won't get into heaven this way. I figured I could copy all but
the EOS from the original payload to the new brigade:

-    APR_BRIGADE_CONCAT(bsend, bPayload);
+    APR_BRIGADE_FOREACH(e, bPayload) {
+	if (!APR_BUCKET_IS_EOS(e))
+	    APR_BRIGADE_INSERT_TAIL(bsend, e);
+    }
#    ...
     apr_brigade_destroy(bPayload);
     e = apr_bucket_pool_create(boundary, boundryLength, r->pool);
     APR_BRIGADE_INSERT_TAIL(bsend, e);
     e = apr_bucket_eos_create();
     APR_BRIGADE_INSERT_TAIL(bsend, e);


This corrupted bsend on the first insert. I hadn't even gotten as far
as destroying bPayload, which I expected to be a bad idea. The
byterange filter uses some function calls to copy pieces of the
brigade. Is this the sanctioned approach?

-- 
-eric

(eric@w3.org)
Feel free to forward this message to any list for any purpose other than
email address distribution.

Mime
View raw message