From: Aaron Bannert Date: Tue, 16 Oct 2001 01:04:08 +0000 (+0000) Subject: Cautiously avoiding the scoping issue that was discussed on the list, X-Git-Tag: 2.0.26~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bb447fc0c516e4bb27261931f388b6cc39c9cb6b;p=apache Cautiously avoiding the scoping issue that was discussed on the list, I thought these other changes needed to go in; Namely that we don't need to check if the brigade is empty twice in the loop, just once. Added a comment for good measure. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91478 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index cf1ab764b6..cb088e5b65 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -1370,22 +1370,21 @@ AP_DECLARE(long) ap_get_client_block(request_rec *r, char *buffer, apr_size_t bu &core_module); apr_bucket_brigade *bb = req_cfg->bb; - do { + /* read until we get a non-empty brigade */ + while (APR_BRIGADE_EMPTY(bb)) { apr_off_t len_read; - if (APR_BRIGADE_EMPTY(bb)) { - len_read = r->remaining; - if (ap_get_brigade(r->input_filters, bb, AP_MODE_BLOCKING, - &len_read) != APR_SUCCESS) { - /* if we actually fail here, we want to just return and - * stop trying to read data from the client. - */ - r->connection->keepalive = -1; - apr_brigade_destroy(bb); - return -1; - } - r->remaining -= len_read; + len_read = r->remaining; + if (ap_get_brigade(r->input_filters, bb, AP_MODE_BLOCKING, + &len_read) != APR_SUCCESS) { + /* if we actually fail here, we want to just return and + * stop trying to read data from the client. + */ + r->connection->keepalive = -1; + apr_brigade_destroy(bb); + return -1; } - } while (APR_BRIGADE_EMPTY(bb)); + r->remaining -= len_read; + } b = APR_BRIGADE_FIRST(bb); if (APR_BUCKET_IS_EOS(b)) { /* reached eos on previous invocation */