joes        2003/07/15 09:15:51

  Modified:    .        CHANGES
               env      mod_apreq.c
               env/c-modules/apreq_request_test mod_apreq_request_test.c
               env/t    request.t
               src      apreq.h apreq_params.c apreq_parsers.c
                        apreq_parsers.h
  Log:
  make apreq_brigade_concat public, and use it for controlling mod_apreq's 
spool.
  
  Revision  Changes    Path
  1.5       +2 -0      httpd-apreq-2/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/CHANGES,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- CHANGES   15 Jul 2003 14:04:40 -0000      1.4
  +++ CHANGES   15 Jul 2003 16:15:50 -0000      1.5
  @@ -5,6 +5,8 @@
   - July 15, 2003 - C API [joes]
   
   Dropped param->charset.
  +Make apreq_brigade_concat public, so mod_apreq can use it
  +for its ctx->spool brigade.
   
   - July 14, 2003 - Documentation [joes]
   
  
  
  
  1.25      +16 -12    httpd-apreq-2/env/mod_apreq.c
  
  Index: mod_apreq.c
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/env/mod_apreq.c,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- mod_apreq.c       10 Jul 2003 23:18:30 -0000      1.24
  +++ mod_apreq.c       15 Jul 2003 16:15:50 -0000      1.25
  @@ -211,11 +211,11 @@
       if (req != NULL) {
           apreq_request_t *old = c->req;
           c->req = req;
  +        apreq_log(APREQ_DEBUG 0, r, 
  +                  "apreq request is now initialized" );
           return old;
       }
   
  -    apreq_log(APREQ_DEBUG 0, r, 
  -              "apreq request is now initialized" );
       return c->req;
   }
   
  @@ -325,6 +325,7 @@
       request_rec *r = f->r;
       struct filter_ctx *ctx;
       apr_status_t rv;
  +    apreq_request_t *req;
   
       if (f->ctx == NULL)
           apreq_filter_make_context(f);
  @@ -341,9 +342,10 @@
       }
       apreq_log(APREQ_DEBUG ctx->status, r, "entering filter (%d)",
                 r->input_filters == f);
  +    req = apreq_request(r, NULL);
  +
       if (bb != NULL) {
           apr_bucket_brigade *tmp;
  -
           rv = ap_get_brigade(f->next, bb, mode, block, readbytes);
           if (rv != APR_SUCCESS) {
               apreq_log(APREQ_ERROR rv, r, "get_brigade failed");
  @@ -361,18 +363,20 @@
                       apreq_log(APREQ_ERROR rv, r, "partition failed");
                       return rv;
                   }
  -                if (e != APR_BRIGADE_SENTINEL(bb)) {
  -                    apr_bucket *next = APR_BUCKET_NEXT(e);
  -                    if (APR_BUCKET_IS_EOS(next))
  -                        e = APR_BUCKET_NEXT(next);
  -                    ctx->spool = apr_brigade_split(bb, e);
  -                }
  +                if (APR_BUCKET_IS_EOS(e))
  +                    e = APR_BUCKET_NEXT(e);
  +                ctx->spool = apr_brigade_split(bb, e);
  +                apreq_log(APREQ_DEBUG rv,r, "returning %d bytes from spool", 
  +                          readbytes);
               }
           }
   
           if (ctx->status != APR_INCOMPLETE) {
  -            if (APR_BRIGADE_EMPTY(ctx->spool))
  +            if (APR_BRIGADE_EMPTY(ctx->spool)) {
                   ap_remove_input_filter(f);
  +                apreq_log(APREQ_DEBUG ctx->status,r,"removing filter(%d)",
  +                          r->input_filters == f);
  +            }
               return ctx->status;
           }
       }
  @@ -392,12 +396,12 @@
               bb = apreq_copy_brigade(tmp);
               apr_brigade_length(bb,0,&len);
               total_read += len;
  -            APR_BRIGADE_CONCAT(ctx->spool, tmp);
  +            apreq_brigade_concat(r->pool, req->cfg, ctx->spool, tmp);
               APR_BRIGADE_CONCAT(ctx->bb, bb);
               last = APR_BRIGADE_LAST(ctx->spool);
           }
       }
  -    ctx->status = apreq_parse_request(apreq_request(r, NULL), ctx->bb);
  +    ctx->status = apreq_parse_request(req, ctx->bb);
       apreq_log(APREQ_DEBUG ctx->status, r, "leaving filter (%d)",
                 r->input_filters == f);
       return (ctx->status == APR_INCOMPLETE) ? APR_SUCCESS : ctx->status;
  
  
  
  1.2       +2 -2      
httpd-apreq-2/env/c-modules/apreq_request_test/mod_apreq_request_test.c
  
  Index: mod_apreq_request_test.c
  ===================================================================
  RCS file: 
