dougm 01/05/01 10:28:43
Modified: . Changes ToDo
Apache Apache.pm
src/modules/perl Apache.xs
t/net/perl api.pl
Log:
add $r->allowed method
Revision Changes Path
1.591 +2 -0 modperl/Changes
Index: Changes
===================================================================
RCS file: /home/cvs/modperl/Changes,v
retrieving revision 1.590
retrieving revision 1.591
diff -u -r1.590 -r1.591
--- Changes 2001/05/01 17:08:25 1.590
+++ Changes 2001/05/01 17:28:28 1.591
@@ -10,6 +10,8 @@
=item 1.25_01-dev
+add $r->allowed method [Philippe Troin <[EMAIL PROTECTED]>]
+
fix 'make offsite-tar' [Geoffrey Young <[EMAIL PROTECTED]>]
win32 fixes [Randy Kobes <[EMAIL PROTECTED]>]
1.281 +0 -3 modperl/ToDo
Index: ToDo
===================================================================
RCS file: /home/cvs/modperl/ToDo,v
retrieving revision 1.280
retrieving revision 1.281
diff -u -r1.280 -r1.281
--- ToDo 2001/04/27 17:01:54 1.280
+++ ToDo 2001/05/01 17:28:29 1.281
@@ -7,9 +7,6 @@
- PERL5LIB foo
-- From: Daniel Jacobowitz <[EMAIL PROTECTED]>
- Subject: New method $req->allowed() for libapache-mod-perl
-
- From: Dave Rolsky <[EMAIL PROTECTED]>
Subject: Apache::test patch
1.64 +12 -0 modperl/Apache/Apache.pm
Index: Apache.pm
===================================================================
RCS file: /home/cvs/modperl/Apache/Apache.pm,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -r1.63 -r1.64
--- Apache.pm 2001/04/26 05:30:45 1.63
+++ Apache.pm 2001/05/01 17:28:34 1.64
@@ -272,6 +272,18 @@
Returns true if the current request is the first internal request,
returns false if the request is a sub-request or internal redirect.
+=item $r->allowed($bitmask)
+
+Get or set the allowed methods bitmask. This allowed bitmask should be
+set whenever a 405 (method not allowed) or 501 (method not implemented)
+answer is returned. The bit corresponding to the method number should be
+et.
+
+ unless ($r->method_number == M_GET) {
+ $r->allowed($r->allowed | (1<<M_GET) | (1<<M_HEAD) | (1<<M_OPTIONS));
+ return HTTP_METHOD_NOT_ALLOWED;
+ }
+
=back
=head1 SUB REQUESTS
1.121 +10 -0 modperl/src/modules/perl/Apache.xs
Index: Apache.xs
===================================================================
RCS file: /home/cvs/modperl/src/modules/perl/Apache.xs,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -r1.120 -r1.121
--- Apache.xs 2001/04/17 21:57:20 1.120
+++ Apache.xs 2001/05/01 17:28:37 1.121
@@ -1510,6 +1510,16 @@
OUTPUT:
RETVAL
+int
+allowed(r, ...)
+ Apache r
+
+ CODE:
+ get_set_IV(r->allowed);
+
+ OUTPUT:
+ RETVAL
+
time_t
request_time(r)
Apache r
1.45 +8 -2 modperl/t/net/perl/api.pl
Index: api.pl
===================================================================
RCS file: /home/cvs/modperl/t/net/perl/api.pl,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- api.pl 2001/01/26 18:37:46 1.44
+++ api.pl 2001/05/01 17:28:41 1.45
@@ -1,5 +1,5 @@
use Apache ();
-use Apache::Constants qw(:server :common);
+use Apache::Constants qw(:server :common :methods);
use Apache::test;
use strict;
@@ -16,7 +16,7 @@
my $is_xs = ($r->uri =~ /_xs/);
-my $tests = 71;
+my $tests = 74;
my $is_win32 = WIN32;
$tests += 2 unless $is_win32;
my $test_get_set = Apache->can('set_handlers') && ($tests += 4);
@@ -156,6 +156,12 @@
#just make sure we can actually call these
test ++$i, $r->satisfies || 1;
test ++$i, $r->some_auth_required || 1;
+
+$r->allowed(1 << M_GET);
+test ++$i, $r->allowed & (1 << M_GET);
+test ++$i, ! ($r->allowed & (1 << M_PUT));
+$r->allowed($r->allowed | (1 << M_PUT));
+test ++$i, $r->allowed & (1 << M_PUT);
#dir_config