httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject cvs commit: httpd-2.0/server/mpm/perchild perchild.c
Date Sun, 06 May 2001 23:27:14 GMT
rbb         01/05/06 16:27:14

  Modified:    include  util_filter.h
               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/mappers mod_alias.c
               modules/tls mod_tls.c
               server   core.c protocol.c util_filter.c
               server/mpm/perchild perchild.c
  Log:
  Back out the recent change to ap_get_brigade, to make it use indirection
  again.  The problem is that the amount of data read from the network,
  is not necessarily the amount of data returned from the filters.  It is
  possible for input filters to add bytes to the data read from the network.
  
  To fix the original bug, I just removed the line from ap_get_client_block
  that decremented r->remaining, we allow the http_filter to do that for
  us.
  
  I have also removed an incorrect comment.
  
  Revision  Changes    Path
  1.53      +2 -2      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.52
  retrieving revision 1.53
  diff -u -d -b -w -u -r1.52 -r1.53
  --- util_filter.h	2001/05/05 11:17:53	1.52
  +++ util_filter.h	2001/05/06 23:27:11	1.53
  @@ -155,7 +155,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_size_t readbytes);
  +                                          ap_input_mode_t mode, apr_size_t *readbytes);
   
   typedef union ap_filter_func {
       ap_out_filter_func out_func;
  @@ -276,7 +276,7 @@
    *                  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_size_t readbytes);
  +                                        ap_input_mode_t mode, apr_size_t *readbytes);
   
   /**
    * Pass the current bucket brigade down to the next filter on the filter
  
  
  
  1.2       +1 -1      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.1
  retrieving revision 1.2
  diff -u -d -b -w -u -r1.1 -r1.2
  --- mod_case_filter_in.c	2001/05/06 17:08:06	1.1
  +++ mod_case_filter_in.c	2001/05/06 23:27:11	1.2
  @@ -47,7 +47,7 @@
   
   static apr_status_t CaseFilterInFilter(ap_filter_t *f,
   				       apr_bucket_brigade *pbbOut,
  -				       ap_input_mode_t eMode,apr_size_t nBytes)
  +				       ap_input_mode_t eMode,apr_size_t *nBytes)
   {
       CaseFilterInContext *pCtx=f->ctx;
       apr_status_t ret;
  
  
  
  1.47      +1 -1      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.46
  retrieving revision 1.47
  diff -u -d -b -w -u -r1.46 -r1.47
  --- mod_charset_lite.c	2001/05/05 11:17:55	1.46
  +++ mod_charset_lite.c	2001/05/06 23:27:11	1.47
  @@ -1005,7 +1005,7 @@
   }
   
   static int xlate_in_filter(ap_filter_t *f, apr_bucket_brigade *bb, 
  -                           ap_input_mode_t mode, apr_size_t readbytes)
  +                           ap_input_mode_t mode, apr_size_t *readbytes)
   {
       apr_status_t rv;
       charset_req_t *reqinfo = ap_get_module_config(f->r->request_config,
  
  
  
  1.16      +1 -1      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.15
  retrieving revision 1.16
  diff -u -d -b -w -u -r1.15 -r1.16
  --- mod_ext_filter.c	2001/05/05 11:17:56	1.15
  +++ mod_ext_filter.c	2001/05/06 23:27:11	1.16
  @@ -749,7 +749,7 @@
   
   #if 0
   static int ef_input_filter(ap_filter_t *f, apr_bucket_brigade *bb, 
  -                           ap_input_mode_t mode, apr_size_t readbytes)
  +                           ap_input_mode_t mode, apr_size_t *readbytes)
   {
       apr_status_t rv;
       apr_bucket *b;
  
  
  
  1.319     +10 -11    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.318
  retrieving revision 1.319
  diff -u -d -b -w -u -r1.318 -r1.319
  --- http_protocol.c	2001/05/05 11:17:57	1.318
  +++ http_protocol.c	2001/05/06 23:27:12	1.319
  @@ -424,7 +424,7 @@
   static long get_chunk_size(char *);
   
   apr_status_t ap_dechunk_filter(ap_filter_t *f, apr_bucket_brigade *bb,
  -                               ap_input_mode_t mode, apr_size_t readbytes)
  +                               ap_input_mode_t mode, apr_size_t *readbytes)
   {
       apr_status_t rv;
       struct dechunk_ctx *ctx = f->ctx;
  @@ -484,7 +484,7 @@
           apr_size_t chunk_bytes = ctx->chunk_size - ctx->bytes_delivered;
   
           if ((rv = ap_get_brigade(f->next, bb, mode,
  -                                 chunk_bytes)) != APR_SUCCESS) {
  +                                 &chunk_bytes)) != APR_SUCCESS) {
               return rv;
           }
   
  @@ -518,7 +518,7 @@
       apr_bucket_brigade *b;
   } http_ctx_t;
   
  -apr_status_t ap_http_filter(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode,
apr_size_t readbytes)
  +apr_status_t ap_http_filter(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode,
apr_size_t *readbytes)
   {
       apr_bucket *e;
       char *buff;
  @@ -577,7 +577,7 @@
       }
   
       /* readbytes == 0 is "read a single line". otherwise, read a block. */
  -    if (readbytes) {
  +    if (*readbytes) {
   
           /* ### the code below, which moves bytes from one brigade to the
              ### other is probably bogus. presuming the next filter down was
  @@ -604,12 +604,12 @@
                    * a time - don't assume that one call to apr_bucket_read()
                    * will return the full string.
                    */
  -                if (readbytes < len) {
  -                    apr_bucket_split(e, readbytes);
  -                    readbytes = 0;
  +                if (*readbytes < len) {
  +                    apr_bucket_split(e, *readbytes);
  +                    *readbytes = 0;
                   }
                   else {
  -                    readbytes -= len;
  +                    *readbytes -= len;
                   }
                   APR_BUCKET_REMOVE(e);
                   APR_BRIGADE_INSERT_TAIL(b, e);
  @@ -628,7 +628,7 @@
              ### chunks to determine where the end of the request is, so we
              ### shouldn't be monkeying with EOS buckets.
           */
  -        if (readbytes == 0) {
  +        if (*readbytes == 0) {
               apr_bucket *eos = apr_bucket_eos_create();
                   
               APR_BRIGADE_INSERT_TAIL(b, eos);
  @@ -1403,7 +1403,7 @@
       do {
           if (APR_BRIGADE_EMPTY(bb)) {
               if (ap_get_brigade(r->input_filters, bb, AP_MODE_BLOCKING,
  -                               r->remaining) != APR_SUCCESS) {
  +                               &r->remaining) != APR_SUCCESS) {
                   /* if we actually fail here, we want to just return and
                    * stop trying to read data from the client.
                    */
  @@ -1449,7 +1449,6 @@
            * these
            */
           r->read_length += len_read;      /* XXX yank me? */
  -        r->remaining -= len_read;        /* XXX yank me? */
           old = b;
           b = APR_BUCKET_NEXT(b);
           apr_bucket_delete(old);
  
  
  
  1.97      +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.96
  retrieving revision 1.97
  diff -u -d -b -w -u -r1.96 -r1.97
  --- http_request.c	2001/05/05 11:17:57	1.96
  +++ http_request.c	2001/05/06 23:27:12	1.97
  @@ -367,6 +367,7 @@
          ### allow us to defer creation of the brigade to when we actually
          ### need to send a FLUSH. */
       apr_bucket_brigade *bb = apr_brigade_create(r->pool);
  +    int zero = 0;
   
       /* Flush the filter contents if:
        *
  @@ -376,7 +377,7 @@
       /* ### 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, 0) != APR_SUCCESS) {
  +        ap_get_brigade(r->input_filters, bb, AP_MODE_PEEK, &zero) != APR_SUCCESS)
{
           apr_bucket *e = apr_bucket_flush_create();
   
           /* We just send directly to the connection based filters.  At
  
  
  
  1.12      +2 -2      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.11
  retrieving revision 1.12
  diff -u -d -b -w -u -r1.11 -r1.12
  --- mod_core.h	2001/05/05 11:17:57	1.11
  +++ mod_core.h	2001/05/06 23:27:12	1.12
  @@ -74,9 +74,9 @@
    * 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_size_t readbytes);
  +                            ap_input_mode_t mode, apr_size_t *readbytes);
   apr_status_t ap_dechunk_filter(ap_filter_t *f, apr_bucket_brigade *b,
  -                               ap_input_mode_t mode, apr_size_t readbytes);
  +                               ap_input_mode_t mode, apr_size_t *readbytes);
   
   char *ap_response_code_string(request_rec *r, int error_index);
   
  
  
  
  1.28      +10 -1     httpd-2.0/modules/mappers/mod_alias.c
  
  Index: mod_alias.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_alias.c,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -d -b -w -u -r1.27 -r1.28
  --- mod_alias.c	2001/02/18 02:58:52	1.27
  +++ mod_alias.c	2001/05/06 23:27:12	1.28
  @@ -335,7 +335,16 @@
   		    found = ap_pregsub(r->pool, p->real, r->uri,
   				    p->regexp->re_nsub + 1, regm);
   		    if (found && doesc) {
  -			found = ap_escape_uri(r->pool, found);
  +                        uri_components uri;
  +                        ap_parse_uri_components(r->pool, found, &uri);
  +			found = ap_escape_uri(r->pool, uri.path);
  +                        if (uri.query) {
  +                            found = apr_pstrcat(r->pool, found, "?", uri.query, NULL);
  +                        }
  +                        else if (uri.fragment) {
  +                            found = apr_pstrcat(r->pool, found, "#", uri.fragment, NULL);
  +
  +                        }
   		    }
   		}
   		else {
  
  
  
  1.13      +2 -2      httpd-2.0/modules/tls/mod_tls.c
  
  Index: mod_tls.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/tls/mod_tls.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -d -b -w -u -r1.12 -r1.13
  --- mod_tls.c	2001/05/05 11:17:54	1.12
  +++ mod_tls.c	2001/05/06 23:27:13	1.13
  @@ -186,7 +186,7 @@
       return APR_SUCCESS;
   }
   
  -static apr_status_t churn(TLSFilterCtx *pCtx,apr_read_type_e eReadType,apr_size_t readbytes)
  +static apr_status_t churn(TLSFilterCtx *pCtx,apr_read_type_e eReadType,apr_size_t *readbytes)
   {
       ap_input_mode_t eMode=eReadType == APR_BLOCK_READ ? AP_MODE_BLOCKING
         : AP_MODE_NONBLOCKING;
  @@ -333,7 +333,7 @@
   }
   
   static apr_status_t tls_in_filter(ap_filter_t *f,apr_bucket_brigade *pbbOut,
  -				  ap_input_mode_t eMode, apr_size_t readbytes)
  +				  ap_input_mode_t eMode, apr_size_t *readbytes)
   {
       TLSFilterCtx *pCtx=f->ctx;
       apr_read_type_e eReadType=eMode == AP_MODE_BLOCKING ? APR_BLOCK_READ :
  
  
  
  1.16      +1 -9      httpd-2.0/server/core.c
  
  Index: core.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/core.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -d -b -w -u -r1.15 -r1.16
  --- core.c	2001/05/05 11:17:59	1.15
  +++ core.c	2001/05/06 23:27:13	1.16
  @@ -2995,17 +2995,9 @@
       return ap_pass_brigade(r->output_filters, bb);
   }
   
  -static int core_input_filter(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode,
apr_size_t readbytes)
  +static int core_input_filter(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t mode,
apr_size_t *readbytes)
   {
       apr_bucket *e;
  -
  -    /* ### we should obey readbytes. the policy is to not insert more than
  -       ### READBYTES into the brigade. the caller knows the amount that is
  -       ### proper for the protocol. reading more than that could cause
  -       ### problems.
  -       ### (of course, we can read them from the socket, we just should not
  -       ###  return them until asked)
  -    */
   
       if (!f->ctx) {    /* If we haven't passed up the socket yet... */
           f->ctx = (void *)1;
  
  
  
  1.19      +2 -1      httpd-2.0/server/protocol.c
  
  Index: protocol.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/protocol.c,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -d -b -w -u -r1.18 -r1.19
  --- protocol.c	2001/05/05 11:17:59	1.18
  +++ protocol.c	2001/05/06 23:27:13	1.19
  @@ -217,9 +217,10 @@
   
       while (1) {
           if (APR_BRIGADE_EMPTY(b)) {
  +            int zero = 0;
               if ((retval = ap_get_brigade(c->input_filters, b,
                                            AP_MODE_BLOCKING,
  -                                         0 /* readline */)) != APR_SUCCESS ||
  +                                         &zero /* readline */)) != APR_SUCCESS ||
                   APR_BRIGADE_EMPTY(b)) {
                   apr_brigade_destroy(b);
                   return -1;
  
  
  
  1.58      +1 -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.57
  retrieving revision 1.58
  diff -u -d -b -w -u -r1.57 -r1.58
  --- util_filter.c	2001/05/05 11:17:59	1.57
  +++ util_filter.c	2001/05/06 23:27:13	1.58
  @@ -211,7 +211,7 @@
   AP_DECLARE(apr_status_t) ap_get_brigade(ap_filter_t *next,
                                           apr_bucket_brigade *bb, 
                                           ap_input_mode_t mode,
  -                                        apr_size_t readbytes)
  +                                        apr_size_t *readbytes)
   {
       if (next) {
           return next->frec->filter_func.in_func(next, bb, mode, readbytes);
  
  
  
  1.65      +3 -2      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.64
  retrieving revision 1.65
  diff -u -d -b -w -u -r1.64 -r1.65
  --- perchild.c	2001/05/05 11:18:01	1.64
  +++ perchild.c	2001/05/06 23:27:14	1.65
  @@ -1362,6 +1362,7 @@
                                                    &mpm_perchild_module);
       char *foo;
       apr_size_t len;
  +    int zero = 0;
   
       apr_pool_userdata_get((void **)&foo, "PERCHILD_BUFFER", r->connection->pool);
       len = strlen(foo);
  @@ -1401,7 +1402,7 @@
          ### reading large chunks of data or something?
       */
       while (ap_get_brigade(r->input_filters, bb, AP_MODE_NONBLOCKING,
  -                          0 /* read one line */) == APR_SUCCESS) {
  +                          &zero /* read one line */) == APR_SUCCESS) {
           apr_bucket *e;
           APR_BRIGADE_FOREACH(e, bb) {
               const char *str;
  @@ -1495,7 +1496,7 @@
       return OK;
   }
   
  -static apr_status_t perchild_buffer(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t
mode, apr_size_t readbytes)
  +static apr_status_t perchild_buffer(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mode_t
mode, apr_size_t *readbytes)
   {
       apr_bucket *e;
       apr_status_t rv;
  
  
  

Mime
View raw message