joes        2004/07/01 06:20:51

  Modified:    glue/perl/t/apreq request.t
               glue/perl/t/response/TestApReq request.pm
               glue/perl/xsbuilder/Apache/Request Apache__Request.h
  Log:
  Implement DISABLE_UPLOADS
  
  Revision  Changes    Path
  1.11      +7 -1      httpd-apreq-2/glue/perl/t/apreq/request.t
  
  Index: request.t
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/glue/perl/t/apreq/request.t,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- request.t 1 Jul 2004 04:11:24 -0000       1.10
  +++ request.t 1 Jul 2004 13:20:50 -0000       1.11
  @@ -6,7 +6,7 @@
   use Apache::TestUtil;
   use Apache::TestRequest qw(GET_BODY UPLOAD_BODY);
   
  -plan tests => 11, have_lwp;
  +plan tests => 12, have_lwp;
   
   my $location = "/TestApReq__request";
   #print GET_BODY $location;
  @@ -32,3 +32,9 @@
   
       ok t_cmp(length($value), $i, "basic upload length");    
   }
  +
  +{
  +    my $value = 'DataUpload' x 100;
  +    my $result = UPLOAD_BODY("$location?test=disable_uploads", content => 
$value); 
  +    ok t_cmp("ok", $result, "disabled uploads");
  +}
  \ No newline at end of file
  
  
  
  1.15      +7 -0      httpd-apreq-2/glue/perl/t/response/TestApReq/request.pm
  
  Index: request.pm
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/glue/perl/t/response/TestApReq/request.pm,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- request.pm        1 Jul 2004 04:11:24 -0000       1.14
  +++ request.pm        1 Jul 2004 13:20:50 -0000       1.15
  @@ -59,6 +59,13 @@
               $req->print($data);
           }
       }
  +    elsif ($test eq 'disable_uploads') {
  +        $req->config(DISABLE_UPLOADS => 1);
  +        eval {my $upload = $req->upload('HTTPUPLOAD')};
  +        if (ref $@ eq "Apache::Request::Error") {
  +            $req->print("ok");
  +        }
  +    }
   
       return 0;
   }
  
  
  
  1.32      +7 -1      
httpd-apreq-2/glue/perl/xsbuilder/Apache/Request/Apache__Request.h
  
  Index: Apache__Request.h
  ===================================================================
  RCS file: 
/home/cvs/httpd-apreq-2/glue/perl/xsbuilder/Apache/Request/Apache__Request.h,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- Apache__Request.h 1 Jul 2004 04:11:24 -0000       1.31
  +++ Apache__Request.h 1 Jul 2004 13:20:51 -0000       1.32
  @@ -165,7 +165,13 @@
               apreq_env_max_brigade(req->env, (apr_ssize_t)apreq_atoi64f(val));
           }
           else if (strcasecmp(attr, "DISABLE_UPLOADS") == 0) {
  -            ;
  +            if (req->parser == NULL)
  +                req->parser = apreq_parser(req->env, NULL);
  +            if (req->parser != NULL)
  +                apreq_add_hook(req->parser,
  +                               apreq_make_hook(apreq_env_pool(req->env), 
  +                                               apreq_hook_disable_uploads,
  +                                               NULL, NULL));
           }
           else if (strcasecmp(attr, "UPLOAD_HOOK") == 0) {
               ;
  
  
  

Reply via email to