Re: Masquerading requests as HTTPS

2005-09-15 Thread Damyan Ivanov
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Mark Moseley wrote:
> Howdy. Actually, I don't need any actual SSL functionality. All I need
> to do is to trick everything from the transhandler phase downwards that
> the URL's scheme is 'https' so that redirects have https://, not
> http://, since anyone doing a mod_rewrite or scripted redirect whilst in
> SSL would get shunted back to HTTP otherwise -- and no doubt harass our
> customer support ;)

Wouldn't it be better to parse responses on BigIPs and replace 'http'
with 'https' if redirect is detected? I have no idea how to do this, though.


dam
- --
Damyan Ivanov  0x9725F63B  Creditreform Bulgaria
[EMAIL PROTECTED]  http://www.creditreform.bg/
phone: +359(2)928-2611, 929-3993fax: +359(2)920-0994
mob. +359(88)856-6067  ICQ 3028500  [EMAIL PROTECTED]/Gaim
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDKmO+Hqjlqpcl9jsRAjJsAJ9NTs21NvhER2ysYwsC4AXBrceaNACeIF5i
VnpHbJULu9LL5VSkR/dDmbg=
=AGvm
-END PGP SIGNATURE-


Re: Masquerading requests as HTTPS

2005-09-15 Thread Mark Moseley
Howdy. Actually, I don't need any actual SSL functionality. All I need
to do is to trick everything from the transhandler phase downwards that
the URL's scheme is 'https' so that redirects have https://, not
http://, since anyone doing a mod_rewrite or scripted redirect whilst
in SSL would get shunted back to HTTP otherwise -- and no doubt harass
our customer support ;)

So nothing fancy and encrypted, since I'm doing the SSL offloading on
the BigIP (which is sweet). I want to keep the session between the
bigIP and the backend server in regular HTTP.


RE: Masquerading requests as HTTPS

2005-09-15 Thread Badai Aqrandista

Hi Mark,

From my limited knowledge, SSL handshake is processed prior doing the HTTP 
request-response. Therefore, when apache or mod_perl accepts HTTPS requests, 
it can't redirect it over HTTPS unless you create another HTTPS request with 
LWP or WWW::Mechanize, for example.


But if you want to connect to a backend server, why do you need a secure 
connection anyway?


However, other probably know better...

---
Badai Aqrandista
Cheepy (?)


From: Mark Moseley <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: modperl@perl.apache.org
Subject: Masquerading requests as HTTPS
Date: Thu, 15 Sep 2005 17:05:34 -0700

Greetings. I've been scouring the list and the net for a solution for this
but my apologies in advance if I didn't get the search terms right and
missed a RTFM answer.

I work for a web hosting company and we recently purchased a pair of 
BigIPs.

These have the ability to terminate SSL connections and then send regular
HTTP to the backend servers (running Apache 1.3.29/mod_perl 1.29 and making
heavy use of transhandlers).

My question for the list is this:
Is there any mod_perl-ish to pretend that a request is coming through SSL?
The main issue I'm facing is that I've got a couple hundred thousands 
users,
many using mod_rewrite in .htaccess files (and a potentially very very 
large

number and out of my control so modifying them is not an option). Since the
BigIP is retransmitting the request as HTTP, the scheme that the backend
server is using is 'http', not 'https'. So if a redirect is generated via
mod_rewrite, it's redirecting to http://the/url/etc, not 
https://the/url/etc.
Presumably people doing redirects via PHP would have the same issue. 
However

the URL scheme looks to be somewhat inaccessible from $r and if I parse it
with Apache::URI and use the scheme method there, I don't know of a $r
method to set the URI to the modified URI object.

I've tried setting $ENV{ HTTPS } to 'on', but that didn't help.

Anybody know of a method I might be missing that would help me out?
Basically what I'm trying to accomplish is if I see a request coming in on
port 443, I want to set $r->method( "https" ) -- and I know there's no
method called this, but for explanation sake ;)

Thanks!


_
Sell your car for $9 on carpoint.com.au   
http://www.carpoint.com.au/sellyourcar




Masquerading requests as HTTPS

