joes 2003/07/10 16:18:30
Modified: env mod_apreq.c
env/t request.t
Log:
Prefetch reads should block until the configured read_ahead amount (64K) is
available
Revision Changes Path
1.24 +8 -4 httpd-apreq-2/env/mod_apreq.c
Index: mod_apreq.c
===================================================================
RCS file: /home/cvs/httpd-apreq-2/env/mod_apreq.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- mod_apreq.c 10 Jul 2003 04:35:18 -0000 1.23
+++ mod_apreq.c 10 Jul 2003 23:18:30 -0000 1.24
@@ -378,19 +378,23 @@
}
else {
/* prefetch read! */
+ apr_bucket_brigade *tmp = apr_brigade_create(r->pool,
+ apr_bucket_alloc_create(r->pool));
apr_bucket *last = APR_BRIGADE_LAST(ctx->spool);
- if (!APR_BUCKET_IS_EOS(last)) {
- apr_bucket_brigade *tmp = apr_brigade_create(r->pool,
- apr_bucket_alloc_create(r->pool));
+ apr_size_t total_read = 0;
+ while (!APR_BUCKET_IS_EOS(last) && total_read < readbytes) {
+ apr_off_t len;
rv = ap_get_brigade(f->next, tmp, mode, block, readbytes);
if (rv != APR_SUCCESS)
return rv;
bb = apreq_copy_brigade(tmp);
-
+ apr_brigade_length(bb,0,&len);
+ total_read += len;
APR_BRIGADE_CONCAT(ctx->spool, tmp);
APR_BRIGADE_CONCAT(ctx->bb, bb);
+ last = APR_BRIGADE_LAST(ctx->spool);
}
}
ctx->status = apreq_parse_request(apreq_request(r, NULL), ctx->bb);
1.3 +1 -2 httpd-apreq-2/env/t/request.t
Index: request.t
===================================================================
RCS file: /home/cvs/httpd-apreq-2/env/t/request.t,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- request.t 9 Jul 2003 15:55:00 -0000 1.2
+++ request.t 10 Jul 2003 23:18:30 -0000 1.3
@@ -19,8 +19,7 @@
ok t_cmp(403, GET_RC("/apreq_access_test"), "access denied");
-# XXX 8000 filler chars bombs out- why?
-my $filler = "1234567" x 1000;
+my $filler = "0123456789" x 7000; # < 8000 + 64K
my $body = POST_BODY("/apreq_access_test?foo=1;",
content => "bar=2&quux=$filler;test=6");
ok t_cmp(<<EOT, $body, "prefetch credentials");