From: Justin Erenkrantz Date: Fri, 25 Jan 2002 01:11:47 +0000 (+0000) Subject: Change ap_get_brigade prototype to remove *readbytes in favor of readbytes. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c3a09128a91509ac8c531492cb1ee961695abd04;p=thirdparty%2Fapache%2Fhttpd.git Change ap_get_brigade prototype to remove *readbytes in favor of readbytes. If you need the length, you should be using apr_brigade_length. This is much more consistent. Of all the places that call ap_get_brigade, only one (ap_http_filter) needs the length. This makes it now possible to pass constants down without assigning them to a temporary variable first. Also: - Change proxy_ftp to use EXHAUSTIVE mode (didn't catch its -1 before) - Fix buglet in mod_ssl that would cause it to return too much data in some circumstances git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk/modules/ssl@93014 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/ssl_engine_io.c b/ssl_engine_io.c index 699ca30fc53..b2d1d26f021 100644 --- a/ssl_engine_io.c +++ b/ssl_engine_io.c @@ -354,7 +354,6 @@ static int bio_bucket_in_read(BIO *bio, char *in, int inl) { BIO_bucket_in_t *inbio = BIO_bucket_in_ptr(bio); int len = 0; - apr_off_t readbytes = inl; /* XXX: flush here only required for SSLv2; * OpenSSL calls BIO_flush() at the appropriate times for @@ -371,6 +370,7 @@ static int bio_bucket_in_read(BIO *bio, char *in, int inl) if ((len <= inl) || inbio->mode == AP_MODE_GETLINE) { return len; } + inl -= len; } while (1) { @@ -390,7 +390,8 @@ static int bio_bucket_in_read(BIO *bio, char *in, int inl) * GETLINE. */ inbio->rc = ap_get_brigade(inbio->f->next, inbio->bb, - AP_MODE_READBYTES, inbio->block, &readbytes); + AP_MODE_READBYTES, inbio->block, + inl); if ((inbio->rc != APR_SUCCESS) || APR_BRIGADE_EMPTY(inbio->bb)) { @@ -736,13 +737,12 @@ static apr_status_t ssl_io_filter_Input(ap_filter_t *f, apr_bucket_brigade *bb, ap_input_mode_t mode, apr_read_type_e block, - apr_off_t *readbytes) + apr_off_t readbytes) { apr_status_t status; ssl_io_input_ctx_t *ctx = f->ctx; apr_size_t len = sizeof(ctx->buffer); - apr_off_t bytes = *readbytes; int is_init = (mode == AP_MODE_INIT); /* XXX: we don't currently support anything other than these modes. */ @@ -774,9 +774,10 @@ static apr_status_t ssl_io_filter_Input(ap_filter_t *f, if (ctx->inbio.mode == AP_MODE_READBYTES || ctx->inbio.mode == AP_MODE_SPECULATIVE) { - /* Protected from truncation, bytes < MAX_SIZE_T */ - if (bytes < len) { - len = (apr_size_t)bytes; + /* Protected from truncation, readbytes < MAX_SIZE_T + * FIXME: No, it's *not* protected. -- jre */ + if (readbytes < len) { + len = (apr_size_t)readbytes; } status = ssl_io_input_read(ctx, ctx->buffer, &len); } @@ -798,8 +799,6 @@ static apr_status_t ssl_io_filter_Input(ap_filter_t *f, APR_BRIGADE_INSERT_TAIL(bb, bucket); } - *readbytes = len; - return APR_SUCCESS; }