2005-09-15 Thread Mark Moseley
Greetings. I've been scouring the list and the net for a solution for
this but my apologies in advance if I didn't get the search terms right
and missed a RTFM answer.

I work for a web hosting company and we recently purchased a pair of
BigIPs. These have the ability to terminate SSL connections and then
send regular HTTP to the backend servers (running Apache
1.3.29/mod_perl 1.29 and making heavy use of transhandlers).

My question for the list is this:
Is there any mod_perl-ish to pretend that a request is coming through
SSL? The main issue I'm facing is that I've got a couple hundred
thousands users, many using mod_rewrite in .htaccess files (and a
potentially very very large number and out of my control so modifying
them is not an option). Since the BigIP is retransmitting the request
as HTTP, the scheme that the backend server is using is 'http', not
'https'. So if a redirect is generated via mod_rewrite, it's
redirecting to http://the/url/etc, not https://the/url/etc. Presumably
people doing redirects via PHP would have the same issue. However the
URL scheme looks to be somewhat inaccessible from $r and if I parse it
with Apache::URI and use the scheme method there, I don't know of a $r
method to set the URI to the modified URI object.

I've tried setting $ENV{ HTTPS } to 'on', but that didn't help.

Anybody know of a method I might be missing that would help me out?
Basically what I'm trying to accomplish is if I see a request coming in
on port 443, I want to set $r->method( "https" ) -- and I know
there's no method called this, but for explanation sake ;)

Thanks!


[MP2] problem slurp_filename opennig nonexistent script

2005-09-15 Thread Petr Dadák
Hello

