You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by do...@apache.org on 2002/10/22 17:13:23 UTC

cvs commit: modperl-2.0/xs/Apache/Access Apache__Access.h

dougm       2002/10/22 08:13:23

  Modified:    .        Changes
               t/modperl .cvsignore
               todo     api.txt
               xs/Apache/Access Apache__Access.h
  Added:       t/response/TestModperl setauth.pm
  Log:
  Submitted by:	gozer
  Reviewed by:	dougm
  default AuthType to Basic if not set in $r->get_basic_auth_pw()
  
  Revision  Changes    Path
  1.58      +3 -0      modperl-2.0/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- Changes	22 Oct 2002 03:56:30 -0000	1.57
  +++ Changes	22 Oct 2002 15:13:22 -0000	1.58
  @@ -10,6 +10,9 @@
   
   =item 1.99_08-dev
   
  +default AuthType to Basic if not set in $r->get_basic_auth_pw()
  +[Philippe M. Chiasson <go...@cpan.org>]
  +
   workaround glibc/Perl-5.8.0 crypt() bug (seen with threaded MPMs)
   
   fix delete $ENV{$key} bug
  
  
  
  1.10      +1 -0      modperl-2.0/t/modperl/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/modperl/.cvsignore,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- .cvsignore	26 May 2002 23:37:17 -0000	1.9
  +++ .cvsignore	22 Oct 2002 15:13:22 -0000	1.10
  @@ -9,3 +9,4 @@
   methodname.t
   methodobj.t
   method.t
  +setauth.t
  
  
  
  1.1                  modperl-2.0/t/response/TestModperl/setauth.pm
  
  Index: setauth.pm
  ===================================================================
  package TestModperl::setauth;
  
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::Access ();
  
  use Apache::Test;
  use Apache::TestUtil;
  
  use Apache::Const -compile => 'OK';
  
  sub handler {
      my $r = shift;
  
      plan $r, tests => 2;
  
      ok t_cmp(undef, $r->auth_type(), 'auth_type');
  
      $r->get_basic_auth_pw();
  
      ok t_cmp('Basic', $r->auth_type(), 'default auth_type');
  
      Apache::OK;
  }
  
  1;
  
  
  
  1.28      +0 -4      modperl-2.0/todo/api.txt
  
  Index: api.txt
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/todo/api.txt,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- api.txt	21 Oct 2002 17:58:40 -0000	1.27
  +++ api.txt	22 Oct 2002 15:13:22 -0000	1.28
  @@ -53,10 +53,6 @@
   with fd's which aren't files and of unknown length, therefore it cannot 
   be used for implementing 1.x compatible send_fd.
   
  -$r->get_basic_auth_pw:
  -does not yet default AuthType and AuthName as 1.x does
  -(should use modperl_config_insert_request to do so)
  -
   $r->as_string:
   not yet implemented
   
  
  
  
  1.6       +30 -25    modperl-2.0/xs/Apache/Access/Apache__Access.h
  
  Index: Apache__Access.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/Apache/Access/Apache__Access.h,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Apache__Access.h	21 Oct 2002 17:58:40 -0000	1.5
  +++ Apache__Access.h	22 Oct 2002 15:13:22 -0000	1.6
  @@ -1,28 +1,3 @@
  -static XS(MPXS_ap_get_basic_auth_pw)
  -{
  -    dXSARGS;
  -    request_rec *r;
  -    const char *sent_pw = NULL;
  -    int rc;
  -
  -    mpxs_usage_items_1("r");
  -
  -    mpxs_PPCODE({
  -        r = mp_xs_sv2_r(ST(0));
  -
  -        rc = ap_get_basic_auth_pw(r, &sent_pw);
  -
  -        EXTEND(SP, 2);
  -        PUSHs_mortal_iv(rc);
  -        if (rc == OK) {
  -            PUSHs_mortal_pv(sent_pw);
  -        }
  -        else {
  -            PUSHs(&PL_sv_undef);
  -        }
  -    });
  -}
  -
   static MP_INLINE SV *mpxs_ap_requires(pTHX_ request_rec *r)
   {
       AV *av;
  @@ -119,4 +94,34 @@
       }
   
       return ap_auth_name(r);
  +}
  +
  +static XS(MPXS_ap_get_basic_auth_pw)
  +{
  +    dXSARGS;
  +    request_rec *r;
  +    const char *sent_pw = NULL;
  +    int rc;
  +
  +    mpxs_usage_items_1("r");
  +
  +    mpxs_PPCODE({
  +        r = mp_xs_sv2_r(ST(0));
  +
  +        /* Default auth-type to Basic */
  +        if (!ap_auth_type(r)) {
  +            mpxs_Apache__RequestRec_auth_type(aTHX_ r, "Basic");
  +        }
  +
  +        rc = ap_get_basic_auth_pw(r, &sent_pw);
  +
  +        EXTEND(SP, 2);
  +        PUSHs_mortal_iv(rc);
  +        if (rc == OK) {
  +            PUSHs_mortal_pv(sent_pw);
  +        }
  +        else {
  +            PUSHs(&PL_sv_undef);
  +        }
  +    });
   }