You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Stas Bekman <st...@stason.org> on 2001/10/22 17:30:28 UTC

[patch] r->location implementation

Index: src/modules/perl/modperl_config.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_config.c,v
retrieving revision 1.43
diff -u -r1.43 modperl_config.c
--- src/modules/perl/modperl_config.c	2001/09/28 20:08:34	1.43
+++ src/modules/perl/modperl_config.c	2001/10/22 15:19:25
@@ -4,6 +4,8 @@
 {
     modperl_config_dir_t *dcfg = modperl_config_dir_new(p);

+    dcfg->location = apr_pstrdup(p, dir);
+
 #ifdef USE_ITHREADS
     /* defaults to per-server scope */
     dcfg->interp_scope = MP_INTERP_SCOPE_UNDEF;
@@ -60,6 +62,8 @@

     mrg->flags = modperl_options_merge(p, base->flags, add->flags);

+    merge_item(location);
+
     merge_table_overlap_item(SetVar);

     /* XXX: check if Perl*Handler is disabled */
Index: t/response/TestAPI/request_rec.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/response/TestAPI/request_rec.pm,v
retrieving revision 1.8
diff -u -r1.8 request_rec.pm
--- t/response/TestAPI/request_rec.pm	2001/09/28 20:11:02	1.8
+++ t/response/TestAPI/request_rec.pm	2001/10/22 15:19:27
@@ -11,7 +11,7 @@
 sub handler {
     my $r = shift;

-    plan $r, tests => 48;
+    plan $r, tests => 49;

     #Apache->request($r); #PerlOptions +GlobalRequest takes care
     my $gr = Apache->request;
@@ -181,6 +181,10 @@
     ok $r->uri;

     ok $r->filename;
+
+    ok t_cmp('/' . __PACKAGE__,
+             $r->location,
+             "location");

     my $mtime = (stat __FILE__)[9];
     $r->mtime($mtime);
Index: todo/api.txt
===================================================================
RCS file: /home/cvs/modperl-2.0/todo/api.txt,v
retrieving revision 1.11
diff -u -r1.11 api.txt
--- todo/api.txt	2001/10/09 00:14:10	1.11
+++ todo/api.txt	2001/10/22 15:19:27
@@ -85,9 +85,6 @@
 Apache->httpd_conf:
 depends on <Perl> sections

-$r->location:
-not yet implemented
-
 Apache->request:
 need to deal with subclass objects which are not a request_rec
 (e.g. HASH ref)
Index: xs/Apache/RequestUtil/Apache__RequestUtil.h
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/Apache/RequestUtil/Apache__RequestUtil.h,v
retrieving revision 1.7
diff -u -r1.7 Apache__RequestUtil.h
--- xs/Apache/RequestUtil/Apache__RequestUtil.h	2001/09/28 20:11:02	1.7
+++ xs/Apache/RequestUtil/Apache__RequestUtil.h	2001/10/22 15:19:28
@@ -179,3 +179,18 @@

 #define mpxs_Apache__RequestRec_dir_config(r, key, sv_val) \
     modperl_dir_config(aTHX_ r, r->server, key, sv_val)
+
+static MP_INLINE
+SV *mpxs_Apache__RequestRec_location(request_rec *r)
+{
+    dTHX; /* XXX */
+    if(r->per_dir_config) {
+        MP_dDCFG;
+        char *location;
+        if ((location = dcfg->location)) {
+            return newSVpv(location, 0);
+        }
+    }
+
+    return &PL_sv_undef;
+}
Index: xs/maps/modperl_functions.map
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/maps/modperl_functions.map,v
retrieving revision 1.24
diff -u -r1.24 modperl_functions.map
--- xs/maps/modperl_functions.map	2001/10/09 18:01:21	1.24
+++ xs/maps/modperl_functions.map	2001/10/22 15:19:29
@@ -12,6 +12,7 @@
  mpxs_Apache__RequestRec_push_handlers
  mpxs_Apache__RequestRec_set_handlers
  mpxs_Apache__RequestRec_get_handlers
+ mpxs_Apache__RequestRec_location

  #protocol module helpers
  mpxs_Apache__RequestRec_location_merge



_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:stas@stason.org  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: [patch] r->location implementation

Posted by Doug MacEachern <do...@covalent.net>.
On Mon, 22 Oct 2001, Stas Bekman wrote:
 
> +    dcfg->location = apr_pstrdup(p, dir);

+1 with the
       dcfg->location = dir;

change.

and 2 style nits, always put an empty newline after variable declarations
and change if( to if (

> +static MP_INLINE
> +SV *mpxs_Apache__RequestRec_location(request_rec *r)
> +{
> +    dTHX; /* XXX */
  +
> +    if(r->per_dir_config) {
         ^
> +        MP_dDCFG;
> +        char *location;
  +
> +        if ((location = dcfg->location)) {
> +            return newSVpv(location, 0);
> +        }
> +    }


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org