I'm using Apache2 and ModPerl2 on Fedora Core 4 x86_64 and I discover some
problem when client try to get nonexistent script uri 
(http://my.site.com/foo.pl).
Client doesn't obtain any response or error page.

Petr Dadak
Univesity IS development at Mendel university Brno, Czech Republic

-8<-- Start Bug Report 8<--
1. Problem Description:

  When I try to execute script, which doesn't exist, I get errors like this:
slurp_filename('/uis/web/nonexistent.pl') / opening: (2) No such file 
or directory at 
/usr/lib64/perl5/vendor_perl/5.8.6/x86_64-linux-thread-multi/ModPerl/RegistryCooker.pm
 line 540
Can't use an undefined value as a SCALAR reference at 
/usr/lib64/perl5/vendor_perl/5.8.6/x86_64-linux-thread-multi/ModPerl/RegistryCooker.pm
 line 578
  and client doesn't obtain any response. Any code in sub read_script after line
'self->{CODE} = eval { $self->{REQ}->slurp_filename(0) }; # untainted'
  is not proceeded.

  So I made little work around putting 
return Apache2::Const::NOT_FOUND unless -e $self->{FILENAME};
  before problem line.

  related apache configuration:

Options +ExecCGI
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders +GlobalRequest +MergeHandlers +SetupEnv



2. Used Components and their Configuration:

Fedora Core 4

*** mod_perl version 2.01

*** using 
/usr/lib64/perl5/vendor_perl/5.8.6/x86_64-linux-thread-multi/Apache2/BuildConfig.pm

*** Makefile.PL options:
  MP_APR_CONFIG  => /usr/bin/apr-config
  MP_APR_LIB => aprext
  MP_APXS=> /usr/sbin/apxs
  MP_COMPAT_1X   => 1
  MP_GENERATE_XS => 1
  MP_LIBNAME => mod_perl
  MP_USE_DSO => 1


*** The httpd binary was not found


*** (apr|apu)-config linking info

(apr|apu)-config scripts were not found



*** /usr/bin/perl -V
Summary of my perl5 (revision 5 version 8 subversion 6) configuration:
  Platform:
osname=linux, osvers=2.4.21-27.el, archname=x86_64-linux-thread-multi
uname='linux crowe.devel.redhat.com 2.4.21-27.el #1 smp wed dec 1 21:53:39 
est 2004 x86_64 x86_64 x86_64 gnulinux '
config_args='-des -Doptimize=-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 
-fexceptions -m64 -mtune=nocona -Dversion=5.8.6 -Dmyhostname=localhost [EMAIL 
PROTECTED] -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dinstallprefix=/usr -Dprefix=/usr 
-Dlibpth=/usr/local/lib64 /lib64 /usr/lib64 -Dprivlib=/usr/lib/perl5/5.8.6 
-Dsitelib=/usr/lib/perl5/site_perl/5.8.6 
-Dvendorlib=/usr/lib/perl5/vendor_perl/5.8.6 
-Darchlib=/usr/lib64/perl5/5.8.6/x86_64-linux-thread-multi 
-Dsitearch=/usr/lib64/perl5/site_perl/5.8.6/x86_64-linux-thread-multi 
-Dvendorarch=/usr/lib64/perl5/vendor_perl/5.8.6/x86_64-linux-thread-multi 
-Darchname=x86_64-linux -Dvendorprefix=/usr -Dsiteprefix=/usr -Duseshrplib 
-Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db 
-Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio 
-Dinstallusrbinperl=n -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr 
-Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_endprotoent_r_proto 
-Ud_endservent_r_proto -Ud_sethostent_r_proto -Ud_setprotoent_r_proto 
-Ud_setservent_r_proto -Dinc_version_list=5.8.5 5.8.4 5.8.3'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define 
usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=define use64bitall=define uselongdouble=undef
usemymalloc=n, bincompat5005=undef
  Compiler:
cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING 
-fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
optimize='-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m64 
-mtune=nocona',
cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe 
-I/usr/local/include -I/usr/include/gdbm'
ccversion='', gccversion='4.0.0 20050516 (Red Hat 4.0.0-6)', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', 
lseeksize=8
alignbytes=8, prototype=define
  Linker and Libraries:
ld='gcc', ldflags =''
libpth=/usr/local/lib64 /lib64 /usr/lib64
libs=-lresolv -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
perllibs=-lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
libc=/lib/libc-2.3.4.so, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version='2.3.5'
  Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E 
-Wl,-rpath,/usr/lib64/perl5/5.8.6/x86_64-linux-thread-multi/CORE'
cccdlflags='-fPIC', lddlflags='-shared'


Characteristics of this binary (from libperl): 
  Compile-time options: DEBUGGING MULTIPLICITY USE_ITHREADS USE_64_BIT_INT 
USE_6

Re: HTML::Template::Compiled

2005-09-15 Thread Tina Mueller
hi,

On Tue, 30 Aug 2005, Octavian Rasnita wrote:

> Does anyone use the templating system HTML::Template::Compiled with
> mod_perl?
> 
> I have just discovered that it works much faster with mod_perl than
> HTML::Template and I have also seen that it has some new features but I
> wouldn't like to start using it, then to discover big bugs.
> 
> If I won't get any answer, this means that the module is very good indeed
> and I can start using it with no problem.

i wouldn't use in production code now, as i have not tested memory usage yet,
(there is a script examples/bench_mem.pl though which will give you a
rough overwiev)
so if you have a lot of templates, your process might get big. at the
moment there is no convenient way to load the cached templates at
startup, and it might be that even some of the code forces a
copy-on-rewrite. i hope i can test that soon.
it has beta status, so if you want to beta-test feel free =)
my test suite is not big at the moment, i'm just adding tests when i
discover a bug or add a new feature, so you might step into some bugs.

of course, if your bottleneck is the database, HTC can't save you much,
but a bit. try to use DProf to see what part of your code takes the most
time.

development at htcompiled.sf.net

regards,
tina


Re: Is it possible to create a file bucket?

2005-09-15 Thread Frank Wiles
On Fri, 16 Sep 2005 00:25:24 +0300
"Nikolay Ananiev" <[EMAIL PROTECTED]> wrote:

> I'd like to do the following:
> open $fh, '<', 'some_file'; # A very big file
> $b =  APR::Bucket->new($ba, $fh);
> 
> while($b->read($buffer, 2048)) {
> ...
> }
> 
> or
> $b =  APR::Bucket->new($ba, \*STDIN);

  Why would you want to do that?  Just use normal file usage or
  if you really want to read it by exactly 2048 bytes at a time
  something like sysread().  

 -
   Frank Wiles <[EMAIL PROTECTED]>
   http://www.wiles.org
 -



