httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerenkra...@apache.org
Subject cvs commit: httpd-2.0/server/mpm/perchild perchild.c
Date Sat, 19 Jan 2002 07:45:18 GMT
jerenkrantz    02/01/18 23:45:18

  Modified:    .        CHANGES
               include  ap_mmn.h util_filter.h
               modules/echo mod_echo.c
               modules/experimental mod_case_filter_in.c mod_charset_lite.c
                        mod_ext_filter.c
               modules/http http_protocol.c http_request.c mod_core.h
               modules/proxy proxy_ftp.c proxy_http.c proxy_util.c
               modules/ssl ssl_engine_io.c
               server   core.c protocol.c util_filter.c
               server/mpm/perchild perchild.c
  Log:
  Input filtering prototype change: Socket blocking type should be
  separate from the input filter mode type.
  
  We also no longer look at readbytes to determine the method of
  filter operation.  This makes the use of filters more obvious and
  allows a wider range of options for input filters modes.
  
  To start with, the new input filter modes are:
  
  AP_MODE_READBYTES (no more than *readbytes returned)
  AP_MODE_GETLINE (old *readbytes == 0 case)
  AP_MODE_EATCRLF (old AP_MODE_PEEK)
  AP_MODE_SPECULATIVE (will be used in a future ap_getline rewrite)
  AP_MODE_EXHAUSTIVE (old *readbytes == -1 case)
  AP_MODE_INIT (special case for NNTP over SSL)
  
  The block parameter is an apr_read_type_e: APR_BLOCK_READ, APR_NONBLOCK_READ
  
  This also allows cleanup of mod_ssl's handling in the getline case.
  
  Reviewed by:	Ryan Bloom (concept), Greg Stein (concept)
  
  Revision  Changes    Path
  1.528     +3 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.527
  retrieving revision 1.528
  diff -u -r1.527 -r1.528
  --- CHANGES	18 Jan 2002 21:38:11 -0000	1.527
  +++ CHANGES	19 Jan 2002 07:45:16 -0000	1.528
  @@ -1,5 +1,8 @@
   Changes with Apache 2.0.31-dev
   
  +  *) Split out blocking from the mode in the input filters.
  +     [Justin Erenkrantz]
  +
     *) Fix a segfault in mod_include.  [Justin Erenkrantz, Jeff Trawick]
   
     *) Cause Win32 to capture all child-worker process errors in
  
  
  
  1.29      +1 -0      httpd-2.0/include/ap_mmn.h
  
  Index: ap_mmn.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/ap_mmn.h,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- ap_mmn.h	14 Jan 2002 13:46:59 -0000	1.28
  +++ ap_mmn.h	19 Jan 2002 07:45:16 -0000	1.29
  @@ -92,6 +92,7 @@
    * 20020111 (2.0.31-dev) bump for ETag fields added at end of cor_dir_config
    * 20020114 (2.0.31-dev) mod_dav changed how it asks its provider to fulfill
    *                       a GET request
  + * 20020118 (2.0.31-dev) Input filtering split of blocking and mode
    */
   
   #define MODULE_MAGIC_COOKIE 0x41503230UL /* "AP20" */
  
  
  
  1.62      +30 -22    httpd-2.0/include/util_filter.h
  
  Index: util_filter.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/util_filter.h,v
  retrieving revision 1.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- util_filter.h	19 Nov 2001 22:36:20 -0000	1.61
  +++ util_filter.h	19 Jan 2002 07:45:16 -0000	1.62
  @@ -84,23 +84,27 @@
   
   /**
    * input filtering modes
  - * @see apr_read_type_e in apr_buckets.h -- this is a superset of it
    */
   typedef enum {
  -    /** The filter shouldn't return until data is received or EOF is hit
  -     *  or an error occurs. */
  -    AP_MODE_BLOCKING = APR_BLOCK_READ,
  -    /** The filter should process any available data/status as normal,
  -     *  but will not wait for additional data. */
  -    AP_MODE_NONBLOCKING = APR_NONBLOCK_READ,
  -    /** The filter should return ::APR_SUCCESS if data is available or
  -     *  ::APR_EOF otherwise.  The filter must not return any buckets of
  -     *  data.  Data returned on a subsequent call, when mode is
  -     *  ::AP_MODE_BLOCKING or ::AP_MODE_NONBLOCKING. */
  -    AP_MODE_PEEK,
  -    /*
  -     * the filter should initialize the connection if needed,
  -     * NNTP or FTP over SSL for example.
  +    /** The filter should return at most *readbytes data. */
  +    AP_MODE_READBYTES,
  +    /** The filter should return at most one line of CRLF data.
  +     *  (If a potential line is too long or no CRLF is found, the 
  +     *   filter may return partial data).
  +     */
  +    AP_MODE_GETLINE,
  +    /** The filter should implicitly eat any CRLF pairs that it sees. */
  +    AP_MODE_EATCRLF,
  +    /** The filter read should be treated as speculative and any returned
  +     *  data should be stored for later retrieval in another mode. */
  +    AP_MODE_SPECULATIVE,
  +    /** The filter read should be exhaustive and read until it can not
  +     *  read any more.
  +     *  Use this mode with extreme caution.
  +     */
  +    AP_MODE_EXHAUSTIVE,
  +    /** The filter should initialize the connection if needed,
  +     *  NNTP or FTP over SSL for example.
        */
       AP_MODE_INIT
   } ap_input_mode_t;
  @@ -161,7 +165,7 @@
    */
   typedef apr_status_t (*ap_out_filter_func)(ap_filter_t *f, apr_bucket_brigade *b);
   typedef apr_status_t (*ap_in_filter_func)(ap_filter_t *f, apr_bucket_brigade *b, 
  -                                          ap_input_mode_t mode, apr_off_t *readbytes);
  +                                          ap_input_mode_t mode, apr_read_type_e block,