/home/cvs/httpd-apreq-2/env/c-modules/apreq_request_test/mod_apreq_request_test.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- mod_apreq_request_test.c  20 May 2003 20:50:41 -0000      1.1
  +++ mod_apreq_request_test.c  15 Jul 2003 16:15:50 -0000      1.2
  @@ -1,7 +1,7 @@
   /* ====================================================================
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
  + * Copyright (c) 2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -80,7 +80,7 @@
       apr_bucket_brigade *bb;
       apreq_request_t *req;
       apr_status_t s;
  -    int saw_eos = 1;
  +    int saw_eos = 0;
   
       if (strcmp(r->handler, "apreq_request_test") != 0)
           return DECLINED;
  
  
  
  1.4       +2 -1      httpd-apreq-2/env/t/request.t
  
  Index: request.t
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/env/t/request.t,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- request.t 10 Jul 2003 23:18:30 -0000      1.3
  +++ request.t 15 Jul 2003 16:15:50 -0000      1.4
  @@ -21,7 +21,7 @@
   
   my $filler = "0123456789" x 7000; # < 8000 + 64K
   my $body = POST_BODY("/apreq_access_test?foo=1;", 
  -                     content => "bar=2&quux=$filler;test=6");
  +                     content => "bar=2&quux=$filler;test=6&more=$filler");
   ok t_cmp(<<EOT, $body, "prefetch credentials");
   ARGS:
   \tfoo => 1
  @@ -29,4 +29,5 @@
   \tbar => 2
   \tquux => $filler
   \ttest => 6
  +\tmore => $filler
   EOT
  
  
  
  1.32      +1 -0      httpd-apreq-2/src/apreq.h
  
  Index: apreq.h
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/src/apreq.h,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- apreq.h   30 Jun 2003 20:42:14 -0000      1.31
  +++ apreq.h   15 Jul 2003 16:15:50 -0000      1.32
  @@ -400,6 +400,7 @@
   APREQ_DECLARE(apr_bucket_brigade *)
            apreq_copy_brigade(const apr_bucket_brigade *bb);
   
  +
   /** @} */
   
   #ifdef __cplusplus
  
  
  
  1.32      +2 -2      httpd-apreq-2/src/apreq_params.c
  
  Index: apreq_params.c
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/src/apreq_params.c,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- apreq_params.c    15 Jul 2003 13:15:11 -0000      1.31
  +++ apreq_params.c    15 Jul 2003 16:15:50 -0000      1.32
  @@ -66,9 +66,9 @@
   
   static const apreq_cfg_t default_cfg = {
       1024 * 1024, /**< limit on POST data size */
  -    8192 * 2,    /**< limit on brigade size */
  +    1024 * 256,  /**< limit on brigade size */
       200,         /**< maximum number of form fields */
  -    8192 * 8     /**< maximum amount of prefetch data */
  +    1024 * 64    /**< maximum amount of prefetch data */
   };
       
   
  
  
  
  1.33      +15 -9     httpd-apreq-2/src/apreq_parsers.c
  
  Index: apreq_parsers.c
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/src/apreq_parsers.c,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- apreq_parsers.c   15 Jul 2003 13:15:12 -0000      1.32
  +++ apreq_parsers.c   15 Jul 2003 16:15:50 -0000      1.33
  @@ -709,14 +709,12 @@
       return APR_INCOMPLETE;
   }
   
  -
  -
   #define MAX_FILE_BUCKET_LENGTH ( 1 << ( 6 * sizeof(apr_size_t) ) )
   
  -static apr_status_t bb_concat(apr_pool_t *pool, 
  -                              const apreq_cfg_t *cfg,
  -                              apr_bucket_brigade *out, 
  -                              apr_bucket_brigade *in)
  +APREQ_DECLARE(apr_status_t) apreq_brigade_concat(apr_pool_t *pool, 
  +                                                 const apreq_cfg_t *cfg,
  +                                                 apr_bucket_brigade *out, 
  +                                                 apr_bucket_brigade *in)
   {
       apr_bucket *last = APR_BRIGADE_LAST(out);
       apr_status_t s;
  @@ -726,6 +724,9 @@
       apr_off_t wlen;
       int n = 0;
   
  +    if (APR_BUCKET_IS_EOS(last))
  +        return APR_EOF;
  +
       if (! APR_BUCKET_IS_FILE(last)) {
           apr_bucket_brigade *bb;
           apr_file_t *file;
  @@ -767,6 +768,11 @@
       if (s != APR_SUCCESS)
           return s;
       last->length += wlen;
  +    last = APR_BRIGADE_LAST(in);
  +    if (APR_BUCKET_IS_EOS(last)) {
  +        apr_bucket_copy(last, &e);
  +        APR_BRIGADE_INSERT_TAIL(out, e);
  +    }
       return apr_brigade_destroy(in);
   }
   
  @@ -1045,7 +1051,7 @@
                       if (s != APR_INCOMPLETE && s != APR_SUCCESS)
                           return s;
                   }
  -                s = bb_concat(pool, cfg, param->bb, ctx->bb);
  +                s = apreq_brigade_concat(pool, cfg, param->bb, ctx->bb);
                   return (s == APR_SUCCESS) ? APR_INCOMPLETE : s;
   
               case APR_SUCCESS:
  @@ -1059,8 +1065,8 @@
                           return s;
                   }
   
  -                param->v.status = bb_concat(pool, cfg,
  -                                            param->bb, ctx->bb);
  +                param->v.status = apreq_brigade_concat(pool, cfg,
  +                                                       param->bb, ctx->bb);
   
                   if (param->v.status != APR_SUCCESS)
                       return s;
  
  
  
  1.20      +4 -0      httpd-apreq-2/src/apreq_parsers.h
  
  Index: apreq_parsers.h
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/src/apreq_parsers.h,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- apreq_parsers.h   29 Jun 2003 03:41:17 -0000      1.19
  +++ apreq_parsers.h   15 Jul 2003 16:15:50 -0000      1.20
  @@ -117,6 +117,10 @@
       apreq_hook_t           *hook;
       void                   *ctx;
   };
  +APREQ_DECLARE(apr_status_t) apreq_brigade_concat(apr_pool_t *pool, 
  +                                                 const apreq_cfg_t *cfg,
  +                                                 apr_bucket_brigade *out, 
  +                                                 apr_bucket_brigade *in);
   
   
   APREQ_DECLARE_PARSER(apreq_parse_headers);
  
  
  

Reply via email to