Re: Is it possible to create a file bucket?

2005-09-15 Thread Will Whittaker

On Fri, Sep 16, 2005 at 12:25:24AM +0300, Nikolay Ananiev wrote:
> 
> 
> I'd like to do the following:
> open $fh, '<', 'some_file'; # A very big file
> $b =  APR::Bucket->new($ba, $fh);
> 
> while($b->read($buffer, 2048)) {
> .
> }
> 
> or
> $b =  APR::Bucket->new($ba, \*STDIN);
> 
> 
> 
> 
> 
> 
I'm not sure what you are trying to do in the above.  If you are trying to
make brigades usuable as filehandles then try Apache2::TieBucketBrigade
http://search.cpan.org/~mock/Apache2-TieBucketBrigade-0.07/

mock


Is it possible to create a file bucket?

2005-09-15 Thread Nikolay Ananiev
I'd like to do the following:
open $fh, '<', 'some_file'; # A very big file
$b =  APR::Bucket->new($ba, $fh);

while($b->read($buffer, 2048)) {
...
}

or
$b =  APR::Bucket->new($ba, \*STDIN);








RE: *nix distro compatibility (was Re: survey)

2005-09-15 Thread Perrin Harkins
On Wed, 2005-09-14 at 18:07 -0700, David Christensen wrote:
> and tentatively plan to use the Debian 3.1 stable apache-perl package (Apache
> 1.33 and mod_perl 1.29).

That sounds like a good plan.  There may still be issues with their
apache compile, but it's definitely better than using a pre-release
version of mod_perl 2.  When they get new mod_perl 2 packages out, you
can switch to them.

- Perrin



RE: Do I need Apache2::RequestUtil::request( )?

2005-09-15 Thread Justin Luster
Thanks for your reply.  

But why get into all of this confusion when:

print "Content-type: text/html\r\n\r\n"

just works?

Why would I want to use:

$request = Apache2::RequestUtil->request();

