Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

[patch] $r->finfo: msg#00028

apache.mod-perl.devel

Subject: [patch] $r->finfo

Currently there is no way to convert from apr_finfo_t to struct finfo.

But, at least, here is a finfo patch that works.

Drawbacks for now is that it will resort to a stat() call each time
used, and can't be assigned to like you used to be able to do in 1.x
land (was this feature used at all?)

$Id: finfo.patch,v 1.2 2003/02/11 08:25:09 gozer Exp $

Index: STATUS
===================================================================
RCS file: /home/cvspublic/modperl-2.0/STATUS,v
retrieving revision 1.33
diff -u -I'$Id' -I'$Revision' -r1.33 STATUS
--- STATUS 15 Jan 2003 05:22:53 -0000 1.33
+++ STATUS 11 Feb 2003 08:13:18 -0000
@@ -165,6 +165,12 @@

----

+* r->finfo not backwards compatible
+ need apr_finfo_t <-> struct stat conversion which isn't there
+
+ Status: Posibly add this to APR
+
+----
*
Report:
Status:

Index: t/response/TestAPI/request_rec.pm
===================================================================
RCS file: /home/cvspublic/modperl-2.0/t/response/TestAPI/request_rec.pm,v
retrieving revision 1.15
diff -u -I'$Id' -I'$Revision' -r1.15 request_rec.pm
--- t/response/TestAPI/request_rec.pm 11 Apr 2002 11:08:43 -0000 1.15
+++ t/response/TestAPI/request_rec.pm 11 Feb 2003 08:13:20 -0000
@@ -11,6 +11,9 @@

use Apache::Const -compile => 'OK';

+use File::stat ();
+use File::Spec qw(catfile);
+
#this test module is only for testing fields in the request_rec
#listed in apache_structures.map
#XXX: GloabalRequest test should be moved elsewhere
@@ -19,7 +22,7 @@
sub handler {
my $r = shift;

- plan $r, tests => 41;
+ plan $r, tests => 44;

#Apache->request($r); #PerlOptions +GlobalRequest takes care
my $gr = Apache->request;
@@ -128,7 +131,21 @@

ok $r->args || 1;

- #finfo
+ {
+ my $file =
File::Spec->catfile(Apache::Test::config()->{vars}->{documentroot} ,
'index.html');
+ $r->filename($file);
+
+ my $finfo = $r->finfo;
+
+ ok t_cmp ( \*_ , $finfo, 'finfo');
+
+ ok t_cmp ( [@{File::stat::stat($r->filename)}],
[@{File::stat::stat($finfo)}], 'finfo');
+
+ eval { $r->finfo(File::stat::stat($r->filename)) };
+
+ ok ( $@ =~ /readonly/ );
+ }
+
#parsed_uri

#per_dir_config

Index: todo/api.txt
===================================================================
RCS file: /home/cvspublic/modperl-2.0/todo/api.txt,v
retrieving revision 1.31
diff -u -I'$Id' -I'$Revision' -r1.31 api.txt
--- todo/api.txt 22 Jan 2003 06:12:43 -0000 1.31
+++ todo/api.txt 11 Feb 2003 08:13:22 -0000
@@ -7,10 +7,6 @@
-READLINE - proper implementation (see comment in Apache::compat)
need to attempt to fix that interface so it'll work with IPC::Open* family

-$r->finfo:
-need apr_finfo_t <-> struct stat conversion (might already be there,
-haven't looked close enough yet)
-
$r->chdir_file:
not safe for threaded environments. should at least unshift @INC with
dirname $r->filename. consider overriding open() to resolve relative

Index: xs/Apache/RequestUtil/Apache__RequestUtil.h
===================================================================
RCS file:
/home/cvspublic/modperl-2.0/xs/Apache/RequestUtil/Apache__RequestUtil.h,v
retrieving revision 1.17
diff -u -I'$Id' -I'$Revision' -r1.17 Apache__RequestUtil.h
--- xs/Apache/RequestUtil/Apache__RequestUtil.h 31 Jan 2003 04:20:20 -0000
1.17
+++ xs/Apache/RequestUtil/Apache__RequestUtil.h 11 Feb 2003 08:13:24 -0000
@@ -245,3 +245,24 @@
return svh.sv;
}

+static MP_INLINE
+SV *mpxs_Apache__RequestRec_finfo(pTHX_ request_rec *r, SV *statbuf)
+{
+ if (statbuf) {
+ Perl_die(aTHX_ "r->finfo is readonly!");
+ return Nullsv;
+ }
+
+ /* This is will cause an extraneous stat() call, since there is no
+ * conversion path from apr_finfo_t -> struct stat * */
+
+ PL_laststatval = 0;
+ sv_setpv(PL_statname, r->filename);
+
+ if (GIMME_V != G_VOID) {
+ return newRV_noinc((SV*)gv_fetchpv("_", TRUE, SVt_PVIO));
+ }
+ else {
+ return Nullsv;
+ }
+}

Index: xs/maps/modperl_functions.map
===================================================================
RCS file: /home/cvspublic/modperl-2.0/xs/maps/modperl_functions.map,v
retrieving revision 1.52
diff -u -I'$Id' -I'$Revision' -r1.52 modperl_functions.map
--- xs/maps/modperl_functions.map 29 Jan 2003 03:56:00 -0000 1.52
+++ xs/maps/modperl_functions.map 11 Feb 2003 08:13:26 -0000
@@ -19,6 +19,7 @@
mpxs_Apache__RequestRec_get_handlers
mpxs_Apache__RequestRec_location
mpxs_Apache__RequestRec_as_string
+ mpxs_Apache__RequestRec_finfo | | r, statbuf=Nullsv
mpxs_Apache__RequestRec_pnotes | | r, key=Nullsv, val=Nullsv
modperl_config_insert_request | | \
r, lines, path=r->filename, override=OR_AUTHCFG | add_config


--------------------------------------------------------------------------------
Philippe M. Chiasson /gozer\@(cpan|ectoplasm)\.org/ 88C3A5A5
(122FF51B/C634E37B)
http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107
88C3 A5A5
Q: It is impossible to make anything foolproof because fools are so
ingenious.
perl
-e'$$=\${gozer};{$_=unpack(P7,pack(L,$$));/^JAm_pH\n$/&&print||$$++&&redo}'

Attachment: signature.asc
Description: This is a digitally signed message part

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
user-groups.jax...    php.zend.framew...    os.solaris.open...    web.quixote.use...    java.openjdk.ho...    ietf.secmech/20...    gnu.glpk/2004-0...    recreation.cars...    network.smokepi...    linux.drivers.i...    cms.opencms.dev...    fonts.gfontview...    text.xml.soap.u...    voip.nist-sip/2...    debian.ports.hp...    xfree86.interna...    science.biology...    qnx.openqnx.dev...    mail.sylpheed.c...    busybox/bios/20...    emulators.kvm.s...    hardware.openco...    apple.fink.begi...    kde.german/2006...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation