dougm 00/04/02 22:41:30
Modified: . Changes
src/modules/perl Apache.xs
t/net/perl api.pl
Log:
$r->document_root can now be modified
Revision Changes Path
1.458 +2 -0 modperl/Changes
Index: Changes
===================================================================
RCS file: /home/cvs/modperl/Changes,v
retrieving revision 1.457
retrieving revision 1.458
diff -u -r1.457 -r1.458
--- Changes 2000/04/03 04:48:51 1.457
+++ Changes 2000/04/03 05:41:29 1.458
@@ -10,6 +10,8 @@
=item 1.22_01-dev
+$r->document_root can now be modified
+
upgrade license to apache software license version 1.1
$r->the_request can now be modified
1.93 +19 -1 modperl/src/modules/perl/Apache.xs
Index: Apache.xs
===================================================================
RCS file: /home/cvs/modperl/src/modules/perl/Apache.xs,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -r1.92 -r1.93
--- Apache.xs 2000/04/03 04:48:52 1.92
+++ Apache.xs 2000/04/03 05:41:29 1.93
@@ -783,8 +783,26 @@
Apache r
const char *
-document_root(r)
+document_root(r, ...)
Apache r
+
+ PREINIT:
+ core_server_config *conf;
+
+ CODE:
+ conf = (core_server_config *)
+ get_module_config(r->server->module_config, &core_module);
+
+ RETVAL = conf->ap_document_root;
+
+ if (items > 1) {
+ SV *doc_root = perl_get_sv("Apache::Server::DocumentRoot", TRUE);
+ sv_setsv(doc_root, ST(1));
+ conf->ap_document_root = SvPVX(doc_root);
+ }
+
+ OUTPUT:
+ RETVAL
char *
server_root_relative(rsv, name="")
1.41 +7 -1 modperl/t/net/perl/api.pl
Index: api.pl
===================================================================
RCS file: /home/cvs/modperl/t/net/perl/api.pl,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- api.pl 2000/04/03 04:38:07 1.40
+++ api.pl 2000/04/03 05:41:29 1.41
@@ -16,7 +16,7 @@
my $is_xs = ($r->uri =~ /_xs/);
-my $tests = 66;
+my $tests = 68;
my $is_win32 = WIN32;
$tests += 2 unless $is_win32;
my $test_get_set = Apache->can('set_handlers') && ($tests += 4);
@@ -74,6 +74,12 @@
$r->the_request(join ' ', map { $r->$_ } qw(method uri protocol));
test ++$i, $the_request eq $r->the_request;
printf "old=$the_request, new=%s\n", $r->the_request;
+
+my $doc_root = $r->document_root;
+$r->document_root('/tmp');
+test ++$i, $r->document_root eq '/tmp';
+$r->document_root($doc_root);
+test ++$i, $r->document_root eq $doc_root;
my $loc = $r->location;
print "<Location $loc>\n";