joes 2003/10/23 04:21:16
Modified: env mod_apreq.c
Log:
Minor refactoring - move assignment of ctx->saw_eos closer to the
conditionals that check for it.
Revision Changes Path
1.31 +11 -3 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.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- mod_apreq.c 23 Oct 2003 10:51:03 -0000 1.30
+++ mod_apreq.c 23 Oct 2003 11:21:16 -0000 1.31
@@ -370,6 +370,7 @@
req = apreq_request(r, NULL);
if (bb != NULL) {
+
if (!ctx->saw_eos) {
apr_bucket_brigade *tmp;
rv = ap_get_brigade(f->next, bb, mode, block, readbytes);
@@ -380,6 +381,8 @@
}
tmp = apreq_copy_brigade(bb);
APR_BRIGADE_CONCAT(ctx->bb, tmp);
+ if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(ctx->bb)))
+ ctx->saw_eos = 1;
}
if (!APR_BRIGADE_EMPTY(ctx->spool)) {
@@ -405,6 +408,7 @@
}
return ctx->status;
}
+
}
else if (!ctx->saw_eos) {
/* prefetch read! */
@@ -413,8 +417,14 @@
apr_bucket *last = APR_BRIGADE_LAST(ctx->spool);
apr_size_t total_read = 0;
- while (!APR_BUCKET_IS_EOS(last) && total_read < readbytes) {
+ while (total_read < readbytes) {
apr_off_t len;
+
+ if (APR_BUCKET_IS_EOS(last)) {
+ ctx->saw_eos = 1;
+ break;
+ }
+
rv = ap_get_brigade(f->next, tmp, mode, block, readbytes);
if (rv != APR_SUCCESS)
return rv;
@@ -430,8 +440,6 @@
else
return ctx->status;
- if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(ctx->bb)))
- ctx->saw_eos = 1;
ctx->status = apreq_parse_request(req, ctx->bb);
return (ctx->status == APR_INCOMPLETE) ? APR_SUCCESS : ctx->status;
}