httpd-apreq-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject cvs commit: httpd-apreq-2/env/t request.t
Date Wed, 01 Oct 2003 20:00:36 GMT
joes        2003/10/01 13:00:36

  Modified:    env      mod_apreq.c
               env/c-modules/apreq_access_test mod_apreq_access_test.c
               env/c-modules/apreq_redirect_test mod_apreq_redirect_test.c
               env/t    request.t
  Log:
  Commit more tests (and iron out a few kinks in mod_apreq.c) which mix redirects with prefetch
logic.
  
  Revision  Changes    Path
  1.28      +7 -5      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.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- mod_apreq.c	1 Oct 2003 16:47:31 -0000	1.27
  +++ mod_apreq.c	1 Oct 2003 20:00:36 -0000	1.28
  @@ -212,7 +212,7 @@
           apreq_request_t *old = c->req;
           c->req = req;
           apreq_log(APREQ_DEBUG 0, r, 
  -                  "apreq request is now initialized" );
  +                  "apreq request is now initialized (%d)", req);
           return old;
       }
   
  @@ -307,11 +307,13 @@
                * 
                */
   
  -            apreq_log(APREQ_DEBUG 0, r, "dropping stale apreq filter");
  +            apreq_log(APREQ_DEBUG 0, r, "dropping stale apreq filter (%d)", f);
               req->parser = NULL;
               req->body = NULL;
  -            ctx->status = APR_SUCCESS;
  -            cfg->f = NULL;
  +            if (cfg->f == f) {
  +                ctx->status = APR_SUCCESS;
  +                cfg->f = NULL;
  +            }
           }
           else {
               /* No data was parsed/prefetched, so it's safe to move the filter
  @@ -328,7 +330,7 @@
           ctx->spool  = apr_brigade_create(r->pool, alloc);
           ctx->status = APR_INCOMPLETE;
           apreq_log(APREQ_DEBUG 0, r, 
  -                  "apreq filter is initialized" );
  +                  "apreq filter is initialized (%d)", f);
       }
   
       return APR_SUCCESS;
  
  
  
  1.4       +5 -1      httpd-apreq-2/env/c-modules/apreq_access_test/mod_apreq_access_test.c
  
  Index: mod_apreq_access_test.c
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/env/c-modules/apreq_access_test/mod_apreq_access_test.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- mod_apreq_access_test.c	18 Sep 2003 18:04:49 -0000	1.3
  +++ mod_apreq_access_test.c	1 Oct 2003 20:00:36 -0000	1.4
  @@ -102,14 +102,18 @@
   static int apreq_access_checker(request_rec *r)
   {
       apreq_request_t *req = apreq_request(r, NULL);
  +    apreq_param_t *param;
       struct access_test_cfg *cfg = (struct access_test_cfg *)
           ap_get_module_config(r->per_dir_config, &apreq_access_test_module);
   
       if (!cfg || !cfg->param)
           return DECLINED;
   
  -    if (apreq_param(req, cfg->param))
  +    param = apreq_param(req, cfg->param);
  +    if (param) {
  +        apreq_log(APREQ_DEBUG 0, r, "%s => %s", cfg->param, param->v.data);
           return OK;
  +    }
       else {
           if (req->body)
               apreq_log(APREQ_DEBUG HTTP_FORBIDDEN, r, "%s not found in %d elts",
  
  
  
  1.2       +3 -12     httpd-apreq-2/env/c-modules/apreq_redirect_test/mod_apreq_redirect_test.c
  
  Index: mod_apreq_redirect_test.c
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/env/c-modules/apreq_redirect_test/mod_apreq_redirect_test.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- mod_apreq_redirect_test.c	1 Oct 2003 16:47:31 -0000	1.1
  +++ mod_apreq_redirect_test.c	1 Oct 2003 20:00:36 -0000	1.2
  @@ -55,7 +55,7 @@
   #if CONFIG_FOR_HTTPD_TEST
   
   <Location /apreq_redirect_test>
  -   TestAccess location
  +   TestAccess test
      SetHandler apreq_redirect_test
   </Location>
   
  @@ -68,29 +68,20 @@
   #include "apreq_env.h"
   #include "httpd.h"
   
  -static int dump_table(void *ctx, const char *key, const char *value)
  -{
  -    request_rec *r = ctx;
  -    apreq_log(APREQ_DEBUG 0, r, "%s => %s", key, value);
  -    ap_rprintf(r, "\t%s => %s\n", key, value);
  -    return 1;
  -}
  -
   static int apreq_redirect_test_handler(request_rec *r)
   {
  -    apr_bucket_brigade *bb;
       apreq_request_t *req;
       const apreq_param_t *loc;
  -    apr_status_t s;
  -    int saw_eos = 0;
   
       if (strcmp(r->handler, "apreq_redirect_test") != 0)
           return DECLINED;
   
       req = apreq_request(r, NULL);
  +    apreq_log(APREQ_DEBUG 0, r, "looking for new location");
       loc = apreq_param(req, "location");
       if (!loc)
           return DECLINED;
  +    apreq_log(APREQ_DEBUG 0,r, "redirecting to %s", loc->v.data);
       ap_internal_redirect(loc->v.data, r);
       return OK;
   }
  
  
  
  1.6       +21 -5     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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- request.t	1 Oct 2003 16:47:31 -0000	1.5
  +++ request.t	1 Oct 2003 20:00:36 -0000	1.6
  @@ -5,7 +5,7 @@
   use Apache::TestUtil;
   use Apache::TestRequest qw(GET_BODY UPLOAD_BODY POST_BODY GET_RC);
   
  -plan tests => 8;
  +plan tests => 11;
   
   foreach my $location ('/apreq_request_test', '/apreq_access_test') {
   
  @@ -19,7 +19,7 @@
   
   ok t_cmp(403, GET_RC("/apreq_access_test"), "access denied");
   
  -my $filler = "0123456789" x 7000; # < 8000 + 64K
  +my $filler = "0123456789" x 6400; # < 64K
   my $body = POST_BODY("/apreq_access_test?foo=1;", 
                        content => "bar=2&quux=$filler;test=6&more=$filler");
   ok t_cmp(<<EOT, $body, "prefetch credentials");
  @@ -32,6 +32,22 @@
   \tmore => $filler
   EOT
   
  -ok t_cmp(403, GET_RC("/apreq_redirect_test"), "missing redirect location");
  -ok t_cmp("ARGS:\n\ttest => 8\n", 
  -        GET_BODY("/apreq_redirect_test?location=/apreq_request_test%3Ftest=8"), "redirect");
  +ok t_cmp(403, GET_RC("/apreq_redirect_test"), "missing 'test' authorization");
  +
  +foreach my $location ('/apreq_request_test', '/apreq_access_test') {
  +    ok t_cmp("ARGS:\n\ttest => redirect\n", 
  +            GET_BODY("/apreq_redirect_test?test=ok&location=$location%3Ftest=redirect"),

  +            "redirect GET");
  +
  +    $body = POST_BODY("/apreq_redirect_test?location=$location%3Ffoo=bar", content =>

  +            "quux=$filler;test=redirect+with+prefetch;more=$filler");
  +
  +    ok t_cmp(<<EOT, $body, "redirect with prefetch");
  +ARGS:
  +\tfoo => bar
  +BODY:
  +\tquux => $filler
  +\ttest => redirect with prefetch
  +\tmore => $filler
  +EOT
  +}
  
  
  

Mime
View raw message