]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Change ap_get_brigade prototype to remove *readbytes in favor of readbytes.
authorJustin Erenkrantz <jerenkrantz@apache.org>
Fri, 25 Jan 2002 01:11:47 +0000 (01:11 +0000)
committerJustin Erenkrantz <jerenkrantz@apache.org>
Fri, 25 Jan 2002 01:11:47 +0000 (01:11 +0000)
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

ssl_engine_io.c

index 699ca30fc530fa653e0a23e5b930c2b47bc88242..b2d1d26f0218038bf75089b6c7d684bd31de6c70 100644 (file)
@@ -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;
 }