return APR_SUCCESS;
}
/* read up to the amount they specified. */
- if (mode == AP_MODE_READBYTES) {
+ if (mode == AP_MODE_READBYTES || mode == AP_MODE_SPECULATIVE) {
apr_off_t total;
apr_bucket *e;
apr_bucket_brigade *newbb;
/* Must do split before CONCAT */
newbb = apr_brigade_split(ctx->b, e);
- APR_BRIGADE_CONCAT(b, ctx->b);
+
+ if (mode == AP_MODE_READBYTES) {
+ APR_BRIGADE_CONCAT(b, ctx->b);
+ }
+ else if (mode == AP_MODE_SPECULATIVE) {
+ apr_bucket *copy_bucket;
+ APR_BRIGADE_FOREACH(e, ctx->b) {
+ rv = apr_bucket_copy(e, ©_bucket);
+ if (rv != APR_SUCCESS) {
+ return rv;
+ }
+ APR_BRIGADE_INSERT_TAIL(b, copy_bucket);
+ }
+ }
+
/* Take what was originally there and place it back on ctx->b */
APR_BRIGADE_CONCAT(ctx->b, newbb);