dougm 2002/10/21 10:58:41
Modified: . Changes
t/response/TestAPI access.pm
todo api.txt
xs/Apache/Access Apache__Access.h
xs/maps apache_functions.map
xs/tables/current/ModPerl FunctionTable.pm
Log:
Submitted by: gozer
Reviewed by: dougm
add support for setting $r->auth_name and $r->auth_type
Revision Changes Path
1.53 +3 -0 modperl-2.0/Changes
Index: Changes
===================================================================
RCS file: /home/cvs/modperl-2.0/Changes,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- Changes 7 Oct 2002 02:44:30 -0000 1.52
+++ Changes 21 Oct 2002 17:58:40 -0000 1.53
@@ -10,6 +10,9 @@
=item 1.99_08-dev
+add support for setting $r->auth_name and $r->auth_type
+[Philippe M. Chiasson <[EMAIL PROTECTED]>]
+
add Apache->httpd_conf compat method
[Philippe M. Chiasson <[EMAIL PROTECTED]>]
1.4 +9 -1 modperl-2.0/t/response/TestAPI/access.pm
Index: access.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/response/TestAPI/access.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- access.pm 11 Apr 2002 11:08:43 -0000 1.3
+++ access.pm 21 Oct 2002 17:58:40 -0000 1.4
@@ -12,7 +12,7 @@
sub handler {
my $r = shift;
- plan $r, tests => 8;
+ plan $r, tests => 10;
$r->allow_methods(1, qw(GET POST));
@@ -28,7 +28,15 @@
ok $r->auth_name eq 'modperl';
+ $r->auth_name('modperl_test');
+ ok $r->auth_name eq 'modperl_test';
+ $r->auth_name('modperl');
+
ok $r->auth_type eq 'none';
+
+ $r->auth_type('Basic');
+ ok $r->auth_type eq 'Basic';
+ $r->auth_type('none');
ok !$r->some_auth_required;
1.27 +0 -3 modperl-2.0/todo/api.txt
Index: api.txt
===================================================================
RCS file: /home/cvs/modperl-2.0/todo/api.txt,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- api.txt 5 Sep 2002 01:52:26 -0000 1.26
+++ api.txt 21 Oct 2002 17:58:40 -0000 1.27
@@ -53,9 +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->auth_{name,type}:
- are not yet writable. need wrappers to call modperl_config_insert_request
-
$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)
1.5 +42 -1 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Apache__Access.h 5 May 2001 02:16:01 -0000 1.4
+++ Apache__Access.h 21 Oct 2002 17:58:40 -0000 1.5
@@ -78,4 +78,45 @@
}
}
-
+static MP_INLINE void mpxs_insert_auth_cfg(pTHX_ request_rec *r,
+ char *directive,
+ char *val)
+{
+ const char *errmsg;
+ AV *config = newAV();
+
+ av_push(config, newSVpvf("%s %s", directive, val));
+
+ errmsg =
+ modperl_config_insert_request(aTHX_ r,
+ newRV_noinc((SV*)config),
+ r->filename, OR_AUTHCFG);
+
+ if (errmsg) {
+ Perl_warn(aTHX_ "Can't change %s to '%s'\n", directive, val);
+ }
+
+ SvREFCNT_dec((SV*)config);
+}
+
+static MP_INLINE
+const char *mpxs_Apache__RequestRec_auth_type(pTHX_ request_rec *r,
+ char *type)
+{
+ if (type) {
+ mpxs_insert_auth_cfg(aTHX_ r, "AuthType", type);
+ }
+
+ return ap_auth_type(r);
+}
+
+static MP_INLINE
+const char *mpxs_Apache__RequestRec_auth_name(pTHX_ request_rec *r,
+ char *name)
+{
+ if (name) {
+ mpxs_insert_auth_cfg(aTHX_ r, "AuthName", name);
+ }
+
+ return ap_auth_name(r);
+}
1.59 +2 -2 modperl-2.0/xs/maps/apache_functions.map
Index: apache_functions.map
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/maps/apache_functions.map,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- apache_functions.map 27 Aug 2002 04:28:38 -0000 1.58
+++ apache_functions.map 21 Oct 2002 17:58:40 -0000 1.59
@@ -136,8 +136,8 @@
ap_satisfies
#MODULE=Apache::Auth
- ap_auth_name
- ap_auth_type
+ mpxs_Apache__RequestRec_auth_name | | r, name=NULL
+ mpxs_Apache__RequestRec_auth_type | | r, type=NULL
ap_get_basic_auth_pw | MPXS_ | r
ap_note_auth_failure
ap_note_basic_auth_failure
1.86 +36 -0 modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm
Index: FunctionTable.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -r1.85 -r1.86
--- FunctionTable.pm 5 Sep 2002 01:49:08 -0000 1.85
+++ FunctionTable.pm 21 Oct 2002 17:58:40 -0000 1.86
@@ -4953,6 +4953,42 @@
},
{
'return_type' => 'const char *',
+ 'name' => 'mpxs_Apache__RequestRec_auth_name',
+ 'args' => [
+ {
+ 'type' => 'PerlInterpreter *',
+ 'name' => 'my_perl'
+ },
+ {
+ 'type' => 'request_rec *',
+ 'name' => 'r'
+ },
+ {
+ 'type' => 'char *',
+ 'name' => 'name'
+ }
+ ]
+ },
+ {
+ 'return_type' => 'const char *',
+ 'name' => 'mpxs_Apache__RequestRec_auth_type',
+ 'args' => [
+ {
+ 'type' => 'PerlInterpreter *',
+ 'name' => 'my_perl'
+ },
+ {
+ 'type' => 'request_rec *',
+ 'name' => 'r'
+ },
+ {
+ 'type' => 'char *',
+ 'name' => 'type'
+ }
+ ]
+ },
+ {
+ 'return_type' => 'const char *',
'name' => 'mpxs_Apache__RequestRec_add_config',
'args' => [
{