-Original Message-
From: Tom Schindl [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 15, 2005 12:29 AM
To: Justin Luster
Cc: 'mod_perl List'
Subject: Re: Do I need Apache2::RequestUtil::request( )?

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Justin,

I try to answer you questions step by step:

1. Why does print "Content-type: text/html\r\n\r\n" work?
Because $r->content_type("text/html") does the same behind the scences

2. Should I use Apache2::RequestUtil->request():
This is only available as of mp-2.0.0 and not mp1.99 so you could not
use it earlier than mp-2.0.0.

3. How can I run scripts under mp1, mp1.99, mp2
- ---8<--
my $MOD_PERL;

if (exists $ENV{MOD_PERL}) {
if (exists $ENV{MOD_PERL_API_VERSION} && $ENV{MOD_PERL_API_VERSION}
== 2) {
$MOD_PERL = 2;
} else {
## maybe there is a %ENV-Var to use but I can not recover how
## it's named
eval "require mod_perl";
if( defined $mod_perl::VERSION ) {
if ($mod_perl::VERSION >= 1.99) {
$MOD_PERL = 1.99;
} else {
$MOD_PERL = 1;
}
}
}
}

my $request;

if( $MOD_PERL == 2 ) {
 $request = Apache2::RequestUtil->request();
} elsif( $MOD_PERL == 1.99 ) {
 $request = Apache->request();
} else {
 $request = Apache->request();
}
- ---8<---

The problem you may want to face is that you need a pre-2.0.0
documentation because functions and their arguments may have changed so
maybe need the mp2-mp1.99-mp1-switch also in your code.

Tom

Justin Luster wrote:
> Hi,
> 
>  
> 
> I'm still struggling with trying to understand how Mod_Perl 2 works. 
> All I want to do is to have a regular Perl script run under Mod_Perl
> just to speed it up.
> 
>  
> 
> In the past, in Mod_Perl 1 I?ve used this:
> 
>  
> 
> sub PrintHeader
> 
> {
> 
> if ($ENV{'PERL_SEND_HEADER'})
> 
> {
> 
> print "Content-type: text/html\r\n\r\n";
> 
> }
> 
> else
> 
> {
> 
> my $r = Apache->request;
> 
> $r->content_type('text/html');
> 
> $r->send_http_header;
> 
> }
> 
> }
> 
>  
> 
> I then read the documentation where it says:
> 
>  
> 
> Apache->request has been replaced with Apache2::RequestUtil::request(
). 
> 
>  
> 
> There is also some other documentation in that section that I don?t
> quite understand.  In testing and messing around with this in Mod_Perl
2
> I?ve noticed that the simple
> 
>  
> 
> print "Content-type: text/html\r\n\r\n";
> 
>  
> 
> just works.  My Apache configuration looks like this:
> 
>  
> 
> 
> 
> Options ExecCGI
> 
> AddHandler cgi-script .pl
> 
> AddHandler cgi-script .cgi
> 
>  
> 
> #For ModPerl Only
> 
> 
> 
> 
> 
> SetHandler perl-script
> 
> PerlResponseHandler ModPerl::Registry
> 
> Options ExecCGI
> 
> allow from all
> 
> PerlOptions +ParseHeaders
> 
> 
> 
> 
> 
> 
> 
>  
> 
> I?m thrilled if:
> 
>  
> 
> print "Content-type: text/html\r\n\r\n";
> 
>  
> 
> just works.  But I want to make sure I understand it and that it is OK
> before releasing this.
> 
>  
> 
> I?m just using ModPerl::Registry to speed regular Perl CGI scripts up.

> The code needs to work with regular CGI, Mod_Perl 1, Mod_Perl 1.99,
and
> Mod_Perl 2.
> 
>  
> 
> And by the way $ENV{'PERL_SEND_HEADER'} does not seem to exist any
> more.  Is this not available in Mod_Perl 2? 
> 
> How do detect:
> 
>  
> 
> PerlOptions -ParseHeaders?
> 
>  
> 
> Thanks for your help,
> 
>  
> 
> Justin
> 

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Mandriva - http://enigmail.mozdev.org

iD8DBQFDKSKokVPeOFLgZFIRAi8sAKCoW1s2Ds2kWYvrMDQWlu5pdekYYACeOBa4
tN0ebd2NBiGX2KJ7UEQa8Jc=
=jUT+
-END PGP SIGNATURE-




Re: Mod_Perl2 w/mod_proxy/mod_rewrite

2005-09-15 Thread Philip M. Gollucci

Jonathan Steffan wrote:

  1.
 Concept:
  2.
3.
 GET http://domain.tld/search/a/b/c (via :80)
  4.
 rewrite search/a/b/c ->
 http://localhost:8080/perl/script?a=a&b=b&c=c [P] (via .htaccess
 RewriteRule) [OK] (localhost:8080 is another apache w/mod_perl)
  5.
 proxy: http://localhost:8080/perl/script?a=a&b=b&c=c [OK]
  6.
 GET http://localhost:8080/perl/script?a=a&b=b&c=c via
 (domain.tld:80) proxy-> [Server Error: on
 apache2.0.54/mp2.0.1/perl5.8.7 via localhost:8080]
  7.
 Error:
  8.
9.
 [error] slurp_filename('/opt/apache2/perl/script.pl?a=a&b=b&c=c')
 / opening: (2) No such file or directory at
 /opt/perl/lib/site_perl/5.8.7/i686-linux/ModPerl/RegistryCooker.pm
 line 540

The rewrite works fine when not using mod_proxy. Mod_proxy seems to 
split out the uri and vars correctly. When using mod_proxy... this is 
what I get. Does anyone think this is an issue with mod_perl2?

I'm not sure.. I'll and recreate it tonight.

Sorry I've beeb a bit sparse the last few days been swamped.
 :)

--
END

What doesn't kill us can only make us stronger.
Nothing is impossible.

Philip M. Gollucci ([EMAIL PROTECTED]) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
  http://www.liquidityservicesinc.com
   http://www.liquidation.com
   http://www.uksurplus.com
   http://www.govliquidation.com
   http://www.gowholesale.com



Re: Getting param

