geoff       2003/02/19 06:14:36

  Modified:    .        Changes
               lib/Apache compat.pm
               t/response/TestCompat conn_authen.pm
  Log:
  fixes to Apache::compat. make $r->connection->auth_type interface
  with r->ap_auth_type. make both $r->connection->auth_type and
  $r->connection->user writable
  Submitted by: geoff
  Reviewed by:  stas
  
  Revision  Changes    Path
  1.129     +4 -0      modperl-2.0/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.128
  retrieving revision 1.129
  diff -u -r1.128 -r1.129
  --- Changes   19 Feb 2003 14:12:01 -0000      1.128
  +++ Changes   19 Feb 2003 14:14:35 -0000      1.129
  @@ -10,6 +10,10 @@
   
   =item 1.99_09-dev
   
  +fixes to Apache::compat. make $r->connection->auth_type interface
  +with r->ap_auth_type. make both $r->connection->auth_type and
  +$r->connection->user writable. [Geoffrey Young]
  +
   Open up r->ap_auth_type, making it possible to write custom
   authen handlers that don't rely on Basic authentication or
   it's associated ap_* functions.
  
  
  
  1.80      +2 -2      modperl-2.0/lib/Apache/compat.pm
  
  Index: compat.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/lib/Apache/compat.pm,v
  retrieving revision 1.79
  retrieving revision 1.80
  diff -u -r1.79 -r1.80
  --- compat.pm 17 Feb 2003 09:47:31 -0000      1.79
  +++ compat.pm 19 Feb 2003 14:14:36 -0000      1.80
  @@ -538,8 +538,8 @@
   
   # auth_type and user records don't exist in 2.0 conn_rec struct
   # 'PerlOptions +GlobalRequest' is required
  -sub auth_type { Apache->request->auth_type }
  -sub user      { Apache->request->user      }
  +sub auth_type { shift; Apache->request->ap_auth_type(@_) }
  +sub user      { shift; Apache->request->user(@_)      }
   
   1;
   __END__
  
  
  
  1.2       +33 -5     modperl-2.0/t/response/TestCompat/conn_authen.pm
  
  Index: conn_authen.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/response/TestCompat/conn_authen.pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- conn_authen.pm    12 Feb 2003 23:42:23 -0000      1.1
  +++ conn_authen.pm    19 Feb 2003 14:14:36 -0000      1.2
  @@ -1,6 +1,6 @@
   package TestCompat::conn_authen;
   
  -# simply check that we can retrieve:
  +# compat checks for
   #   $r->connection->auth_type
   #   $r->connection->user
   # both records don't exist in 2.0 conn_rec and therefore require
  @@ -16,19 +16,47 @@
   use Apache::Constants qw(OK REMOTE_HOST);
   
   sub handler {
  +
       my $r = shift;
   
  +    my $req_auth_type = $r->connection->auth_type || '';
  +
  +    die "request auth_type is '$req_auth_type', should be empty"
  +        if $req_auth_type;
  +
  +    # get_basic_auth_pw populates $r->user and $r->ap_auth_type
       my($rc, $sent_pw) = $r->get_basic_auth_pw;
   
       return $rc if $rc != Apache::OK;
   
  -    my $auth_type = $r->connection->auth_type || '';
  -    die "auth_type is '$auth_type', should be 'Basic'" 
  -        unless $auth_type eq 'Basic';
  +    $req_auth_type = $r->connection->auth_type || '';
  +
  +    die "request auth_type is '$req_auth_type', should be 'Basic'"
  +        unless $req_auth_type eq 'Basic';
  +
  +    my $config_auth_type = $r->auth_type || '';
  +
  +    die "httpd.conf auth_type is '$config_auth_type', should be 'Basic'"
  +        unless $config_auth_type eq 'Basic';
   
       my $user = $r->connection->user || '';
  -    die "user is '$user', while expecting 'dougm'"
  +
  +    die "user is '$user', should be 'dougm'"
           unless $user eq 'dougm';
  +
  +    # make sure we can set both
  +    $r->connection->auth_type('sailboat');
  +    $r->connection->user('geoff');
  +
  +    $user = $r->connection->user || '';
  +
  +    die "user is '$user', should be 'geoff'"
  +        unless $user eq 'geoff';
  +
  +    $req_auth_type = $r->connection->auth_type || '';
  +
  +    die "request auth_type is '$req_auth_type', should be 'sailboat'"
  +        unless $req_auth_type eq 'sailboat';
   
       OK;
   }
  
  
  


Reply via email to