apr_off_t *readbytes);
   
   typedef union ap_filter_func {
       ap_out_filter_func out_func;
  @@ -277,12 +281,16 @@
    * filter doesn't read from the network, then ::AP_NOBODY_READ is returned.
    * @param filter The next filter in the chain
    * @param bucket The current bucket brigade
  - * @param mode   ::AP_MODE_BLOCKING, ::AP_MODE_NONBLOCKING, or ::AP_MODE_PEEK
  - * @param readbytes How many bytes to read from the next filter.  0 means that
  - *                  a single line should be read.
  - */
  -AP_DECLARE(apr_status_t) ap_get_brigade(ap_filter_t *filter, apr_bucket_brigade *bucket,

  -                                        ap_input_mode_t mode, apr_off_t *readbytes);
  + * @param mode   The way in which the data should be read
  + * @param block  How the operations should be performed
  + *               ::APR_BLOCK_READ, ::APR_NONBLOCK_READ
  + * @param readbytes How many bytes to read from the next filter.
  + */
  +AP_DECLARE(apr_status_t) ap_get_brigade(ap_filter_t *filter, 
  +                                        apr_bucket_brigade *bucket, 
  +                                        ap_input_mode_t mode,
  +                                        apr_read_type_e block, 
  +                                        apr_off_t *readbytes);
   
   /**
    * Pass the current bucket brigade down to the next filter on the filter
  
  
  
  1.36      +2 -2      httpd-2.0/modules/echo/mod_echo.c
  
  Index: mod_echo.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/echo/mod_echo.c,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- mod_echo.c	10 Jan 2002 09:11:32 -0000	1.35
  +++ mod_echo.c	19 Jan 2002 07:45:16 -0000	1.36
  @@ -106,8 +106,8 @@
   
       for ( ; ; ) {
           /* Get a single line of input from the client */
  -        if ((rv = ap_get_brigade(c->input_filters, bb,
  -                                 AP_MODE_BLOCKING, &zero) != APR_SUCCESS || 
  +        if ((rv = ap_get_brigade(c->input_filters, bb, AP_MODE_GETLINE,
  +                                 APR_BLOCK_READ, &zero) != APR_SUCCESS || 
                APR_BRIGADE_EMPTY(bb))) {
               apr_brigade_destroy(bb);
               break;
  
  
  
  1.10      +4 -3      httpd-2.0/modules/experimental/mod_case_filter_in.c
  
  Index: mod_case_filter_in.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_case_filter_in.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- mod_case_filter_in.c	19 Jan 2002 05:54:44 -0000	1.9
  +++ mod_case_filter_in.c	19 Jan 2002 07:45:16 -0000	1.10
  @@ -101,6 +101,7 @@
   static apr_status_t CaseFilterInFilter(ap_filter_t *f,
                                          apr_bucket_brigade *pbbOut,
                                          ap_input_mode_t eMode,
  +                                       apr_read_type_e eBlock,
                                          apr_off_t *nBytes)
   {
       request_rec *r = f->r;
  @@ -113,9 +114,9 @@
       }
   
       if (APR_BRIGADE_EMPTY(pCtx->pbbTmp)) {
  -        ret = ap_get_brigade(f->next, pCtx->pbbTmp, eMode, nBytes);
  +        ret = ap_get_brigade(f->next, pCtx->pbbTmp, eMode, eBlock, nBytes);
   
  -        if (eMode == AP_MODE_PEEK || ret != APR_SUCCESS)
  +        if (eMode == AP_MODE_EATCRLF || ret != APR_SUCCESS)
               return ret;
       }
   
  @@ -140,7 +141,7 @@
               break;
           }
   
  -        ret=apr_bucket_read(pbktIn, &data, &len, eMode);
  +        ret=apr_bucket_read(pbktIn, &data, &len, eBlock);
           if(ret != APR_SUCCESS)
               return ret;
   
  
  
  
  1.55      +5 -3      httpd-2.0/modules/experimental/mod_charset_lite.c
  
  Index: mod_charset_lite.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_charset_lite.c,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- mod_charset_lite.c	10 Jan 2002 09:11:32 -0000	1.54
  +++ mod_charset_lite.c	19 Jan 2002 07:45:16 -0000	1.55
  @@ -990,7 +990,8 @@
   }
   
   static int xlate_in_filter(ap_filter_t *f, apr_bucket_brigade *bb, 
  -                           ap_input_mode_t mode, apr_off_t *readbytes)
  +                           ap_input_mode_t mode, apr_read_type_e block,
  +                           apr_off_t *readbytes)
   {
       apr_status_t rv;
       charset_req_t *reqinfo = ap_get_module_config(f->r->request_config,
  @@ -1034,11 +1035,12 @@
       }
   
       if (ctx->noop) {
  -        return ap_get_brigade(f->next, bb, mode, readbytes);
  +        return ap_get_brigade(f->next, bb, mode, block, readbytes);
       }
   
       if (APR_BRIGADE_EMPTY(ctx->bb)) {
  -        if ((rv = ap_get_brigade(f->next, bb, mode, readbytes)) != APR_SUCCESS) {
  +        if ((rv = ap_get_brigade(f->next, bb, mode, block, 
  +                                 readbytes)) != APR_SUCCESS) {
               return rv;
           }
       }
  
  
  
  1.19      +3 -2      httpd-2.0/modules/experimental/mod_ext_filter.c
  
  Index: mod_ext_filter.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_ext_filter.c,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- mod_ext_filter.c	10 Jan 2002 09:11:32 -0000	1.18
  +++ mod_ext_filter.c	19 Jan 2002 07:45:16 -0000	1.19
  @@ -749,7 +749,8 @@
   
   #if 0
   static int ef_input_filter(ap_filter_t *f, apr_bucket_brigade *bb, 
  -                           ap_input_mode_t mode, apr_off_t *readbytes)
  +                           ap_input_mode_t mode, apr_read_type_e block,
  +                           apr_off_t *readbytes)
   {
       apr_status_t rv;
       apr_bucket *b;
  @@ -757,7 +758,7 @@
       apr_ssize_t len;
       char *zero;
   
  -    rv = ap_get_brigade(f->next, bb, mode, readbytes);
  +    rv = ap_get_brigade(f->next, bb, mode, block, readbytes);
       if (rv != APR_SUCCESS) {
           return rv;
       }
  
  
  
  1.388     +7 -6      httpd-2.0/modules/http/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/http/http_protocol.c,v
  retrieving revision 1.387
  retrieving revision 1.388
  diff -u -r1.387 -r1.388
  --- http_protocol.c	14 Jan 2002 14:44:25 -0000	1.387
  +++ http_protocol.c	19 Jan 2002 07:45:17 -0000	1.388
  @@ -533,15 +533,16 @@
    * are successfully parsed. 
    */
   apr_status_t ap_http_filter(ap_filter_t *f, apr_bucket_brigade *b,
  -                            ap_input_mode_t mode, apr_off_t *readbytes)
  +                            ap_input_mode_t mode, apr_read_type_e block,
  +                            apr_off_t *readbytes)
   {
       apr_bucket *e;
       http_ctx_t *ctx = f->ctx;
       apr_status_t rv;
   
       /* just get out of the way of this thing. */
  -    if (mode == AP_MODE_PEEK) {
  -        return ap_get_brigade(f->next, b, mode, readbytes);
  +    if (mode == AP_MODE_EATCRLF) {
  +        return ap_get_brigade(f->next, b, mode, block, readbytes);
       }
   
       if (!ctx) {
  @@ -648,7 +649,7 @@
           AP_DEBUG_ASSERT(*readbytes > 0); /* shouldn't be in getline mode */
       }
   
  -    rv = ap_get_brigade(f->next, b, mode, readbytes);
  +    rv = ap_get_brigade(f->next, b, mode, block, readbytes);
   
       if (rv != APR_SUCCESS) {
           return rv;
  @@ -1479,8 +1480,8 @@
       /* read until we get a non-empty brigade */
       while (APR_BRIGADE_EMPTY(bb)) {
           apr_off_t len_read = bufsiz;
  -        if (ap_get_brigade(r->input_filters, bb, AP_MODE_BLOCKING,
  -                           &len_read) != APR_SUCCESS) {
  +        if (ap_get_brigade(r->input_filters, bb, AP_MODE_READBYTES,
  +                           APR_BLOCK_READ, &len_read) != APR_SUCCESS) {
               /* if we actually fail here, we want to just return and
                * stop trying to read data from the client.
                */
  
  
  
  1.124     +2 -1      httpd-2.0/modules/http/http_request.c
  
  Index: http_request.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/http/http_request.c,v
  retrieving revision 1.123
  retrieving revision 1.124
  diff -u -r1.123 -r1.124
  --- http_request.c	16 Jan 2002 04:29:10 -0000	1.123
  +++ http_request.c	19 Jan 2002 07:45:17 -0000	1.124
  @@ -249,7 +249,8 @@
       /* ### shouldn't this read from the connection input filters? */
       /* ### is zero correct? that means "read one line" */
       if (!r->connection->keepalive || 
  -        ap_get_brigade(r->input_filters, bb, AP_MODE_PEEK, &zero) != APR_SUCCESS)
{
  +        ap_get_brigade(r->input_filters, bb, AP_MODE_EATCRLF, 
  +                       APR_NONBLOCK_READ, &zero) != APR_SUCCESS) {
           apr_bucket *e = apr_bucket_flush_create();
   
           /* We just send directly to the connection based filters.  At
  
  
  
  1.18      +2 -1      httpd-2.0/modules/http/mod_core.h
  
  Index: mod_core.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/http/mod_core.h,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- mod_core.h	11 Oct 2001 19:44:51 -0000	1.17
  +++ mod_core.h	19 Jan 2002 07:45:17 -0000	1.18
  @@ -74,7 +74,8 @@
    * These (input) filters are internal to the mod_core operation.
    */
   apr_status_t ap_http_filter(ap_filter_t *f, apr_bucket_brigade *b,
  -                            ap_input_mode_t mode, apr_off_t *readbytes);
  +                            ap_input_mode_t mode, apr_read_type_e block,
  +                            apr_off_t *readbytes);
   
   char *ap_response_code_string(request_rec *r, int error_index);
   
  
  
  
  1.85      +2 -1      httpd-2.0/modules/proxy/proxy_ftp.c
  
  Index: proxy_ftp.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_ftp.c,v
  retrieving revision 1.84
  retrieving revision 1.85
  diff -u -r1.84 -r1.85
  --- proxy_ftp.c	18 Dec 2001 20:29:27 -0000	1.84
  +++ proxy_ftp.c	19 Jan 2002 07:45:17 -0000	1.85
  @@ -1586,7 +1586,8 @@
   		     "proxy: FTP: start body send");
   
   	/* read the body, pass it to the output filters */
  -	while (ap_get_brigade(remote->input_filters, bb, AP_MODE_BLOCKING, &readbytes)
== APR_SUCCESS) {
  +	while (ap_get_brigade(remote->input_filters, bb, AP_MODE_READBYTES,
  +                          APR_BLOCK_READ, &readbytes) == APR_SUCCESS) {
   	    if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(bb))) {
   		ap_pass_brigade(r->output_filters, bb);
   		break;
  
  
  
  1.121     +3 -2      httpd-2.0/modules/proxy/proxy_http.c
  
  Index: proxy_http.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_http.c,v
  retrieving revision 1.120
  retrieving revision 1.121
  diff -u -r1.120 -r1.121
  --- proxy_http.c	4 Jan 2002 01:47:55 -0000	1.120
  +++ proxy_http.c	19 Jan 2002 07:45:17 -0000	1.121
  @@ -844,8 +844,9 @@
                   apr_bucket *e;
                   readbytes = AP_IOBUFSIZE;
                   while (ap_get_brigade(rp->input_filters, 
  -                                       bb, 
  -                                      AP_MODE_BLOCKING, 
  +                                      bb, 
  +                                      AP_MODE_READBYTES, 
  +                                      APR_BLOCK_READ, 
                                         &readbytes) == APR_SUCCESS) {
   #if DEBUGGING
                       ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0,
  
  
  
  1.78      +2 -1      httpd-2.0/modules/proxy/proxy_util.c
  
  Index: proxy_util.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_util.c,v
  retrieving revision 1.77
  retrieving revision 1.78
  diff -u -r1.77 -r1.78
  --- proxy_util.c	3 Jan 2002 19:20:54 -0000	1.77
  +++ proxy_util.c	19 Jan 2002 07:45:17 -0000	1.78
  @@ -1017,7 +1017,8 @@
           apr_off_t zero = 0;
           /* get brigade from network one line at a time */
           if (APR_SUCCESS != (rv = ap_get_brigade(c->input_filters, bb, 
  -                                                AP_MODE_BLOCKING, 
  +                                                AP_MODE_GETLINE,
  +                                                APR_BLOCK_READ,
                                                   &zero /* readline */))) {
               return rv;
           }
  
  
  
  1.54      +19 -14    httpd-2.0/modules/ssl/ssl_engine_io.c
  
  Index: ssl_engine_io.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/ssl/ssl_engine_io.c,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- ssl_engine_io.c	18 Jan 2002 00:13:25 -0000	1.53
  +++ ssl_engine_io.c	19 Jan 2002 07:45:18 -0000	1.54
  @@ -297,7 +297,7 @@
       ap_filter_t *f;
       apr_status_t rc;
       ap_input_mode_t mode;
  -    int getline;
  +    apr_read_type_e block;
       apr_bucket_brigade *bb;
       apr_bucket *bucket;
       char_buffer_t cbuf;
  @@ -368,7 +368,7 @@
       
       /* first use data already read from socket if any */
       if ((len = char_buffer_read(&inbio->cbuf, in, inl))) {
  -        if ((len <= inl) || inbio->getline) {
  +        if ((len <= inl) || inbio->mode == AP_MODE_GETLINE) {
               return len;
           }
       }
  @@ -386,8 +386,11 @@
           }
   
           if (APR_BRIGADE_EMPTY(inbio->bb)) {
  +            /* We will always call with READBYTES even if the user wants
  +             * GETLINE.
  +             */
               inbio->rc = ap_get_brigade(inbio->f->next, inbio->bb,
  -                                       inbio->mode, &readbytes);
  +                                       AP_MODE_READBYTES, inbio->block, &readbytes);
   
               if ((inbio->rc != APR_SUCCESS) || APR_BRIGADE_EMPTY(inbio->bb))
               {
  @@ -398,7 +401,7 @@
           inbio->bucket = APR_BRIGADE_FIRST(inbio->bb);
   
           inbio->rc = apr_bucket_read(inbio->bucket,
  -                                    &buf, &buf_len, inbio->mode);
  +                                    &buf, &buf_len, inbio->block);
   
           if (inbio->rc != APR_SUCCESS) {
               apr_bucket_delete(inbio->bucket);
  @@ -433,7 +436,7 @@
               }
           }
   
  -        if (inbio->getline) {
  +        if (inbio->mode == AP_MODE_GETLINE) {
               /* only read from the socket once in getline mode.
                * since callers buffer size is likely much larger than
                * the request headers.  caller can always come back for more
  @@ -643,7 +646,7 @@
   
       if ((bytes = char_buffer_read(&ctx->cbuf, buf, wanted))) {
           *len = bytes;
  -        if ((*len >= wanted) || ctx->inbio.getline) {
  +        if ((*len >= wanted) || ctx->inbio.mode == AP_MODE_GETLINE) {
               return APR_SUCCESS;
           }
       }
  @@ -664,9 +667,7 @@
       const char *pos;
       apr_status_t status;
   
  -    ctx->inbio.getline = 1;
       status = ssl_io_input_read(ctx, buf, len);
  -    ctx->inbio.getline = 0;
   
       if (status != APR_SUCCESS) {
           return status;
  @@ -725,6 +726,7 @@
   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_status_t status;
  @@ -735,11 +737,12 @@
       int is_init = (mode == AP_MODE_INIT);
   
       /* XXX: we don't currently support peek or readbytes == -1 */
  -    if (mode == AP_MODE_PEEK || *readbytes == -1) {
  +    if (mode == AP_MODE_EATCRLF || *readbytes == -1) {
           return APR_ENOTIMPL;
       }
   
  -    ctx->inbio.mode = is_init ? AP_MODE_BLOCKING : mode;
  +    ctx->inbio.mode = mode;
  +    ctx->inbio.block = block;
   
       /* XXX: we could actually move ssl_hook_process_connection to an
        * ap_hook_process_connection but would still need to call it for
  @@ -759,17 +762,20 @@
           return APR_SUCCESS;
       }
   
  -    if (bytes > 0) {
  +    if (ctx->inbio.mode == AP_MODE_READBYTES) {
           /* Protected from truncation, bytes < MAX_SIZE_T */
           if (bytes < len) {
               len = (apr_size_t)bytes;
           }
  -        ctx->inbio.getline = 0;
           status = ssl_io_input_read(ctx, ctx->buffer, &len);
       }
  -    else {
  +    else if (ctx->inbio.mode == AP_MODE_GETLINE) {
           status = ssl_io_input_getline(ctx, ctx->buffer, &len);
       }
  +    else {
  +        /* We have no idea what you are talking about, so return an error. */
  +        return APR_ENOTIMPL;
  +    }
   
       if (status != APR_SUCCESS) {
           return ssl_io_filter_error(f, bb, status);
  @@ -804,7 +810,6 @@
       ctx->inbio.f = frec->pInputFilter;
       ctx->inbio.bb = apr_brigade_create(c->pool);
       ctx->inbio.bucket = NULL;
  -    ctx->inbio.getline = 0;
       ctx->inbio.cbuf.length = 0;
   
       ctx->cbuf.length = 0;
  
  
  
  1.131     +14 -10    httpd-2.0/server/core.c
  
  Index: core.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/core.c,v
  retrieving revision 1.130
  retrieving revision 1.131
  diff -u -r1.130 -r1.131
  --- core.c	12 Jan 2002 02:43:31 -0000	1.130
  +++ core.c	19 Jan 2002 07:45:18 -0000	1.131
  @@ -2973,7 +2973,9 @@
       return ap_pass_brigade(r->output_filters, bb);
   }
   
  -static int net_time_filter(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode,
apr_off_t *readbytes)
  +static int net_time_filter(ap_filter_t *f, apr_bucket_brigade *b, 
  +                           ap_input_mode_t mode, apr_read_type_e block,
  +                           apr_off_t *readbytes)
   {
       int keptalive = f->c->keepalive == 1;
       apr_socket_t *csd = ap_get_module_config(f->c->conn_config, &core_module);
  @@ -2984,7 +2986,7 @@
           *first_line = 1;
       }
   
  -    if (mode != AP_MODE_INIT && mode != AP_MODE_PEEK) {
  +    if (mode != AP_MODE_INIT && mode != AP_MODE_EATCRLF) {
           if (*first_line) {
               apr_setsocketopt(csd, APR_SO_TIMEOUT,
                                (int)(keptalive
  @@ -2999,10 +3001,12 @@
               }
           }
       }
  -    return ap_get_brigade(f->next, b, mode, readbytes);
  +    return ap_get_brigade(f->next, b, mode, block, readbytes);
   }
   
  -static int core_input_filter(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode,
apr_off_t *readbytes)
  +static int core_input_filter(ap_filter_t *f, apr_bucket_brigade *b, 
  +                             ap_input_mode_t mode, apr_read_type_e block,
  +                             apr_off_t *readbytes)
   {
       apr_bucket *e;
       apr_status_t rv;
  @@ -3046,7 +3050,7 @@
       /* ### AP_MODE_PEEK is a horrific name for this mode because we also
        * eat any CRLFs that we see.  That's not the obvious intention of
        * this mode.  Determine whether anyone actually uses this or not. */
  -    if (mode == AP_MODE_PEEK) {
  +    if (mode == AP_MODE_EATCRLF) {
           apr_bucket *e;
           const char *c;
   
  @@ -3096,7 +3100,7 @@
        *     This is just an all-around bad idea.  We may be better off by 
        *     just closing the socket.  Determine whether anyone uses this.
        */
  -    if (*readbytes == -1) {
  +    if (mode == AP_MODE_EXHAUSTIVE) {
           apr_bucket *e;
           apr_off_t total;
   
  @@ -3110,8 +3114,8 @@
           APR_BRIGADE_INSERT_TAIL(b, e);
           return APR_SUCCESS;
       }
  -    /* readbytes == 0 is "read a single line". otherwise, read a block. */
  -    if (*readbytes) {
  +    /* read up to the amount they specified. */
  +    if (mode == AP_MODE_READBYTES) {
           apr_off_t total;
           apr_bucket *e;
           apr_bucket_brigade *newbb;
  @@ -3119,7 +3123,7 @@
           AP_DEBUG_ASSERT(*readbytes > 0);
           
           e = APR_BRIGADE_FIRST(ctx->b);
  -        rv = apr_bucket_read(e, &str, &len, mode);
  +        rv = apr_bucket_read(e, &str, &len, block);
   
           if (APR_STATUS_IS_EAGAIN(rv)) {
               *readbytes = 0;
  @@ -3153,7 +3157,7 @@
           const char *pos;
   
           e = APR_BRIGADE_FIRST(ctx->b);
  -        rv = apr_bucket_read(e, &str, &len, mode);
  +        rv = apr_bucket_read(e, &str, &len, block);
   
           /* We should treat EAGAIN here the same as we do for EOF (brigade is
            * empty).  We do this by returning whatever we have read.  This may 
  
  
  
  1.66      +3 -2      httpd-2.0/server/protocol.c
  
  Index: protocol.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/protocol.c,v
  retrieving revision 1.65
  retrieving revision 1.66
  diff -u -r1.65 -r1.66
  --- protocol.c	13 Jan 2002 21:30:14 -0000	1.65
  +++ protocol.c	19 Jan 2002 07:45:18 -0000	1.66
  @@ -223,8 +223,9 @@
           if (APR_BRIGADE_EMPTY(b)) {
               apr_off_t zero = 0;
               if ((retval = ap_get_brigade(r->input_filters, b,
  -                                         AP_MODE_BLOCKING,
  -                                         &zero /* readline */)) != APR_SUCCESS ||
  +                                         AP_MODE_GETLINE,
  +                                         APR_BLOCK_READ,
  +                                         &zero)) != APR_SUCCESS ||
                   APR_BRIGADE_EMPTY(b)) {
                   apr_brigade_destroy(b);
                   return -1;
  
  
  
  1.74      +3 -1      httpd-2.0/server/util_filter.c
  
  Index: util_filter.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/util_filter.c,v
  retrieving revision 1.73
  retrieving revision 1.74
  diff -u -r1.73 -r1.74
  --- util_filter.c	28 Dec 2001 05:46:21 -0000	1.73
  +++ util_filter.c	19 Jan 2002 07:45:18 -0000	1.74
  @@ -356,10 +356,12 @@
   AP_DECLARE(apr_status_t) ap_get_brigade(ap_filter_t *next,
                                           apr_bucket_brigade *bb, 
                                           ap_input_mode_t mode,
  +                                        apr_read_type_e block,
                                           apr_off_t *readbytes)
   {
       if (next) {
  -        return next->frec->filter_func.in_func(next, bb, mode, readbytes);
  +        return next->frec->filter_func.in_func(next, bb, mode, block, 
  +                                               readbytes);
       }
       return AP_NOBODY_READ;
   }
  
  
  
  1.99      +7 -4      httpd-2.0/server/mpm/perchild/perchild.c
  
  Index: perchild.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/perchild/perchild.c,v
  retrieving revision 1.98
  retrieving revision 1.99
  diff -u -r1.98 -r1.99
  --- perchild.c	10 Jan 2002 00:27:59 -0000	1.98
  +++ perchild.c	19 Jan 2002 07:45:18 -0000	1.99
  @@ -1550,8 +1550,8 @@
       /* ### this "read one line" doesn't seem right... shouldn't we be
          ### reading large chunks of data or something?
       */
  -    while (ap_get_brigade(r->input_filters, bb, AP_MODE_NONBLOCKING,
  -                          &zero /* read one line */) == APR_SUCCESS) {
  +    while (ap_get_brigade(r->input_filters, bb, AP_MODE_GETLINE, 
  +                          APR_NONBLOCK_READ, &zero) == APR_SUCCESS) {
           apr_bucket *e;
           APR_BRIGADE_FOREACH(e, bb) {
               const char *str;
  @@ -1656,7 +1656,9 @@
   }
   
   static apr_status_t perchild_buffer(ap_filter_t *f, apr_bucket_brigade *b,
  -                                    ap_input_mode_t mode, apr_off_t *readbytes)
  +                                    ap_input_mode_t mode, 
  +                                    apr_read_type_e block,
  +                                    apr_off_t *readbytes)
   {
       apr_bucket *e;
       apr_status_t rv;
  @@ -1664,7 +1666,8 @@
       const char *str;
       apr_size_t len;
   
  -    if ((rv = ap_get_brigade(f->next, b, mode, readbytes)) != APR_SUCCESS) {
  +    if ((rv = ap_get_brigade(f->next, b, mode, block, 
  +                             readbytes)) != APR_SUCCESS) {
           return rv;
       }
   
  
  
  

Mime
View raw message