2005-09-15 Thread Tom Schindl
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Boysenberry Payne wrote:
> Now when I try to start apache using apachectl start I get:
> 
> dyld: /usr/local/httpd/bin/httpd version mismatch for library:
> /usr/local/httpd/lib/libexpat.0.dylib (compatibility version of user:
> 6.0.0 greater than library's version: 2.0.0)
> 
> /usr/local/httpd/bin/apachectl: line 100:   Trace/BPT trap 
> $HTTPD $ARGV
> 
> Would this be better tackled on a different list?
> 
> Boysenberry
> 
> boysenberrys.com | habitatlife.com | selfgnosis.com
> 
> 

Yes maybe libapreq's mailing list is more appropriate. For the thread I
saw that you may have installed expat manually on your system. It now
seems that apache2 and libapreq are compiled with different versions of
expat.

Tom
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Mandriva - http://enigmail.mozdev.org

iD8DBQFDKSRUkVPeOFLgZFIRAs9NAKCsRLp7jhCROCwb/jSXqfQxDJ3U+QCfY6hT
FlXBd3x5n6SOQe7T4w/QMwo=
=QONM
-END PGP SIGNATURE-


Re: Getting param

2005-09-15 Thread Tom Schindl
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Joe Schaefer wrote:
> Boysenberry Payne <[EMAIL PROTECTED]> writes:
> 
> 
>>What is the difference between:
>>
>>APR::Request::Apache2
>>and
>>Apache2::RequestRec
> 
> 
> Apache2::RequestRec is the perl module representing httpd's request_rec
> struct.  APR::Request::Apache2 is the perl module for interfacing with
> mod_apreq2, which is part of libapreq2.  Basically APR::Request::Apache2
> is a plugin for Apache2::RequestRec, that is responsible for parsing form
> data.
> 
As a side note: I love that Apache2::Request is renamed because it
aovids the confusion many people have about

mp1:
Apache - Apache::Request

mp2:
Apache2::RequestRec - Apache2::Request


Tom
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Mandriva - http://enigmail.mozdev.org

iD8DBQFDKSOLkVPeOFLgZFIRAjRdAKCyAr0LF87zSVXLMnwRJhXIhGjMBgCfQqSB
9md1TAqCLxNiayfMP+QKWWk=
=Yj5l
-END PGP SIGNATURE-


Re: Do I need Apache2::RequestUtil::request( )?

2005-09-15 Thread Tom Schindl
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Justin,

I try to answer you questions step by step:

1. Why does print "Content-type: text/html\r\n\r\n" work?
Because $r->content_type("text/html") does the same behind the scences

2. Should I use Apache2::RequestUtil->request():
This is only available as of mp-2.0.0 and not mp1.99 so you could not
use it earlier than mp-2.0.0.

3. How can I run scripts under mp1, mp1.99, mp2
- ---8<--
my $MOD_PERL;

if (exists $ENV{MOD_PERL}) {
if (exists $ENV{MOD_PERL_API_VERSION} && $ENV{MOD_PERL_API_VERSION}
== 2) {
$MOD_PERL = 2;
} else {
## maybe there is a %ENV-Var to use but I can not recover how
## it's named
eval "require mod_perl";
if( defined $mod_perl::VERSION ) {
if ($mod_perl::VERSION >= 1.99) {
$MOD_PERL = 1.99;
} else {
$MOD_PERL = 1;
}
}
}
}

my $request;

if( $MOD_PERL == 2 ) {
 $request = Apache2::RequestUtil->request();
} elsif( $MOD_PERL == 1.99 ) {
 $request = Apache->request();
} else {
 $request = Apache->request();
}
- ---8<---

The problem you may want to face is that you need a pre-2.0.0
documentation because functions and their arguments may have changed so
maybe need the mp2-mp1.99-mp1-switch also in your code.

Tom

Justin Luster wrote:
> Hi,
> 
>  
> 
> I'm still struggling with trying to understand how Mod_Perl 2 works. 
> All I want to do is to have a regular Perl script run under Mod_Perl
> just to speed it up.
> 
>  
> 
> In the past, in Mod_Perl 1 I?ve used this:
> 
>  
> 
> sub PrintHeader
> 
> {
> 
> if ($ENV{'PERL_SEND_HEADER'})
> 
> {
> 
> print "Content-type: text/html\r\n\r\n";
> 
> }
> 
> else
> 
> {
> 
> my $r = Apache->request;
> 
> $r->content_type('text/html');
> 
> $r->send_http_header;
> 
> }
> 
> }
> 
>  
> 
> I then read the documentation where it says:
> 
>  
> 
> Apache->request has been replaced with Apache2::RequestUtil::request( ). 
> 
>  
> 
> There is also some other documentation in that section that I don?t
> quite understand.  In testing and messing around with this in Mod_Perl 2
> I?ve noticed that the simple
> 
>  
> 
> print "Content-type: text/html\r\n\r\n";
> 
>  
> 
> just works.  My Apache configuration looks like this:
> 
>  
> 
> 
> 
> Options ExecCGI
> 
> AddHandler cgi-script .pl
> 
> AddHandler cgi-script .cgi
> 
>  
> 
> #For ModPerl Only
> 
> 
> 
> 
> 
> SetHandler perl-script
> 
> PerlResponseHandler ModPerl::Registry
> 
> Options ExecCGI
> 
> allow from all
> 
> PerlOptions +ParseHeaders
> 
> 
> 
> 
> 
> 
> 
>  
> 
> I?m thrilled if:
> 
>  
> 
> print "Content-type: text/html\r\n\r\n";
> 
>  
> 
> just works.  But I want to make sure I understand it and that it is OK
> before releasing this.
> 
>  
> 
> I?m just using ModPerl::Registry to speed regular Perl CGI scripts up. 
> The code needs to work with regular CGI, Mod_Perl 1, Mod_Perl 1.99, and
> Mod_Perl 2.
> 
>  
> 
> And by the way $ENV{'PERL_SEND_HEADER'} does not seem to exist any
> more.  Is this not available in Mod_Perl 2? 
> 
> How do detect:
> 
>  
> 
> PerlOptions -ParseHeaders?
> 
>  
> 
> Thanks for your help,
> 
>  
> 
> Justin
> 

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Mandriva - http://enigmail.mozdev.org

iD8DBQFDKSKokVPeOFLgZFIRAi8sAKCoW1s2Ds2kWYvrMDQWlu5pdekYYACeOBa4
tN0ebd2NBiGX2KJ7UEQa8Jc=
=jUT+
-END PGP SIGNATURE-


Re: *nix distro compatibility (was Re: survey)

2005-09-15 Thread Jens Gassmann

Hi,


I don't think this changes your situation any.  CGI is not really fast
enough to use, so you still need mod_perl or FastCGI.  Because the
current crop of linux distros came out before mod_perl 2 but couldn't
use mod_perl 1 (since they are using apache 2), they have poor mod_perl
support in their packaging systems.


Not at gentoo linux [1] - the portage build system gives you the recent 
 version of apache, mod_perl and other software with the simplicity of 
binary packages with the flexibility of source code.


Acutally i use the following versions without any problems. Before i use 
gentoo i try often to compile mod_perl from source but it often fails or 
segfault with mysql and mod_php.


[ebuild   R   ] net-www/apache-2.0.54-r30  +apache2 -debug -doc -ldap 
-mpm-leader -mpm-peruser -mpm-prefork -mpm-threadpool -mpm-worker 
-no-suexec (-selinux) +ssl -static-modules -threads 0 kB

[ebuild   R   ] www-apache/mod_perl-2.0.1-r2  0 kB
[ebuild   R   ] dev-libs/apr-0.9.6-r3  -ipv6 0 kB


regards,
Jens

[1] http://www.gentoo.org/
[2] http://www.gentoo.org/doc/en/apache-upgrading.xml



--
Es ist nicht wenig Zeit, die wir zur Verfügung haben,
sondern es ist viel Zeit, die wir nicht nutzen.

EMail: [EMAIL PROTECTED]
Büro : 0221/975 08 20
http://www.atomix.de  <- Photoblog
http://www.aisware.de <- Content-Management-Lösung