Re: proxy question

2008-01-31 Thread Martin Moss
thanks :)

- Original Message 
From: Heiko Jansen <[EMAIL PROTECTED]>
To: Martin Moss <[EMAIL PROTECTED]>
Cc: modperl 
Sent: Thursday, 31 January, 2008 12:28:14 PM
Subject: Re: proxy question


Am Donnerstag, den 31.01.2008, 11:31 +0000 schrieb Martin Moss:

> does mod_proxy provide more than round robin load balancing
>  functionlity? I'd been told it could, but I can't find anything in
 the
>  docs..

Actually this is not the right place to ask about other httpd modules
than mod_perl, but still: Please have a look at 
http://httpd.apache.org/docs/2.2/mod/mod_proxy_balancer.html

Heiko






  __
Sent from Yahoo! Mail - a smarter inbox http://uk.mail.yahoo.com



proxy question

2008-01-31 Thread Martin Moss
Hi all,

does mod_proxy provide more than round robin load balancing functionlity? I'd 
been told it could, but I can't find anything in the docs..


Martin



  __
Sent from Yahoo! Mail - a smarter inbox http://uk.mail.yahoo.com



Re: regex quickie

2007-04-26 Thread Martin Moss
h seems this worked today.. Server restart musta
failed when it didn't seem to work..

if ($string =~ /($pattern_match)/i)


--- Martin Moss <[EMAIL PROTECTED]> wrote:

> 
> I'm looking for a regex which will help me do this..
> 
> $string = 'google.com/?q=test';
> 
> $pattern_match = 'google|yahoo|msn';
> 
> What I would like to do is test if $string contains
> one of the patterns in the pattern match and then
> carry out a function based upon which pattern is
> matched...
> 
> e.g.
> 
> if ($string =~ /$pattern_match/i)
> {
>my $matched_pattern =  ($_?)
> 
> 
> }
> 
> 
> Any ideas?
> 
> sorry for being slightly not mod perl specific...
> 
> 
>  
>
___
> 
> Yahoo! Mail is the world's favourite email. Don't
> settle for less, sign up for
> your free account today
>
http://uk.rd.yahoo.com/evt=44106/*http://uk.docs.yahoo.com/mail/winter07.html
> 
> 



  ___
Yahoo! Answers - Got a question? Someone out there knows the answer. Try it
now.
http://uk.answers.yahoo.com/ 


regex quickie

2007-04-26 Thread Martin Moss

I'm looking for a regex which will help me do this..

$string = 'google.com/?q=test';

$pattern_match = 'google|yahoo|msn';

What I would like to do is test if $string contains
one of the patterns in the pattern match and then
carry out a function based upon which pattern is
matched...

e.g.

if ($string =~ /$pattern_match/i)
{
   my $matched_pattern =  ($_?)


}


Any ideas?

sorry for being slightly not mod perl specific...


  ___ 
Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for
your free account today 
http://uk.rd.yahoo.com/evt=44106/*http://uk.docs.yahoo.com/mail/winter07.html 


Weird startup includes

2007-04-26 Thread Martin Moss
I seem to have something weird going on. a Module I've
written seems to be being included twice at server
startup, but the second time its included the
Apache::ServerStarting flag is set to 0... and is
therefore causing all sorts of grief... (e.g. $dbh
being forked)..
Ive never noticed before that if you have you module
declared twice (in httpd.conf and in startup.pl) that
it would load the module twice 

I'm running apache 1.33 and mod perl... Any ideas?

###startup.pl

use MY::Module;

---

## httpd.conf

PerlModule MY::Module
PerlHandler My::Module->handler
.
http://uk.answers.yahoo.com/ 


Re: [OT] SOAP::Lite help

2007-03-13 Thread Martin Moss

When I try this I am getting this

SOAP::Transport::new: ()
SOAP::Serializer::new: ()
SOAP::Deserializer::new: ()
SOAP::Parser::new: ()
SOAP::Lite::new: ()
SOAP::Deserializer::new: ()
SOAP::Parser::new: ()
SOAP::Schema::new: ()


And then it just hangs here indefinitely. Would
this be a server issue?



--- John ORourke <[EMAIL PROTECTED]> wrote:

> Not really mod_perl but possibly of interest -
> here's my version, untested:
> 
> #!/usr/bin/perl
> use SOAP::Lite +trace;
> use Data::Dumper;
>
$soapobj=SOAP::Lite->service('https://myserver.myhost.com/services/EndUser?wsdl');
> $soapresult=$soapobj->getUser('wombat104');
> if($soapresult->fault){
> print "FAULTED! code ".$soapresult->faultcode."
> reason 
> ".$soapresult->faultstring."\n";
> }else{
> print "OK! results are: 
>
".Dumper($soapresult->result,$soapresult->paramsout);
> }
> 
> sub
> SOAP::Transport::HTTP::Client::get_basic_credentials
> {
> return ''=>'password';
> }
> 
> 
> Martin Moss wrote:
> > All,
> >
> > I have a Php script which I wish to convert to
> perl
> > 
> > require_once('SOAP/Client.php');
> > $wsdl_url =
> >
> 'https://myserver.myhost.com/services/EndUser?wsdl';
> > $WSDL = new Soap_WSDL($wsdl_url);
> > $soap = $WSDL->getProxy();
> >
> > $soap->setCredentials('','password');
> > $username = "wombat104";
> >
> > $return = $soap->getUser($username);
> > ==
> >
> > Can someone show me how this would look using
> > SOAP::Lite?  
> >
> >  
> >
> >
> > 
> >
>
___
> 
> > Yahoo! Messenger - with free PC-PC calling and
> photo sharing. http://uk.messenger.yahoo.com
> >
> >   
> 
> 






___ 
New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at 
the Yahoo! Mail Championships. Plus: play games and win prizes. 
http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk 


SOAP::Lite help

2007-03-13 Thread Martin Moss
All,

I have a Php script which I wish to convert to perl

require_once('SOAP/Client.php');
$wsdl_url =
'https://myserver.myhost.com/services/EndUser?wsdl';
$WSDL = new Soap_WSDL($wsdl_url);
$soap = $WSDL->getProxy();

$soap->setCredentials('','password');
$username = "wombat104";

$return = $soap->getUser($username);
==

Can someone show me how this would look using
SOAP::Lite?  

 



___ 
Yahoo! Messenger - with free PC-PC calling and photo sharing. 
http://uk.messenger.yahoo.com


Re: Zend PHP

2007-03-09 Thread Martin Moss
Many thanks to you all for your posts, Much food for
thought... ultimately the decision is out of my hands,
which is why I'm looking for useful perl based
alternatives to propose to the powers that be.

To be fair to Zend... you should checkout their
products, as it's not just about the support, but the
fact that they have a whole integrated developer
studio and deployment mechanism... And many other
whistles and Bells...

Regards

Marty

--- Robert Landrum <[EMAIL PROTECTED]> wrote:

> Martin Moss wrote:
> > I just had a demo of the Zend Platform and
> framework
> > for php.
> > It's got some really nice stuff, but ultimately
> the
> > reason we may decide to ditch perl and move to php
> > (h I know booo) will be down to support. OR
> > lackthereof for Perl...
> > 
> 
> I've been writing perl for 10 years now (I know, a
> newbie :), but in 
> those ten years, there's never been anything for
> which I've needed to 
> ask "support" for.  I've never once encountered a
> honest *perl* bug. 
> Any questions, about anything, have been answered by
> the perl book, or 
> perl cookbook.
> 
> As far as coding is concerned, CPAN has proved to be
> the most valuable 
> resource.  In writing in other languages, I often
> find myself having to 
> search hi-and-low for source, libraries, or
> documentation on how to do 
> common, trivial things...  Things which are easily
> found in CPAN.
> 
> PHP is okay, and has almost the same level of
> community support as perl 
> (although it kinda feels a bit less organized).  The
> perl/mod_perl 
> community has always been there with helpful advice
> when I needed 
> assistance.  I don't see it going away.
> 
> I'm sure the Zend cool-aid is tasty, but I'll stick
> with perl for now...  :)
> 
> Rob
> 






___ 
New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at 
the Yahoo! Mail Championships. Plus: play games and win prizes. 
http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk 


Zend PHP

2007-03-08 Thread Martin Moss
I just had a demo of the Zend Platform and framework
for php.
It's got some really nice stuff, but ultimately the
reason we may decide to ditch perl and move to php
(h I know booo) will be down to support. OR
lackthereof for Perl...

So my question is, given I'm not a php fan, Is there
an equivalent PERL based commercial entity who will
provide support for a medium sized web outfit?

Marty




___ 
Copy addresses and emails from any email account to Yahoo! Mail - quick, easy 
and free. http://uk.docs.yahoo.com/trueswitch2.html


Re: SOAP

2007-03-01 Thread Martin Moss
Cheers Perrin :-)


--- Perrin Harkins <[EMAIL PROTECTED]> wrote:

> On 3/1/07, Martin Moss <[EMAIL PROTECTED]>
> wrote:
> > It's been a while since I've posted, but I have a
> new
> > project which has a SOAP interface. I have limited
> > experience with SOAP, so I was wondering if there
> is a
> > consensus of opinion as to what the best modules
> to
> > use are?
> 
> I think SOAP::Lite is the only game in town.
> 
> - Perrin
> 






___ 
New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at 
the Yahoo! Mail Championships. Plus: play games and win prizes. 
http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk 


Re: PerlAuthenHandler

2007-03-01 Thread Martin Moss
As I understand it...

if you use this ->autologin   the first argument to
your autologin subroutine will be a string
'MyRoot::Testing'

if you use ::autologin  It won't be...

Perhaps this might have something to do with it...



I setup my subroutines like this:-

http.conf

PerlModule MyRoot::Testing
PerlAuthenHandler MyRoot::Testing->autologin

===Testing.pm

sub autologin : method
{
my $class =shift;
my $r = shift;

}


--- Martijn <[EMAIL PROTECTED]> wrote:

> As someone here pointed out in an off-list email
> (thanks!), I had
> forgotten to load the perl module, by writing
>   PerlModule MyRoot::Testing
> in httpd.conf. That wasn't very clever...
> 
> But then it still didn't work, until for some reason
> I changed
>   PerlAuthenHandler MyRoot::Testing->autologin
> to
>   PerlAuthenHandler MyRoot::Testing::autologin
> 
> It's doing my head in, as in the line above this
> one, a -> is used
> without any problems. It's all not very important,
> but I'd like to
> write code of which I understand why it works,
> rather than code that
> just happens to work.
> 
> Martijn.
> 




___ 
Copy addresses and emails from any email account to Yahoo! Mail - quick, easy 
and free. http://uk.docs.yahoo.com/trueswitch2.html


SOAP

2007-03-01 Thread Martin Moss
All,

It's been a while since I've posted, but I have a new
project which has a SOAP interface. I have limited
experience with SOAP, so I was wondering if there is a
consensus of opinion as to what the best modules to
use are?

Effectively I'll be simply posting strings of SOAP XML
to a webpage... But eventually we may use SOAP to pass
data around between Classes. Although I'm not sure if
this would be overkill.

Any hints/advice would be much appreciated..

Marty



___ 
What kind of emailer are you? Find out today - get a free analysis of your 
email personality. Take the quiz at the Yahoo! Mail Championship. 
http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk 


Progress bar for file uploads

2006-04-27 Thread Martin Moss
All,

Does anybody know of a progress bar type class for
file uploads? (apache 1)

Or, if there isn't one, available, what are the basic
steps needed to implement one? 

regards

Marty



___ 
To help you stay safe and secure online, we've developed the all new Yahoo! 
Security Centre. http://uk.security.yahoo.com


Re: Crypt::CBC

2006-04-10 Thread Martin Moss
Genius:-)  I think for the time being this is the best
way to go...  At least I'm up and running.. But I
presume this is going to bite me in the bum at a later
date...

--- Ian Joyce <[EMAIL PROTECTED]> wrote:

> You can always use version 2.12.
> 
> http://search.cpan.org/~lds/Crypt-CBC-2.12/
> 
> --Ian
> 
> 
> On 4/10/06, Martin Moss
> <[EMAIL PROTECTED]> wrote:
> > All,
> >
> > I had some code which ran the old version of
> > Crypt::CBC (2.12).
> >
> > Using these headers to create the object:-
> >
> > my $cipher = new
> > Crypt::CBC($ENCRYPTION_KEY,'Blowfish');
> >
> > I've now built a new machine. Copied the database
> > values (encrpypted using the above) onto the new
> > machine DB using mysqldump etc..
> >
> > However I've found a problem in that the new
> machine
> > is built with Crypt::CBC version 2.17..
> >
> > The above code does not work anymore as I now get
> the
> > following error...:-
> >
> > Ciphertext does not begin with a valid header for
> > 'salt' header mode at /usr/local/lib/perl/.
> >
> > I tried doing this:-
> >
> > my $cipher = new Crypt::CBC(
> > -key => $ENCRYPTION_KEY,
> > -cipher => 'Crypt::Blowfish',
> > -insecure_legacy_decrypt =>1
> > -header =>'randomiv'
> > -salt =>'1'
> > );
> >
> > But I still get the error...
> >
> > Any ideas what on earth I'm supposed to do to be
> able
> > to use my old information?
> >
> > Marty
> >
> >
> >
> >
>
___
> > NEW Yahoo! Cars - sell your car and browse
> thousands of new and used cars online!
> http://uk.cars.yahoo.com/
> >
> 




___ 
To help you stay safe and secure online, we've developed the all new Yahoo! 
Security Centre. http://uk.security.yahoo.com


Crypt::CBC

2006-04-10 Thread Martin Moss
All,

I had some code which ran the old version of
Crypt::CBC (2.12).

Using these headers to create the object:-

my $cipher = new
Crypt::CBC($ENCRYPTION_KEY,'Blowfish');

I've now built a new machine. Copied the database
values (encrpypted using the above) onto the new
machine DB using mysqldump etc..

However I've found a problem in that the new machine
is built with Crypt::CBC version 2.17..

The above code does not work anymore as I now get the
following error...:-

Ciphertext does not begin with a valid header for
'salt' header mode at /usr/local/lib/perl/.

I tried doing this:-

my $cipher = new Crypt::CBC(
-key => $ENCRYPTION_KEY,
-cipher => 'Crypt::Blowfish',
-insecure_legacy_decrypt =>1
-header =>'randomiv'
-salt =>'1'
);

But I still get the error...

Any ideas what on earth I'm supposed to do to be able
to use my old information?

Marty



___ 
NEW Yahoo! Cars - sell your car and browse thousands of new and used cars 
online! http://uk.cars.yahoo.com/


[JOB] [OT] London

2006-02-28 Thread Martin Moss
All,

We are seeking a perl developer to join a small
development team. The ideal candidate will have 3+
years experience developing, supporting and debugging
internet/intranet projects, using perl within an
Apache, linux/solaris environment. 
Candidates must also have 2+ years experience using
Oracle SQL with perl’s DBI with a solid exposure to
either Template Toolkit or EmbedPerl. Other perl
templating mechanisms will be considered, as will
other SQL based RDBMS (Mysql, Sybase etc..)

Further to the above skills, candidates must
demonstrate a solid level of competence in hand coding
HTML and JavaScript. 

Financial industry experience will be considered a
bonus, as will experience of any of the following
technologies, JSP, Java (J2EE), XML, mod perl “Method”
handlers, Content Management systems, datafeeds and
bulk emailing systems. Any experience with developing
code using a Source code control mechanism, ideally
Perforce or CVS, will also be considered a Bonus.

Candidates will be tested on their knowledge of
Apache, DBI, OO Perl, mod perl, HTML, Javascript and
their ability to write efficient and abstract code
during the interview process.

Please Send CV's & a covering letter to
[EMAIL PROTECTED] (Do not reply to this email).

Please note, we are based in the City of London and
will only  accept applications from people who are
entitled to work in the UK and who can commute to the
office daily. 

Regards

Marty





___ 
Win a BlackBerry device from O2 with Yahoo!. Enter now. 
http://www.yahoo.co.uk/blackberry


Re: Apache::DBI

2006-01-16 Thread Martin Moss
Not sure why it's doing it, if you've got a default
clean install,

But to control it's debug level you can put this in
your startup.pl 

$Apache::DBI::DEBUG=0;

Regards

Marty



--- Paul Harrison <[EMAIL PROTECTED]> wrote:

>  
> 
> I installed Apache::DBI - 0.98 on FreeBSD 5.4 with
> mod_perl 1.
> 
>  
> 
> Apache::DBI logs an entry in apache error log file
> every time it create(s) a
> new connection or using an existing connection to
> the database server.
> 
> Is this normal with this version?  And how do I turn
> that feature off?
> 
>  
> 
>  
> 
> Example,
> 
> 55933 Apache::DBI need ping: yes
> 
> 55933 Apache::DBI already connected to
>
'database=database_name;host=info_here\AutoCommit=1^\PrintError=1^\Username=
> info_here'
> 
> 55933 Apache::DBI need ping: yes
> 
> 55933 Apache::DBI already connected to
>
'database=database_name;host=info_here\AutoCommit=1^\PrintError=1^\Username=
> info_here'
> 
>  
> 
>  
> 
> The error log file will get huge after a while.
> 
>  
> 
>  
> 
> Cure
> 
>  
> 
> 




___ 
NEW Yahoo! Cars - sell your car and browse thousands of new and used cars 
online! http://uk.cars.yahoo.com/


Re: configuration error: couldn't check user. No user file?:

2005-11-11 Thread Martin Moss
solved it... But there's a new mystery...

I was returning DECLINED in my Auth handler when the
following subroutine showed a user had disconnected...


sub client_still_connected
{
my $self = shift; #subclassed Apache::Request
my $conn = $self->connection;
my $is_connected = $conn->aborted ? 0 : 1;
if ($is_connected)
{
cluck ("connection still seems valid") if
$DEBUG;
my $fileno = $conn->fileno;
if (defined $fileno)
{
cluck ("Still seems valid\n") if $DEBUG;
my $s = IO::Select->new($fileno);
#$is_connected = $s->can_read(0) ? 0 : 1;
}
}

cluck ("is_connected=$is_connected\n") if $DEBUG;
return $is_connected;
}

The problem I have now, is this subroutine always
fails at the $s->can_read line whene a user POST's a
large amount of content... 

And intermittently on other page requests (GET & POST)
the subroutine fails the can_read but the client is
Still there

Any ideas?

We use a reverse proxy in front of our mod_perl
server...


Marty



--- Martin Moss <[EMAIL PROTECTED]> wrote:

> I'm seeing this error in the logfiles...
> 
> configuration error:  couldn't check user.  No user
> file?:
> 
> Any ideas what might cause it... it is appearing on
> different webpages... seems to be during large
> POST's.
> 
> We've just changed from Basic to Cookie based
> Auth...
> 
> Marty
> 
> 
>   
>
___
> 
> Yahoo! Model Search 2005 - Find the next catwalk
> superstars -
> http://uk.news.yahoo.com/hot/model-search/
> 




___ 
To help you stay safe and secure online, we've developed the all new Yahoo! 
Security Centre. http://uk.security.yahoo.com


configuration error: couldn't check user. No user file?:

2005-11-11 Thread Martin Moss
I'm seeing this error in the logfiles...

configuration error:  couldn't check user.  No user
file?:

Any ideas what might cause it... it is appearing on
different webpages... seems to be during large POST's.

We've just changed from Basic to Cookie based Auth...

Marty



___ 
Yahoo! Model Search 2005 - Find the next catwalk superstars - 
http://uk.news.yahoo.com/hot/model-search/


Re: Authentication

2005-11-10 Thread Martin Moss
You wouldn't believe the problems I've had with
AccessHandlers...

Although saying that I was trying to do a set_handlers
for the contentphase... which was being completely
ignored by apache...

I'll have a think about it... But the idea is to make
the authentication be completely invisible to the
users page request.. so if their login times out, and
they've just submitted a post to a message board, we
want to preserve their post throughout the
authentication and then when they're authenticated,
have the post occur and the user never have the
authentication process appear in their browser
history... 

Marty


--- John ORourke <[EMAIL PROTECTED]> wrote:

> My fault guys, not looking up the numbers - Martin
> is your admin 
> complaining about too many FORBIDDENs or REDIRECTs?
> 
> The only thing I can add is that I'd recommend not
> using the 
> authentication pages/handler to redirect - make
> yourself an Access phase 
> (eg. "if no valid cookie, redirect to HTTPS login
> page with appropriate 
> parameters").
> 
> John
> 
> 
> Perrin Harkins wrote:
> 
> >On Thu, 2005-11-10 at 17:19 +, Martin Moss
> wrote:
> >  
> >
> >>So an Authen Handler can return a REDIRECT?
> >>
> >>I use a 403 custom repsonse which is a self
> submitting
> >>page (with non javascript handling)... By doing so
> it
> >>prevent's any of the authentication pages
> appearing in
> >>IE's back button on the browser...
> >>
> >>
> 
> 






___ 
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail 
http://uk.messenger.yahoo.com


Re: Authentication

2005-11-10 Thread Martin Moss
So an Authen Handler can return a REDIRECT?

I use a 403 custom repsonse which is a self submitting
page (with non javascript handling)... By doing so it
prevent's any of the authentication pages appearing in
IE's back button on the browser...

Marty





--- Perrin Harkins <[EMAIL PROTECTED]> wrote:

> On Thu, 2005-11-10 at 16:20 +, John ORourke
> wrote:
> > You can avoid some redirection by having a
> non-HTTPS form which submits 
> > to the HTTPS login page (although users might
> worry, no padlock icon).  
> > Otherwise it's perfectly reasonable to redirect to
> a secure login.  On 
> > successful login simple 403 the user back to the
> page they wanted.  
> > That's just one 403 per request.
> 
> 403 means "Forbidden," not "Redirect."
> 
> - Perrin
> 
> 
> 




___ 
To help you stay safe and secure online, we've developed the all new Yahoo! 
Security Centre. http://uk.security.yahoo.com


Authentication

2005-11-10 Thread Martin Moss
All,

During the Authentication phase, Any custom responses
that need to be sent back to a user, MUST be sent with
FORBIDDEN using custom_repsonse? 

Under Authentication 200 (OK) simply lets Apache Move
on the to the next phase (authz, content  etc..)...

I have an authen handler which uses cookies.. and only
accepts username and password submits under https...

I'm getting grief from our sysadmin that there's too
many 403's being served...

1) to redirect the user from their http request to a
https page.. 
2) custom response showing the login page
3) redirect user to original http page 

so 3 403's when a user has no valid cookie 
Is this abnormal? Is there anything I could do to
reduce this?

Marty




___ 
To help you stay safe and secure online, we've developed the all new Yahoo! 
Security Centre. http://uk.security.yahoo.com


Re: is_intial_req

2005-11-01 Thread Martin Moss
I had a quick look at this and found both my requests
to /logout/ and /logout2/ typed into the browser
manually, continue to result in the same issue..

Here's the rewrite rules I have on my https proxy that
each request comes through..

RewriteRule ^/logout/(.*)$
http://${farm:map_pf}/logout/$1 [P,L]
RewriteRule ^/logout2/(.*)$
http://${farm:map_pf}/logout2/$1 [P,L]

I also ammended both locations to use 
/logout/ and /logout2/

And I still get the same issue...(so as far as I'm
aware no further internal translation is made..)

--- Geoffrey Young <[EMAIL PROTECTED]> wrote:

> 
> > Why is is_initial_req consistently 0 for logout
> and
> > consistently 1 for logout2...
> 
> besides the existing conversation, you need to
> remember what is_initial_req
> means - it means that this is the request as it came
> straight from the
> browser and wasn't redirected at all.  if apache
> made an internal redirect
> from /logout to /logout/ that would make
> is_initial_req false.
> 
> so, try playing around with trailing slashes and
> making sure that your
> requests are in fact equivalent (that you're not
> asking for /logout one time
> and /logout/index.html the next, for example).
> 
> HTH
> 
> --Geoff
> 




___ 
How much free photo storage do you get? Store your holiday 
snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com


Re: is_intial_req

2005-11-01 Thread Martin Moss
Hi Micheal..

It's a sticky one, because surely that would
definitely mean that the Location would take
precedence and the FilesMatch would be secondary...
And I am seeing this, my handler does get run first...
But it is Never the initial Request... 

Obviously something is happenning, behind the scenes,
and I can't work it out...

Is it possible Embperl does something with the Apache
Request in an earlier Phase of the request?


--- Michael Peters <[EMAIL PROTECTED]> wrote:

> 
> 
> Martin Moss wrote:
> > I'm a little confused. And was wondering if I
> could
> > get a sanity check..
> 
> > I tried swapping the order of the FilesMatch and
> the
> > Location configs in my httpd.conf but this made no
> > difference...
> 
> From reading
> http://httpd.apache.org/docs/1.3/sections.html, it
> seems
> that Location will always take precedence over
> FilesMatch regardless of
> their order.
> 
> Order only matters in the precedence of similar
> tags.
> 
> -- 
> Michael Peters
> Developer
> Plus Three, LP
> 
> 




___ 
To help you stay safe and secure online, we've developed the all new Yahoo! 
Security Centre. http://uk.security.yahoo.com


Re: is_intial_req

2005-11-01 Thread Martin Moss
yeah you're right, it does, thats what I've been
doing. But I'm having to use a rewrite rule to ensure
I don't have to go and manually edit the silly amount
of hardcoded links to /logout I've inherited with the
old code...:-(

Just bugs me that I don't understand the details of
why..

Marty


--- Frank Wiles <[EMAIL PROTECTED]> wrote:

> On Tue, 1 Nov 2005 14:54:31 + (GMT)
> Martin Moss <[EMAIL PROTECTED]> wrote:
> 
> > Hey Frank..
> > 
> > I agree, thats why I setup the logout2 control
> test.
> > What I don't understand is "why" it is tripping it
> > out. Surely it would only trip it out if the order
> of
> > the httpd.conf filesmatch and location is set one
> way
> > around, and then not trip it out if the order is
> > reversed, not both as I'm seeing...
> 
>   Order has almost no meaning in Apache's config
> files.  It's all
>   about the depth of the "nesting" of directives. 
> Much like CSS. 
> 
>   I don't have a really great explanation as to the
> cause, as I've
>   never used embedperl.  But I would think it would
> make your life
>   easier if you just didn't put handlers on
> Locations that also have
>   Embedperl scripts on the filesystem.  For
> clarity/readability as
>   much as to avoid this bug. 
> 
>  -
>Frank Wiles <[EMAIL PROTECTED]>
>http://www.wiles.org
>  -
> 
> 




___ 
To help you stay safe and secure online, we've developed the all new Yahoo! 
Security Centre. http://uk.security.yahoo.com


Re: is_intial_req

2005-11-01 Thread Martin Moss
Hey Frank..

I agree, thats why I setup the logout2 control test.
What I don't understand is "why" it is tripping it
out. Surely it would only trip it out if the order of
the httpd.conf filesmatch and location is set one way
around, and then not trip it out if the order is
reversed, not both as I'm seeing...

Would this also mean that once my ContentHandler has
returned OK, and sent Data back to the user and
"finished" as far as I'm concerned, that the Apache
server is then going off and running the old logout
embperl scripts too?

If so, how do I tell apache that I don't wish any more
contentHandlers to be run?

I posted an issue a while back about trying to use
push_handlers and set_handlers... and push_handlers
works, but set_handlers doesn't... never got a
solution, beyond what I'd already tried.. All very
weird. 

Marty

--- Frank Wiles <[EMAIL PROTECTED]> wrote:

> On Tue, 1 Nov 2005 14:31:33 + (GMT)
> Martin Moss <[EMAIL PROTECTED]> wrote:
> 
> > I'm a little confused. And was wondering if I
> could
> > get a sanity check..
> > 
> > I have a mod perl method handler and at start it
> runs
> > this code
> > 
> > my $is_initial_req = $r->is_initial_req;
> > my $is_main = $r->is_main;
> > my $main = $r->main;
> > my $proxyreq = $r->proxyreq;
> > 
> > print STDERR
> >
>
Dumper('is_initial_req',$is_initial_req,'is_main',$is_main,'main',
> > $main,'proxyreq',$proxyreq) if $DEBUG;
> > 
> > I am running a system which has embperl installed
> >
> > Why is is_initial_req consistently 0 for logout
> and
> > consistently 1 for logout2...
> > 
> > I tried swapping the order of the FilesMatch and
> the
> > Location configs in my httpd.conf but this made no
> > difference...
> > 
> > So can anybody clear up this mystery for me?
> 
>   I think your FilesMatch is what is tripping you
> up.  As a test,
>   move /logout/ to /logout3/ and see if you then get
> the same results
>   as /logout2/.  
> 
>  -
>Frank Wiles <[EMAIL PROTECTED]>
>http://www.wiles.org
>  -
> 
> 




___ 
To help you stay safe and secure online, we've developed the all new Yahoo! 
Security Centre. http://uk.security.yahoo.com


is_intial_req

2005-11-01 Thread Martin Moss
I'm a little confused. And was wondering if I could
get a sanity check..

I have a mod perl method handler and at start it runs
this code

my $is_initial_req = $r->is_initial_req;
my $is_main = $r->is_main;
my $main = $r->main;
my $proxyreq = $r->proxyreq;

print STDERR
Dumper('is_initial_req',$is_initial_req,'is_main',$is_main,'main',$main,'proxyreq',$proxyreq)
if $DEBUG;

I am running a system which has embperl installed
using this:-


  SetHandler  perl-script
  PerlHandler Embperl
  Options ExecCGI FollowSymLinks


And My handler is called using this


setHandler perl-script
PerlModule My::Apache::Authen::Cookie
PerlHandler My::Apache::Authen::Cookie->logout


I also have a second 'control' instance of this
handler installed purely for this debugging


setHandler perl-script
PerlModule My::Apache::Authen::Cookie
PerlHandler My::Apache::Authen::Cookie->logout


Finally there is a directory under my document root
called /logout/ which contains old Embperl scripts I'm
superceding with my handler (so would be found on a
FilesMatch).

The question I have is this.:-

When I visit /logout I get the following Dumped
information from my handler:-

$VAR1 = 'is_initial_req';
$VAR2 = '0';
$VAR3 = 'is_main';
$VAR4 = 1;
$VAR5 = 'main';
$VAR6 = undef;
$VAR7 = 'proxyreq';
$VAR8 = '0';

But when I visit /logout2 I get the following:-

$VAR1 = 'is_initial_req';
$VAR2 = 1;
$VAR3 = 'is_main';
$VAR4 = 1;
$VAR5 = 'main';
$VAR6 = undef;
$VAR7 = 'proxyreq';
$VAR8 = '0';

Why is is_initial_req consistently 0 for logout and
consistently 1 for logout2...

I tried swapping the order of the FilesMatch and the
Location configs in my httpd.conf but this made no
difference...

So can anybody clear up this mystery for me?

Kind regards

Marty




___ 
How much free photo storage do you get? Store your holiday 
snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com


Re: Module mod_log_config and custom Auth

2005-10-03 Thread Martin Moss
this doesnt seem to work. Here's the code

print STDERR "Username given = ". $investor3->name .
"\n";

$r->connection->user($investor3->name);
$r->user($investor3->name);

I'm definitely seeing correct username's in the
logs...  

We have EmbPerl installed... Can this have anything to
do with it?

Marty

--- Geoffrey Young <[EMAIL PROTECTED]> wrote:

> Martin Moss wrote:
> > All,
> > 
> > I'm looking to ensure that an Authenticated user's
> > username is logged in our logfiles, along with a
> > cookie string..  I've had a quick look through
> google
> > and I'm currently finding that I should use %u for
> > username, but this is appearing blank... What do I
> > need to set in my Custome Authentication Handler
> to
> > ensure the username gets recorded...
> 
> well, if you're using a custom authentication
> handler then you need to 
> set $r->user to whatever username you authenticated.
>  there are other 
> things you need to do as well, but that should solve
> your immeditate 
> problem.
> 
> HTH
> 
> --Geoff
> 






___ 
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail 
http://uk.messenger.yahoo.com


Module mod_log_config and custom Auth

2005-10-03 Thread Martin Moss
All,

I'm looking to ensure that an Authenticated user's
username is logged in our logfiles, along with a
cookie string..  I've had a quick look through google
and I'm currently finding that I should use %u for
username, but this is appearing blank... What do I
need to set in my Custome Authentication Handler to
ensure the username gets recorded...

Marty



___ 
To help you stay safe and secure online, we've developed the all new Yahoo! 
Security Centre. http://uk.security.yahoo.com


Re: Apache::DBI How tro tell if enabled

2005-09-30 Thread Martin Moss
:-) That seems to be the crux of it...
It is being loaded before DBI, however the escalating
number of DB connections we're observing tends to
disagree. I think someone has added a LoadModule
directive somewhere in the wrong place and that module
has a call to DBI.. I've managed to confirm
Apache::DBI debug level2 output wasnt' appearing in
the logs.. so it's definitely disabled... Fine tooth
comb time:-(

Cheers for all the help,

Marty


--- Perrin Harkins <[EMAIL PROTECTED]> wrote:

> On Thu, 2005-09-29 at 17:08 +0100, Martin Moss
> wrote:
> > So I presume that having done all this, and my
> logfile
> > remains blank, then it is not working? :-)
> 
> Make sure you load it before DBI (or any other
> module that will load
> DBI).
> 
> - Perrin
> 
> 




___ 
To help you stay safe and secure online, we've developed the all new Yahoo! 
Security Centre. http://uk.security.yahoo.com


Re: Apache::DBI How tro tell if enabled

2005-09-29 Thread Martin Moss
So I presume that having done all this, and my logfile
remains blank, then it is not working? :-)


--- Michael Peters <[EMAIL PROTECTED]> wrote:

> 
> 
> Martin Moss wrote:
> > All,
> > 
> > I'm trying to confirm whether Apache::DBI is
> running
> > on a server.. I can tell if it's loaded, using
> > perl-status, but I can't tell if it's running
> > correctly - e.g. intercepting calls to
> > DBI->connect/disconnect...
> > 
> > Can anybody give me a few pointers?
> 
> From mod_perl docs
>
(http://perl.apache.org/docs/1.0/guide/databases.html#Debugging_Apache__DBI)
> 
> If you are not sure if this module is working as
> advertised, you should
> enable Debug mode in the startup script
> 
> From the Apache::DBI docs:
> 
> To enable debugging the variable $Apache::DBI::DEBUG
> must be set. This
> can either be done in startup.pl or in the user
> script. Setting the
> variable to 1, just reports about a new connect.
> Setting the variable to
> 2 enables full debug output.
> 
> 
> -- 
> Michael Peters
> Developer
> Plus Three, LP
> 
> 




___ 
To help you stay safe and secure online, we've developed the all new Yahoo! 
Security Centre. http://uk.security.yahoo.com


Apache::DBI How tro tell if enabled

2005-09-29 Thread Martin Moss
All,

I'm trying to confirm whether Apache::DBI is running
on a server.. I can tell if it's loaded, using
perl-status, but I can't tell if it's running
correctly - e.g. intercepting calls to
DBI->connect/disconnect...

Can anybody give me a few pointers?

Marty



___ 
To help you stay safe and secure online, we've developed the all new Yahoo! 
Security Centre. http://uk.security.yahoo.com


Re: Multiple Handlers

2005-08-31 Thread Martin Moss
It doesn't seem to work... This was the original
solution I tried..

Here is the code:-

if (Apache->can('set_handlers'))
{
print STDERR "CAN PUSH HANDLERS OK\n";
}
else
{
print STDERR "CANNOT PUSH HANDLERS OK\n";
}
my $list = $r->get_handlers( 'PerlHandler' );
print STDERR "\n";
print STDERR Dumper($$,$0,$list);
print STDERR "===\n";
 $r->set_handlers( 'PerlHandler' =>
['My::Apache::User::Notification']);
 $r->handler('perl-script');
my $list2 = Apache->get_handlers( 'PerlHandler' );
print STDERR Dumper($$,$list,$list2);
print STDERR "==\n";



Here is the output I get in my logs:-

CAN PUSH HANDLERS OK
==
$VAR1 = 15253;
$VAR2 = '/www/common/conf/core/traps.conf';
$VAR3 = [
  'Embperl::handler'
];
==
$VAR1 = 15253;
$VAR2 = [
  'Embperl::handler'
];
$VAR3 = [
  'III::Apache::User::Notification'
];
==

==
15253 Apache::AuthenDBI request type = main

In Embperl::handler

So as you can see, the set_handlers seems to work...
But after the Authen stage has returned OK, the next
handler to take control is Embperl::handler...

Any Ideas?

Regards

Marty

--- Geoffrey Young <[EMAIL PROTECTED]> wrote:

> 
> 
> Martin Moss wrote:
> > Have an awful suspicion the book I used suggested
> > doing it the other way around? Would that make a
> > difference?
> > 
> > $r->handler('perl-script');
> > $r->set_handlers(PerlHandler => [ My::Handler ]);
> 
> none whatsoever.
> 
> keep in mind that you can only call set_handlers()
> during phases prior to
> the phase you're setting.  for example, you can't
> 
>   $r->set_handlers(PerlHandler => [ My::Handler ]
> 
> from within a PerlHandler, but you could from within
> a PerlAuthenHandler.
> 
> btw, I saw that you wanted to unshift handlers (as
> opposed to push). this is
> how you do that
> 
>   my $handlers =
> $r->get_handlers(`PerlFixupHandler');
>   $r->set_handlers(PerlFixupHandler => [`My::Bow',
> @$handlers]);
> 
> HTH
> 
> --Geoff
> 






___ 
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail 
http://uk.messenger.yahoo.com


Re: Multiple Handlers

2005-08-31 Thread Martin Moss
Have an awful suspicion the book I used suggested
doing it the other way around? Would that make a
difference?

$r->handler('perl-script');
$r->set_handlers(PerlHandler => [ My::Handler ]);

Marty


--- Geoffrey Young <[EMAIL PROTECTED]> wrote:

> 
> 
> > I originally tried using $r->set_handlers. in my
> > PerlAuthenHandler. But this made absolutely no
> > difference to the current request... 
> 
> if you want to set_handlers() for the PerlHandler
> phase you need two calls
> 
>   $r->set_handlers(PerlHandler => [ My::Handler ]);
>   $r->handler('perl-script');
> 
> HTH
> 
> --Geoff
> 




___ 
To help you stay safe and secure online, we've developed the all new Yahoo! 
Security Centre. http://uk.security.yahoo.com


Multiple Handlers

2005-08-31 Thread Martin Moss
All,

I'm trying to make something work in mod perl, and all
the docs seem to be pointing me in ways which just
don't work on our system...

Server version: Apache/1.3.33 (Unix)
SunOS 5.9
perl, v5.8.6

I wish to have a handler which sits after the
Authentication stage, which can choose whether to
display a HTML page instead of the originally
requested page.. 
The originally requested page will usually be served
via Embperl, or a method handler..

I originally tried using $r->set_handlers. in my
PerlAuthenHandler. But this made absolutely no
difference to the current request... 
e.g. if did a get_handlers call before and after using
set_handlers, it clearly showed me the handlers I'd
set using set_handlers, but apache ignored this and
carried on serving it's original get_handlers()
anyway.. 

I found many different people reporting bugs in the
set_handlers mechanism and push_handler (which worked
but couldn't help me as what I wanted to do was
unshift (not push) the handlers).

So I tried defining two handlers for the same request,
the first one my custom handler, the second one
Embperl as normal. Now when my custom handler returns
DECLINE the page requested displays
normally.GREAT:-)... 

But when my custom handler actually serves a page, and
returns OK, I actually see the custom handler page
being served, and then the original requested page
appears below with a load of headers and server error
messages  So basically BOTH handlers are being
called

Now, I was under the impression (but could be wrong)
that if 2 content PerlHandlers are defined for a
request, then if the first one returns OK then the
second handler doesn't get called, but if it returns
DECLINED then the second one gets called...

Can anybody throw some light on this? 
Why doesn't set_handlers (used in the
PerlAuthenHandler phase) allow me to define the
PerlHandler for the content phase?

How do I prevent other handlers (independant of my
custom handler) from being run if my Custom handler
decides to serve a page...

Kind regards

Marty








___ 
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail 
http://uk.messenger.yahoo.com


mod_define apache2

2005-08-17 Thread Martin Moss
All,

We're in the middle of centralising our apache (1.3)
config files and I would like to use mod_define to
simplify the process. However I've noticed that
mod_define isn't available for apache2. 

Is there an alternative I can use, or is mod_define's
functionality now core to mod_perl2?

Regards

Marty





___ 
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail 
http://uk.messenger.yahoo.com


Re: Getting lots of redefined statements in the error_log

2005-06-20 Thread Martin Moss
Can you confirm you have the same version of Perl on
both systems?

I've seen these errors on perl 5.8 after upgrading
from perl 5.005

Marty

p.s. I still have them too, so any help with this
issue would be useful to me too...

--- Boysenberry Payne <[EMAIL PROTECTED]>
wrote:

> Here is a sample of a long list:
> 
> [Fri Jun 17 15:17:19 2005] Unix.pm: Subroutine _cwd
> redefined at 
>
/usr/lib/perl5/5.8.0/i386-linux-thread-multi/File/Spec/Unix.pm
> line 
> 470.
> [Fri Jun 17 15:17:19 2005] Carp.pm: Subroutine
> import redefined at 
> /usr/lib/perl5/5.8.0/CGI/Carp.pm line 289.
> 
> This only happens on our external server (currently
> being tested and 
> set up.)  I didn't set it up, otherwise I would
> offer config settings.
> 
> It doesn't happen on my local system when I run the
> same script.  I'm 
> not sure why I'm getting all of these redefined
> errors.
> I thought maybe someone here would know what's going
> on
> 
> Thanks,
> Boysenberry
> 
> This message contains information that is
> confidential
> and proprietary to Humaniteque and / or its
> affiliates.
> It is intended only for the recipient named and for
> the express purpose(s) described therein.
> Any other use is prohibited.
> 
> http://www.habitatlife.com
> The World's Best Site Builder
> 
> 




___ 
How much free photo storage do you get? Store your holiday 
snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com


to ENV or not to ENV

2005-05-18 Thread Martin Moss
All,

We're in the process of introducing mod perl method
handlers and template toolkit into a system which is
also running Embperl. There is some interaction
between the two, and as Embperl (and especially our
code which uses it) uses %ENV to pass around variables
like $ENV{REMOTE_USER_ID} and other useful things I
wanted to get some views on the use of %ENV in this
form.

I was under the impression that using %ENV is a bad
thing to do.. mod perl provides PerlSetVar to set
variables for mod_perl within conf files... But when a
variable isn't set in a conf file, but in an embperl
script, the way I see it there are several ways to
transfer data between the two systems.

1) using %ENV
2) setting using our own subclass of Apache::Request's
pnotes or notes methods
3) Passed as parameters between them all
4) stored and retrieved through a session store
5) stored in cookies

I think that the whole thing comes down to the first
2... the last few are too impractical (given an
already existing code set) as a generic method... 

I believe that using %ENV opens up the system to bad
coding problems, e.g. writing a backend module for DB
interaction and then slipping in a call to %ENV for
some front end user information. I also believe there
has been some discussion on this list a while ago,
which came out in favour of not using %ENV at all if
it can be helped But I can't remember why this was
a bad thing...?

I favour using Apache::Request's pnotes, notes and
dir_config methods for acheiving all of this using
methods as wrappers to the information required

So can anybody shed some light on this pros/cons
discussion?

Kind regards

Marty





___ 
Yahoo! Messenger - want a free and easy way to contact your friends online? 
http://uk.messenger.yahoo.com


RE: slightly OT - defining variables in httpd.conf for use in httpd.conf

2005-04-07 Thread Martin Moss
mod_define!

Thats the one

I can't believe I didn't find a link to in when
searching google for

'dynamic variables httpd.conf'

Ah well 

Thanks for that,

regards

Marty


--- "Reed, Jonathan" <[EMAIL PROTECTED]> wrote:
> We set them in Section 2 of the httpd.conf after the
> DocumentRoot like this:
> 
> SetEnv ORACLE_HOME "/opt/home/oracle/product/8.1.7"
> 
> -Jon Reed
> 
> 
> -Original Message-
> From: David Wright [mailto:[EMAIL PROTECTED]
> Sent: Thursday, April 07, 2005 10:08 AM
> To: modperl
> Subject: Re: slightly OT - defining variables in
> httpd.conf for use in
> httpd.conf
> 
> 
> > I know I've seen this done before, but I'd like to
> > define a variable at the top of my httpd.conf
> file,
> > and then use it many times throughout the conf
> file...
> >
> > e.g.
> >
> > define Server='fred'
> >
> > DocumentRoot /usr/local/${server}
> >
> > I just can't find any info on this... Can anybopdy
> > point me at the right place..
> 
> mod_macro or mod_define look like they might be
> useful to you:
> 
> http://www.cri.ensmp.fr/~coelho/mod_macro/
> http://www.lpi.msk.su/mod/mod_define.html
> 
> 
> cheers,
> dave
> 

Send instant messages to your online friends http://uk.messenger.yahoo.com 


slightly OT - defining variables in httpd.conf for use in httpd.conf

2005-04-07 Thread Martin Moss
All,

I know I've seen this done before, but I'd like to
define a variable at the top of my httpd.conf file,
and then use it many times throughout the conf file...

e.g. 

define Server='fred'

DocumentRoot /usr/local/${server}

I just can't find any info on this... Can anybopdy
point me at the right place..

All I find in google is how to use PerlSetVar, which
isn't what I'm trying to do...

Regards

Marty

Send instant messages to your online friends http://uk.messenger.yahoo.com 


Re: Authentication problem

2005-04-07 Thread Martin Moss
Hi,

what's your MaxClients setting in your apache conf?

It could just be that you aren't running enough apache
child processes to serve the number of connections
being made,

Regards

Marty


--- "Levi E. Stanley" <[EMAIL PROTECTED]>
wrote:
> Hi,
> 
> Been seeing problems with an Authenticate script
> lately.  It was working 
> fine up to the time I started getting slammed with
> traffic.  I don't see 
> any connection problems in the log file at all.  But
> what I have noticed 
> on the site is, I will click to go to download a
> file from the secure 
> area, and it won't prompt me for a username and
> password until minutes 
> later, like it is being delayed or something.  Is
> this normal behavior 
> from high traffic? 
> 
> More Info:
> 
> The server isn't even being over worked, it has 4
> cpus and on high 
> traffic hours, it is around 2 on cpu load.  So it
> can only be two 
> possibilities, the script or apache configuration. 
> The apache version I 
> am using http-2.0.53, and mod_perl-2.0.0-RC4.
> 
> Here is the code:
> 
> package My::Authenticate;
> 
> use strict;
> use ModPerl::Util ();
> use Apache::Const qw(OK DECLINED AUTH_REQUIRED);
> use Apache::Log;
> use DBI;
> 
> sub handler{
> my $r = shift;
> my $s = Apache->server;
> 
> return Apache::DECLINED unless
> $r->is_initial_req;
> 
> my ($status,$password) =
> $r->get_basic_auth_pw;
> my $username = $r->user;
> 
> return $status unless $status == Apache::OK;
> 
> my $hostname = $r->hostname;
> $hostname=~/(.*?\.)?(.*?)\.[a-z]{3}$/;
> my $table_access = $2."_access";
> my $dbh = 
>
DBI->connect('DBI:mysql:database=site_authentication;host=xxx.xxx.xxx.xxx','xxx','xxx');
> my $rs = $dbh->prepare("select 1 from
> $table_access where 
> username='$username' and passwd='$password'");
> $rs->execute;
> my ($result) = $rs->fetchrow_array;
> $rs->finish();
> $dbh->disconnect();
> 
> if ($result){
> return Apache::OK;
> }
> 
> $r->note_basic_auth_failure;
> return Apache::AUTH_REQUIRED;
> }
> 
> 1;
> 
> Any assistance on this issue would be greatly
> appreciated.
> 

Send instant messages to your online friends http://uk.messenger.yahoo.com 


Re: shared memory

2005-03-15 Thread Martin Moss

--- André Warnier <[EMAIL PROTECTED]> wrote:
> Jonathan Vanasco wrote:
> > 
> > look into memcached -- http://danga.com/memcached/
> 
> Thank you for the link, I didn't know that module,
> and I'll keep it in 
> mind for some other projects.
> But it is slightly off the mark as far as the issue
> below is concerned.
> Maybe it was my mentioning "data in tables" that was
> confusing.  My 
> problem is not to speed up database access, it is to
> share data (stored 
> in memory tables, or say arrays) between Apache
> children/threads.
> 

I haven't used Memchache yet, but it has nothing to do
with databases
It CAN be used to prevent database load, OR it could
be used to prevent too much access to flocking
files...
Consider the Example at the top of that link

sub get_foo_object {
   my $foo_id = int(shift);
   my $obj = $::MemCache->get("foo:$foo_id");
   return $obj if $obj;

   $obj = $::db->selectrow_hashref("SELECT  FROM
foo f, bar b ".
   "WHERE ... AND
f.fooid=$foo_id");
   $::MemCache->set("foo:$foo_id", $obj);
   return $obj;
}


your subroutine would be

sub get_foo_object {
   my $foo_id = int(shift);
   my $obj = $::MemCache->get("foo:$foo_id");
   return $obj if $obj;

   #
   #get $obj from your flocked file mechanism that you
are already using...
##
   
$obj=get_from flockfiles($foo_id)


   $::MemCache->set("foo:$foo_id", $obj);

return $obj;
}

It depends on how you've implemented the existing
mechanism I guess The above seems expect
instantiated Objects...

Personally I'm curious as to why you don't want to use
a database

Regards

Marty


Send instant messages to your online friends http://uk.messenger.yahoo.com 


Board down? Test email

2005-03-13 Thread Martin Moss
Is anybody else having problems posting?

I posted a message on Monday, it still hasn't arrived,
now I just get undeliverables

Marty

Send instant messages to your online friends http://uk.messenger.yahoo.com 


Re: End result of Wiki-ish system design + final question

2005-02-14 Thread Martin Moss
Hi Ben,

I have a few thoughts on this... In my experience
writing a daemon process is easy (well ish) but then
configuring your system to manage them (have they
died, have they crashed etc..) is more trouble than
its worth.

Is it possible to use some kind of cronjob based
system, which runs a script every minute, picks up a
list of things to process from say a database (which
your Handler writes to, to communicate to the backend
processes)... Of course a lockfile mechanism would
need to be used to ensure only one cronjob script runs
at any one time...

Regards

Marty


 --- ben syverson <[EMAIL PROTECTED]> wrote: 
> 
> On Feb 12, 2005, at 9:44 PM, ben syverson wrote:
> 
> > Maybe the solution is to have 5 or 10 perl
> processes fire up and stay 
> > open as daemons, processing these background regen
> requests?
> 
> After testing this, that looks like the way to go.
> The regen code now 
> lives as a pre-forking server, accepting connections
> via either TCP or 
> UN*X socket. This opens up the interesting
> possibility of dedicating a 
> server (or multiple servers) just to the
> regeneration process.
> 
> - ben
> 
>  





___ 
ALL-NEW Yahoo! Messenger - all new features - even more fun! 
http://uk.messenger.yahoo.com


Sanity check on mod_rewrite and POST data [slightly OT]

2005-02-04 Thread Martin Moss
All,

Can I get a sanity check on this:-

I have a form which POSTs to https://server/url
That https servers uses mod_rewrite to forward the
request onto another server internally as
http://server/url

However after the rewrite, the POST data is lost. Can
anybody throw any light on this?

the rewrite rule is this:-

RewriteRule ^(.*)$ http://%{HTTP_HOST}$1 [R]

As a side question, can anybody tell me if a https GET
request would encrypt the parameters passed?

Regards

Marty









___ 
ALL-NEW Yahoo! Messenger - all new features - even more fun! 
http://uk.messenger.yahoo.com


Re: [mp1] Method handler that eventually seems to "forget" it's a method handler

2005-02-02 Thread Martin Moss
I tried ->handler in my configs, made no difference. 
I was doing a 'require' in a startup script if that
makes any difference. Haven't seen this issue with
simillar code anywhere else..

Marty

 --- Geoffrey Young <[EMAIL PROTECTED]> wrote:

> 
> > 
> > PerlTransHandler MyApp::MyInstall::Dispatcher
> 
> make that
> 
> PerlTransHandler
> MyApp::MyInstall::Dispatcher->handler
> 
> and see if that helps.  you should also be
> preloading via
> 
>   PerlModule MyApp::MyInstall::Dispatcher
> 
> or in a startup.pl.
> 
> HTH
> 
> --Geoff
>  





___ 
ALL-NEW Yahoo! Messenger - all new features - even more fun! 
http://uk.messenger.yahoo.com


Re: [mp1] Method handler that eventually seems to "forget" it's a method handler

2005-02-02 Thread Martin Moss
I've seen this problem and never got to the bottom of
it, on a redhat box with 5.8.3 (I think) and same
apache and mod_perl,

Marty




 --- Andrew Green <[EMAIL PROTECTED]> wrote: 
> Hi,
> 
> I seem to have a bizarre problem with method
> handlers on my setup.  I 
> have a set of different handlers, all of which are
> method handlers so 
> that I can easily inherit shared code across a
> collection of different 
> installations of my application on the same server.
> 
> The first handler to get invoked is a
> PerlTransHandler -- everything 
> works fine (or at least seems to) for quite some
> time, but then the 
> handler begins "forgetting" that it's a method
> handler, and instead of 
> the class being passed before $r, $r becomes the
> first thing passed.  
> At least, that seems to be what's happening.  Is
> this a known problem?
> 
> My setup is as follows:
> 
>Perl 5.8.0 (Red Hat EL 3 default)
>Apache/1.3.29
>mod_perl/1.29
> 
> 
> Here's what I imagine to be the relevant bits of
> httpd.conf:
> 
>   MinSpareServers 10
>   MaxSpareServers 20
>   StartServers 10
>   MaxClients 60
>   MaxRequestsPerChild 1000
>   ...
>   
>   PerlTransHandler MyApp::MyInstall::Dispatcher
>   ...
> 
> 
> Here's the relevant bits of Dispatcher.pm:
> 
>   package MyApp::MyInstall::Dispatcher;
> 
>   use strict;
>   use Apache::Constants qw(OK DECLINED NOT_FOUND
> REDIRECT FORBIDDEN);
>   use Apache::URI;
> 
>   our @ISA = qw(MyApp::Core::Dispatcher);
> 
>   1;
> 
>   
> 
>   sub handler ($$) {
> 
>   my ($class,$r) = @_;
>   return DECLINED unless ($r->is_initial_req());
>   ...
> 
> 
> And here's the error (that only starts appearing
> after the server's 
> been running for a while:
> 
>   Can't call method "is_initial_req" on an undefined
> value...
> 
> The error then points to the line quoted above.  Of
> course, Apache 
> never gets to other handlers later in the sequence,
> so I can't easily 
> see whether the problem is limited to TransHandlers,
> or whether all my 
> method handlers would stop acting as such. 
> Restarting the server makes 
> the problem go away -- for a while!
> 
> I'd really like to avoid having to upgrade/change
> Perl or mod_perl if 
> at all possible.  Nonetheless, any help, advice or
> guidance anyone can 
> provide would be very much appreciated.
> 
> Cheers,
> Andrew.
>  





___ 
ALL-NEW Yahoo! Messenger - all new features - even more fun! 
http://uk.messenger.yahoo.com


Re: Mac::Glue and mod_perl

2005-01-14 Thread Martin Moss
please forgive the really daft question, but have done
a complete server shutdown and restart?

I've come across bus errors before where a complete
server restart made the problem go away and never come
back...

Marty


 --- Brian Dimeler <[EMAIL PROTECTED]> wrote: 
> Sorry for cross-posting this, but i think it applies
> to both groups.
> 
> I'm trying to write a mod_perl script (for PerlRun)
> that will present an 
> online interface to my Mac OS X Address Book. Using
> the standard method 
> of connecting to the glue (new Mac::Glue 'Address
> Book') doesn't work; 
> the webserver complains about not being able to
> connect to a window 
> server. So, I'm using Remote Apple Events instead
> (yes, I remembered to 
> turn them on in System Preferences):
> 
> my $book = new Mac::Glue 'Address Book',
>   eppc => 'Address Book',
>   'mac8.local' # hosts both the webserver +
> addressbook
>   undef, undef, # uid & pid omitted
>   'Mac8', 'mypass' # Mac8 is the Admin user & owner
> of addressbook
> 
> This line apparently causes the server child process
> to exit:
> 
> [Fri Jan 14 11:02:40 2005] [notice] child pid 6070
> exit signal Bus error 
> (10)
> 
> However, it works if I run it in a Terminal window
> (the remainder of the 
> script successfully prints out a list of address
> groups). It even works 
> when run in a Terminal window in a different,
> non-admin user account, as 
> long as I include the admin username and pass, as
> above.
> 
> So, does anyone know why it's causing a "bus error"
> when I try to run it 
> in the webserver? Is there a workaround?
> 
> Brian
> 
>  





___ 
ALL-NEW Yahoo! Messenger - all new features - even more fun! 
http://uk.messenger.yahoo.com


Re: Overriding PerlAuthenHandler in sub-directories

2005-01-10 Thread Martin Moss
I was looking into this a while back, and came across
several posts that described using a PerlAccessHandler
to determine if PerlAuthenHandler should be set or
not.

You could then setup PerlSetVar Require_Auth '0' in
any sublocations that didn't need Auth. your
AccessHandler would then do a set-handlers call and
get it to return OK for an AuthHandler (I've tried to
dig out the syntax but I can't find it)..

I tried it briefly and couldn't get it to work at all,
but I got the impression that this was down to the
really quirky setup I was trying to do it on.

Anyway not much help, but perhaps give you something
to search google on,

Marty

 --- Ferrari Geoffrey
<[EMAIL PROTECTED]> wrote: 
> Hi Sean,
> 
> adding a .htaccess file might help, but I'm looking
> to see if there 
> isn't a better solution. The main problem is that
> /foo/bar will 
> actually be a virtual location, that is, it will be
> controlled by a 
>  directive in httpd.conf and will call the
> script to check 
> the user's name and password. As such, /foo/bar will
> not actually map 
> to a sub-directory on disk.
> 
> Second, the question arises what exactly would go
> into the .htaccess 
> file? Presumably, if a PerlAuthenHandler can be
> overridden for a 
> subdirectory using a .htaccess fie, there must be
> way to override it 
> directly in httpd.conf.
> 
> Thanks for the suggestion, though.
> 
> Geoffrey
> 
> 
> On 10 Jan 2005, at 13:30, Sean Davis wrote:
> 
> > Does adding a .htaccess file to /foo/bar help your
> situation?
> >
> > Sean
> >
> > On Jan 10, 2005, at 7:56 AM, Ferrari Geoffrey
> wrote:
> >
> >> Hi,
> >>
> >> If I have activated a PerlAuthenHandler for a
> directory in httpd.conf 
> >> with
> >>
> >> 
> >> ...
> >> PerlAuthenHandler My::Handler
> >> 
> >>
> >> How can I deactivate this PerlAuthenHandler for a
> subdirectory, such 
> >> as /foo/bar ?
> >>
> >> The online mod_perl docs explain that
> PerlHandlers can be deactivated 
> >> for subdirectories by setting PerlHandler
> default-handler (when 
> >> SetHandler has been set to perl-script), but
> either my problem lies 
> >> elsewhere, or it is not possible to have:
> >>
> >> 
> >> 
> >> PerlAuthenHandler default-handler # nor
> indeed 
> >> 'PerlAuthenHandler none'
> >> .
> >>
> >> All advice gratefully received. (I'm trying to
> set up authentication 
> >> using Apache::AuthCookie. Since I want to avoid
> clunky URLs like 
> >> www.example.com/protected/... I want to activate
> authentication for 
> >> the root directory. The only problem is that the
> login form where the 
> >> user types in his username and password has to be
> submitted to a 
> >> location below root (e.g. /LOGIN), which of
> course, can't be done 
> >> until the user has logged in...)
> >>
> >> Regards,
> >>
> >> Geoffrey Ferrari
> >
> >
> 
>  





___ 
ALL-NEW Yahoo! Messenger - all new features - even more fun! 
http://uk.messenger.yahoo.com


Re: Apache::DBI

2005-01-09 Thread Martin Moss
> > Is PerlSetVar the best way to pass values from
> httpd.conf to perl
> > securely?
> 
> It's a good way, although there are plenty of
> others.  I use a separate
> config file usually.
> 

For what it's worth I use both. I keep 'site wide'
configuration vales in a Config file/module (usually
Backend DB access modules) and then 'location
specific' values in PerlSetVar's in each 
I find this the most adaptable and maintainable.

regards,

Marty





___ 
ALL-NEW Yahoo! Messenger - all new features - even more fun! 
http://uk.messenger.yahoo.com


Re: sessions:THANK YOU!

2005-01-06 Thread Martin Moss
I didn't get chance to reply, and the others covered
everything, but the point of Apache::Session is that
you don't need to store ANY data other than a
session_id in a hidden field or in a cookie... 

All of the rest of the data you need gets stored
locally on the server side. Much more secure.

Marty


 --- [EMAIL PROTECTED] wrote: 
> Thank you all who replied to my session state
> question.
> 
> Well it doesn't really bother me that I store data
> in cookies or hidden
> fields, but I want the best, fastest, and slickest
> solution I can create.
> And always keen to learn new stuff, and I want to
> improve my coding all
> the time, that's why I asked.
> 
> And to Sean special thank's, your code's gonna be
> useful. *S*
> 
> :-)
> 
> over and out.
> Greger
> --
> http://www.gh-webinteractive.com
> 
> 
> 
> 
> 
>  





___ 
ALL-NEW Yahoo! Messenger - all new features - even more fun! 
http://uk.messenger.yahoo.com


Re: HTML::Embperl + mod_perl + segfault

2004-12-15 Thread Martin Moss
I upgraded to the latest version of Embedperl and ran
the same code from my previous post. IT no longer
segfaults but I get the following error... 

Embperl::Execute({ 
 req_rec=>$r,
 inputfile=>$file,
 param =>[$params],
 output => \$html
 });


and I get the following error:-

Error in Perl code: Can't call method "headers_in" on
an undefined value at

Which is $req_rec.
It's undef.

I tried this without the req_rec=>$r too and it made
no difference.
Any ideas? Is it related to
http://www.gossamer-threads.com/lists/modperl/embperl/14815#14815

Regards

Marty

 --- Gerald Richter <[EMAIL PROTECTED]> wrote: 
> >I'm getting segfaults on every page request I make
> to a mod_perl handler
> thats running under >HTML::Embedperl. We're trying
> to migrate away from
> Embperl as fast as possible, but whenever >I call
> HTML::Embperl::Execute in
> my code more than 4 or 5 times I get seg
> faults..
> 
> 
> Embperl has no problems with mod_perl 1 and Perl
> 5.6. It seems like the
> versions you use are not fit together.
> 
> Make sure that Perl, mod_perl, Embperl and Apache
> are build with the same
> compiler and the same settings. 
> 
> Such problem will occur if you have compiled Embperl
> (or mod_perl) with
> differnet compiler settings or for a different Perl
> binary, than the one you
> are actually using.
> 
> Gerald
> 
> 
> -- 
> Report problems: http://perl.apache.org/bugs/
> Mail list info:
> http://perl.apache.org/maillist/modperl.html
> List etiquette:
> http://perl.apache.org/maillist/email-etiquette.html
> 
>  



___ 
Win a castle for NYE with your mates and Yahoo! Messenger 
http://uk.messenger.yahoo.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Re: ... and startup.pl equivalent?

2004-12-13 Thread Martin Moss
Hi Colin,

just my opinion, but from a 'practicalities' point of
view, as startup.pl gets more complex (your site grows
larger, you wish to do more intricate mod_perly
things), you will find that it is a distinct advantage
to run it from the command line in the debugger. you
wouldn't be able to do this if you buried all your
perl in the apache configs...

I'm sure there's many more reasons to keep your
startup script outside of the http configs, usually
it's because it's only neat and tidy to begin with
embedding your perl into your configs, but as your
site configs get larger, you'll probably start
thinking it a better idea to put all your 
sections in their own seperate httpd conf file, which
might as well be a startup.perl script..

Marty

 --- colin_e <[EMAIL PROTECTED]> wrote: 
> Platforms: Solaris 9, Win XP
> Apache: 2.0.52
> Perl: ActiveState Perl 5.8.4
> 
> Hi Guys,
> New to Apache 2.0.52 and modperl, working
> through the install and 
> configure steps.
> 
> Most books and docs on using modperl recommend using
> a "startup.pl" script
> to configure the Perl environment on startup,
> setting lib paths etc.  
> However, Apache now
> supports  ... sections directly in the
> Apache config files.
> 
> In a normal perl script, a chunk of code brought in
> with "require" is 
> exactly the same as a
> block inline within the the main routine.
> 
> Queastion- is this the same in Apache? I.e, instead
> of using a 
> startup.pl file can I include all the perl
> configuration inline in httpd.conf inside
>  blocks, with the 
> same effect? Logically
> it would seem so, but the apache docs also say
> variables in the  
> blocks go away after use,
> so it's unclear whether oeprations like "use lib
> " would have an effect.
> 
> Regards: Colin
> 
> -- 
> Report problems: http://perl.apache.org/bugs/
> Mail list info:
> http://perl.apache.org/maillist/modperl.html
> List etiquette:
> http://perl.apache.org/maillist/email-etiquette.html
> 
>  





___ 
ALL-NEW Yahoo! Messenger - all new features - even more fun! 
http://uk.messenger.yahoo.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



HTML::Embperl + mod_perl + segfault

2004-12-13 Thread Martin Moss
All,

I'm getting segfaults on every page request I make to
a mod_perl handler thats running under
HTML::Embedperl. We're trying to migrate away from
Embperl as fast as possible, but whenever I call
HTML::Embperl::Execute in my code more than 4 or 5
times I get seg faults..

perl 5.6, apache 1.3.33... 

I realise that this is one of those 'needle in a
haystack emails' but I was wondering if anybody has
any experience  running HTML::Embperl who may have
seen this sort of thing before.. I know that the code
I'm using doesn't segfault when I ran it on a
different machine - one I'd built myself and it was
running under perl 5.8.5.

[Mon Dec 13 18:25:16 2004] [notice] child pid 24141
exit signal Segmentation Fault (11)

We can't upgrade to perl 5.8 as some of the legacy
code we have just breaks - (think code written 5 years
ago, without the concept of use strict).

I've tried looking at the embedperl scripts that are
being called, and no matter which ones I comment
out,(remove possibility that it's some component
within the embperl thats causing it) it's always the
5th or 6th script being run that causes the segfault..

Marty





___ 
ALL-NEW Yahoo! Messenger - all new features - even more fun! 
http://uk.messenger.yahoo.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: Urgent justification for perl

2004-11-22 Thread Martin Moss
Big thanks to everyone for the links and tips.

Sorry for the ambiguous question, but was just passing
on the ambiguity, to see which way you guys took it,
as I was also annoyed at the ridiculousness of the
question...

Kind regards

Marty

 --- Matt Sergeant <[EMAIL PROTECTED]> wrote: 
> On 19 Nov 2004, at 12:35, Martin Moss wrote:
> 
> > I've had an urgent request for a few paragraphs on
> the
> > justification for the use of perl. In particularly
> > mod_perl.
> >
> > Someone in the powers that be read an outdated
> > description and thinks that using perl is a
> security
> > risk - (I know, its not what you use, but how you
> use
> > it thats the security concern).
> >
> > Any ideas?
> 
> We're a global security company. We scan email for
> spam and viruses for 
> some places you may have heard of, like the UK
> government and the US 
> Federal Reserve. About 50% of everything we do is in
> perl (including 
> mod_perl/AxKit for our quarantine system). We're
> also BS/ISO-7799 if 
> that's the sort of thing your powers that be need to
> hear.
> 
> Does that help?
> 
> Matt.
> 
> 
> -- 
> Report problems: http://perl.apache.org/bugs/
> Mail list info:
> http://perl.apache.org/maillist/modperl.html
> List etiquette:
> http://perl.apache.org/maillist/email-etiquette.html
> 
>  



___ 
Moving house? Beach bar in Thailand? New Wardrobe? Win £10k with Yahoo! Mail to 
make your dream a reality. 
Get Yahoo! Mail www.yahoo.co.uk/10k

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Urgent justification for perl

2004-11-19 Thread Martin Moss
All,

I've had an urgent request for a few paragraphs on the
justification for the use of perl. In particularly
mod_perl.

Someone in the powers that be read an outdated
description and thinks that using perl is a security
risk - (I know, its not what you use, but how you use
it thats the security concern). 

Any ideas?

Marty



___ 
Moving house? Beach bar in Thailand? New Wardrobe? Win £10k with Yahoo! Mail to 
make your dream a reality. 
Get Yahoo! Mail www.yahoo.co.uk/10k

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Re: Authentication using https

2004-11-12 Thread Martin Moss
Cheers Fellas, this was the bit I was concerned about.

Apache::AuthCookie, looked a little bloated to me,
however I'm a big fan of only inventying new types of
wheels not old so I'll revisit...

Regards

Marty


 --- Michael J Schout <[EMAIL PROTECTED]> wrote: 
> On Wed, 10 Nov 2004, Skylos wrote:
> 
> > it could go...
> >
> > -> GET content from myserver port 80
> > <- 403 errordocument login form
> > -> POST credentials to myserver port 443
> > <- Location http://myserver/content
> > <- Set-Cookie: ticket=gooduser; Domain=myserver;
> Path=content;
> > -> GET content from myserver port 80
> > <- 403 errordocument login form
> >
> > And the question would be... Why would the browser
> say GET without the
> > cookie attached?
> >
> > It could be... because it didn't get the cookie
> from myserver:80 - it
> > got it from myserver:443 - and the security
> settings of the browser
> > say, 'enable only for the originating web server'
> 
> The port numbers do not matter at all.  There are a
> number of things you
> need to be aware of for cookies to work properly in
> this scenario.
> 
> - If you want the cookie to be presented over
> non-SSL connections, you
>need to make sure that AuthNameSecure is not
> turned on in AuthCookie.
>The "Secure" setting tells the browser to only
> send the cookie over
>SSL connections.
> 
> - If your using MSIE, you also need to properly
> create a P3P policy,
>otherwise MSIE might not return the cookie
> (depending on security
>settings).  The way you create a P3P policy is
> beyond the scope of
>this email.  In AuthCookie you can do this with
> something like:
> 
>PerlSetVar AuthNameP3P "CP=\"ALL DSP ...\""
> 
>but you need to read up on P3P to know what the
> value should be.
> 
> But there is no problem issuing cookies on HTTPS and
> having the browser
> return them over non SSL provided that the "Domain"
> paramter of the
> cookie is properly set, and the "Secure" setting is
> turned off.
> 
> Regards,
> Michael Schout
> 
> -- 
> Report problems: http://perl.apache.org/bugs/
> Mail list info:
> http://perl.apache.org/maillist/modperl.html
> List etiquette:
> http://perl.apache.org/maillist/email-etiquette.html
> 
>  





___ 
Moving house? Beach bar in Thailand? New Wardrobe? Win 10k with Yahoo! Mail to 
make your dream a reality. 
Get Yahoo! Mail http://uk.mail.yahoo.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Authentication using https

2004-11-10 Thread Martin Moss
All,

I'm about to replace the authentication mechanism that
our web site uses. However I wanted to sanity check my
thought process. 

Is it possible to have an Authen handler sitting on
certain areas of a site, and if a user isn't logged in
(i.e. doesn't have an auth session cookie) we present
them with a form. (I can do this, but the next bit is
new to me). Then when they send their details, i.e.
username and password, they go over an SSL connection,
which provided they are correct, then shows the page
the user originally wanted? 

Basically I have a mechanism working that does this
without the SSL, but can I update it to use an SSL
connection for the login form submit?

Marty





___ 
ALL-NEW Yahoo! Messenger - all new features - even more fun! 
http://uk.messenger.yahoo.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Re: Protecting against Cookie copying

2004-11-08 Thread Martin Moss
Thanks everyone. You've done a good job of assuring me
that I haven't missed the whole point of the way these
things work. 

There's been some really useful ideas, suggested and
I'm going to have a think about which, if any, are
worth implementing.

Ultimitely I'm upgrading our site from normal Basic
authentication, which sends username and password
unencrypted anyway, so compared to that the security
upgrade is still a big increase!

Marty





 --- Sam Tregar <[EMAIL PROTECTED]> wrote: 
> On Mon, 8 Nov 2004, Martin Moss wrote:
> 
> > I'm looking into ways of uniquely identifying a
> > computer.
> 
> Intel tried to implement this a while back with a
> unique ID in the
> CPU.  The public was not ammused.  If you do find a
> way, please tell
> us so we can find a workaround.
> 
> > What I wish to do is prevent another user copying
> the
> > session cookie, from one computer to another, and
> then
> > gaining access.
> 
> You can get close by using a very short session
> timeout, tying the IP
> to the cookie and putting a serial number on each
> form.  I believe
> this is what my bank does.  Sure, the IP can be
> spoofed or shared, and
> hackers can automate systems to defeat the timeouts
> and serial
> numbers, but it definitely raises the bar.  As an
> added bonus, the
> serial numbers also help with the ubiquitous
> catastrophe which is the
> back button.
> 
> -sam
> 
> -- 
> Report problems: http://perl.apache.org/bugs/
> Mail list info:
> http://perl.apache.org/maillist/modperl.html
> List etiquette:
> http://perl.apache.org/maillist/email-etiquette.html
> 
>  





___ALL-NEW Yahoo! 
Messenger - all new features - even more fun! http://uk.messenger.yahoo.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Protecting against Cookie copying

2004-11-08 Thread Martin Moss
All,

I'm looking into ways of uniquely identifying a
computer. I've been reading around the web looking at
different mechanisms, and so far I've drawn a fuzzy
blank. Currently, I want to use SSL to let a user sign
in and then I return a session cookie, which I then
use to confirm the user is logged in when they come to
non-ssl pages. 

What I wish to do is prevent another user copying the
session cookie, from one computer to another, and then
gaining access. Originally I wondered if I could get
at the mac address of the connection, but that seems
to be a dead end. After a little further reading It
seems that there is a UUID generated at the handshake?
stage of SSL, so therefore I wonder if I can use this,
e.g. map my session_id to a UUID, and then when I
check the session is valid I crosscheck this, however
I'm not sure if I can get the UUID over a non-SSL
connection. 

I'm sure I'm not the first person to want to uniquely
identify a computer that comes to my site, without
blindly trusting cookies, but I'm at a loss of how to
find anything better than ipaddress to session cookie
mapping. (which is kinda pointless for Natted
addresses I know).

Does anybody have any ideas, pointers...?

Regards

Marty







___ALL-NEW Yahoo! 
Messenger - all new features - even more fun! http://uk.messenger.yahoo.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



RE: Request methods not found

2004-11-02 Thread Martin Moss
Having Just re-read your reply, (don't ask, waiting
for a machine sync to finish, bored...!) I noticed
that you said you didn't get an apache Object at all.

This is behaviour I've seen myself, and I never got a
decent understanding of why it happens?

So does anybody know under what circumstances it's
possible to NOT get an Apache object passed into your
handler subroutine?

Does this happen when a subrequest occurs?

Regards

Marty

 --- Marina Markus <[EMAIL PROTECTED]> wrote: 
> Hello and many thanks to Martin and Geoffrey,
> 
> Martin was right - using "Dump" revealed that only
> "Our::Auth" was passed as
> an input variable (and the request was not passed at
> all). After I changed
> "PerlAuthenHandler Our::Auth->authen_handler" to
> "PerlAuthenHandler
> Our::Auth::authen_handler", the handler started to
> get the request as the
> first variable. 
> 
> If Martin can give such exact advices after a bad
> night, I ask what wonders
> he can do when he is OK :)
> 
> Thanks a lot to Geoffrey for Apache-Test, it looks
> very helpful.
> -Marina
> 
> -Original Message-
> From: Geoffrey Young
> [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, November 02, 2004 3:09 PM
> To: Marina Markus
> Cc: [EMAIL PROTECTED];
> [EMAIL PROTECTED]
> Subject: Re: Request methods not found
> 
> 
> > This code works OK in RedHat but cannot find
> "get_basic_auth_pw" in SGI.
> > Still, my feeling is that that something simple
> but imporant is omitted
> > in the code.
> 
> no, the code looks fine.  the issue isn't that
> get_basic_auth_pw() can't
> generally be found, but that $r isn't an Apache
> object, so your code is
> looking in the wrong place.  and you could be
> looking in the wrong place
> through no fault of your code at all - as martin
> suggested, you are probably
> using method handlers without knowing it.
> 
> besides the (good) advice that martin gave in his
> post, a really, really
> good way to track this down would be to use
> Apache-Test.  not that you are
> required to do this, but if you're interested in
> spending the up-front time
> to learn something new that will save you _lots_ of
> time in the future, give
> this a whirl...
> 
> first, install Apache-Test from CPAN:
> 
>   http://search.cpan.org/dist/Apache-Test/
> 
> then download this sample tarball:
> 
>  
>
http://perl.apache.org/~geoff/Apache-Test-skeleton-mp1.tar.gz
> 
> and tweak the distribution so that your handler is
> activated (follow the
> README to get started).  then try this:
> 
>   $ perl Makefile.PL -httpd
> /path/to/your/apache/bin/httpd
>   $ make
>   $ t/TEST -conf
>   $ t/TEST -start
> 
> and you can use your browser (or lynx or whatever)
> to hit
> http://localhost:8529/ and see your handler in
> action.  you could also take
> the time to tweak bug.t to act as a client for you.
> 
> the benefit here is that you now have a pristine
> environment with nothing
> attached to it except the code in question, and you
> can roll up your code
> (via make dist) and try it on different boxes.  you
> can even post a link to
> the tarball you have made for developers here to
> try, which would save
> iterations of 'what's the code? what's the
> configuration?" and so on.
> 
> now, if you don't do all of that, never fear - we're
> still here to help :)
> but it's something to keep in mind as you go forward
> with mod_perl related
> things.  Apache-Test is a wonderful development
> tool, so taking the time to
> get familiar with it will reap many, many benefits
> in the long term.
> 
> >>well, that message says that it can't find
> get_basic_auth_pw() via
> >>Our::Auth.  it should be looking for it via the
> Apache class, not
> >>Our::Auth.  
> > 
> > 
> > What checks can I do to see if Apache class is
> seen by mod_perl?
> 
> it is, or the 'use Apache' call would die.
> 
> HTH
> 
> --Geoff
> 
>  





___ALL-NEW Yahoo! Messenger - 
all new features - even more fun! http://uk.messenger.yahoo.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Re: Request methods not found

2004-11-02 Thread Martin Moss
Hi Marina,

Can you post a bit of your http.conf which declares
your AuthHandler's usage?

Are you saying:-

PerlAuthHandler Our::Auth->authen_handler
or
PerlAuthHandler Our::Authen::authenhandler

I ran some code across SuSe and Redhat and noticed
different behviours for using "->".

If you use "->" I think that this is interpreted as a
'method handler' and as such the first argument to
your authen_handler subroutine would be your classname
(Our::Auth) and the second argument would be the $r
(Apache->request).

Can you add this to your code:-

> package Our::Auth;
> use strict;
> use Apache;
> use Apache::Constants qw(:common);
> 
use Data::Dumper;
> use mod_perl ();
> 
> sub authen_handler {
> 
  print STDERR Dumper(@_); #lets see what you
got passed
> my $r = shift;
> 
> my ($res, $sent_pw) = $r->get_basic_auth_pw;
> 
> return $res if $res != OK;
> 
> my $user = $r->connection->user;
> if (!$user || !$sent_pw) {
> return AUTH_REQUIRED;
> }
> return OK;
> }
>   1;


I suspect that you will see 2 variables passed into
you subroutine 
1 = 'Our::Auth'
2 = instantiated Apache object

However I did have a skinful last night and my brain
is a little sluggish, so I could be wrong...(anybody
feel free to correct me)

Marty


 --- Marina Markus <[EMAIL PROTECTED]> wrote: 
> 
> Hello Geoffrey, 
> 
> Thank you for your answer; but I have to ask you for
> more help 
> as I neither use a pre-build version nor work with
> subclassing.
> The handler code is very simple:
> 
> package Our::Auth;
> use strict;
> use Apache;
> use Apache::Constants qw(:common);
> 
> use mod_perl ();
> 
> sub authen_handler {
> 
> my $r = shift;
> 
> my ($res, $sent_pw) = $r->get_basic_auth_pw;
> 
> return $res if $res != OK;
> 
> my $user = $r->connection->user;
> if (!$user || !$sent_pw) {
> return AUTH_REQUIRED;
> }
> return OK;
> }
>   1;
> 
> This code works OK in RedHat but cannot find
> "get_basic_auth_pw" in SGI.
> Still, my feeling is that that something simple but
> imporant is omitted
> in the code.
> 
> > that's right.  are you rolling your own on SGI or
> using a pre-compiled
> > package?  if the package is pre-compliled you
> might want to make sure that
> > it's mod_perl 1.2X and not mod_perl 1.99_XX, which
> is the precursor to
> > mod_perl 2.0 and a completely different beast.
> 
> I didn't use pre-compiled package but built it from
> source (Apache 1.3.31+
> PHP 4.3.8 + mod_perl 1.29). 
> 
> Maybe the following can be important: compilation is
> 32-bit
> (with "-o32" flag), otherwise Apache build complains
> of incompatible
> libraries. In fact, I had to configure mod_perl
> using a Shell-script:
> 
> #!/bin/sh
> CC="cc -o32" \
> perl Makefile.PL PERL_LOG=1 PERL_CHILD_INIT=1 \
> PERL_AUTHEN=1 PERL_ACCESS=1 PERL_AUTHZ=1 \
> PERL_CLEANUP=1 PERL_STACKED_HANDLERS=1 \
> USE_APACI=1 APACI_ARGS='--with-layout=Apache
> --prefix=/apache
> --activate-module=src/modules/php4/libphp4.a'
> 
> Still, there were no error messages concerning
> 32-to-64 incompatibility,
> so it may be not relevant. 
> 
> > well, that message says that it can't find
> get_basic_auth_pw() via
> > Our::Auth.  it should be looking for it via the
> Apache class, not
> > Our::Auth.  
> 
> What checks can I do to see if Apache class is seen
> by mod_perl?
> 
> Thank you,
> 
> Marina Markus
> [EMAIL PROTECTED]
> 
> 
> On Mon, 1 Nov 2004, Geoffrey Young wrote:
> 
> > 
> > 
> > Marina Markus wrote:
> > > Hello,
> > >  
> > > With Geoffrey Young's generous help I have
> successfully implemented
> > > authentication using my own handler subroutine
> defined as PerlAuthenHandler.
> > 
> > :)
> > 
> > 
> > > This works OK in RedHat but not on SGI (IRIX
> 6.2). Call to the handler fails
> > > complaining that it cannot find request object
> methods, be it "connection"
> > > or "get_basic_auth_pw", saying, for example:
> > >  
> > > [Mon Nov  1 12:54:13 2004] [error] Can't locate
> object method
> > > "get_basic_auth_pw" via package "Our::Auth" at
> > > /usr/local/lib/perl5/site_perl/5.005/Our/Auth.pm
> line 16,  chunk
> > > 225.\n
> > 
> > well, that message says that it can't find
> get_basic_auth_pw() via
> > Our::Auth.  it should be looking for it via the
> Apache class, not Our::Auth.
> >  if you're looking for it via $r blessed into
> Our::Auth you need to make
> > sure that you're doing subclassing properly for
> mod_perl (which is a bit
> > different than normal perl subclasses).  see
> > 
> >  
>
http://www.modperlcookbook.org/code/ch10/Cookbook/Apache.pm
> > 
> > for an example.
> > 
> > if you're not trying any subclassing tricks then
> something is definitely
> > amuck - $r should be an 'Apache' object (or
> 'Apache::RequestRec' in mp2)
> > when you call $r->note_basio_auth_pw.
> > 
> > >  
> > > These methods should come with the installation
> of mod_perl, shouldn't they?
> > 

Re: Apache::DBI, Postgresql, and transactions

2004-10-27 Thread Martin Moss
Heyho,

I spent ages trying to track down a mysql/Apache::DBI
bug, and whilst I'm not sure what's going wrong with
your system, I found it useful to add the PID of the
individual mysql process (not sure if you can do this
with postgresql) to the $dbh and then implement a
error handler which logs the pid. Then (again not sure
if you can do this in postgres) trace that pid to a DB
log file. in mysql you can get the last run command of
that PID, and then see if something is amiss on the DB
end...

Anyway here's a quick brain dump, you'll probably have
to tailor this to your needs..


Regards

Marty


something like this:-

my $dbh;

my %attrs=();
$attrs{RaiseError}=1;

if ($DBI::VERSION >= 1.21)
{
  #cos old DBI doesn't support this and we had
many versions running
  #cluck ("Adding ErrorHandler as DBI (version
$DBI::VERSION) Supports this method\n");
  $attrs{HandleError}=\&DBIErrorHandler;
}
else
{
  #cluck ("Not Adding ErrorHandler Support as DBI
version ($DBI::VERSION) Does not support this
method\n")
;
}

eval
{
$dbh = DBI->connect(
$dsn,
$db_user,
$db_password,
\%attrs
);
}; #because our bug was in the connect, you may
not need this

my $c_id;
eval
{
  my $stm_id = qq{SELECT connection_id()};
  ($c_id) = $dbh->selectrow_array($stm_id);
};

if ($@)
{
  #Probably older version of mysql, ignore
  $c_id='UNKNOWN - PROBABLY AN OLD DB Server';
}

$dbh->{private_MY_HASH}->{connection_id}=$c_id;



sub DBIErrorHandler
{
  my $sql = shift;
  my $sth = shift;
  my $value = shift;

  my $dbh;
  my $ref=ref($sth);

  print STDERR "In DBIErrorHandler\n";
  print STDERR "Incoming handle is '$ref'\n";
  print STDERR Dumper(@_)."\n";

  if ($ref =~ /DBI::st$/)
  {
#print STDERR "IS a STH\n";
$dbh=$sth->{Database};
  }
  elsif($ref =~ /DBI::db$/)
  {
#print STDERR "IS a DBH\n";
$dbh=$sth;
  }
  else
  {
print STDERR "Unable to Determine db/sth from ".
Dumper($sth);
$dbh=$sth;
  }

  if (ref($dbh) eq 'HASH')
  {
print STDERR "\nConnection ID is
'".$dbh->{private_MY_HASH}->{connection_id}."'\n";
  }
  else
  {
print STDERR '\nConnection ID cannot be
established, $dbh is not a hashref';
  }

  return 0; #Return false so RaiseError is now
executed

}



 --- Joe Thomas <[EMAIL PROTECTED]> wrote: 
> Brian Dimeler wrote:
> 
> > So anyway, I recompiled mod_perl to ensure these
> kinds of handlers 
> > were enabled, restarted the server with
> $Apache::DBI::DEBUG set to 2, 
> > and sure enough, I started getting debug messages
> about rollbacks 
> > after each script finished executing. Problem is..
> they stopped, after 
> > awhile. Mysteriously, about an hour after
> restarting, the cleanup 
> > handlers either aren't running or aren't printing
> debug info anymore, 
> > and the 'transaction aborted' errors are back.
> Does anyone know what 
> > could cause this, or how I could better diagnose
> my system?
> 
> Do you ever connect to a different database from
> your mod_perl scripts 
> -- or to the same database with different options? 
> Or even use a 
> different form for the database hostname (hostname
> only vs. 
> fully-qualified domain name)?
> 
> If you do, please try this patch (inline and
> attached) against the 
> current Apache::DBI.  I believe it fixes a bug in
> rolling back 
> transactions when more than one database handle is
> used.
> 
> Joe
> 
> --- DBI.pm.orig Tue Feb 17 16:18:50 2004
> +++ DBI.pm  Tue Aug 31 14:48:58 2004
> @@ -21,7 +21,6 @@
>  my %Rollback; # keeps track of pushed
> PerlCleanupHandler which can 
> do a rollback after the request has finished
>  my %PingTimeOut;  # stores the timeout values per
> data_source, a 
> negative value de-activates ping, default = 0
>  my %LastPingTime; # keeps track of last ping per
> data_source
> -my $Idx;  # key of %Connected and
> %Rollback.
>  
>  
>  # supposed to be called in a startup script.
> @@ -67,7 +66,7 @@
>  my $dsn= "dbi:$drh->{Name}:$args[0]";
>  my $prefix = "$$ Apache::DBI";
>  
> -$Idx = join $;, $args[0], $args[1], $args[2];
> +my $Idx = join $;, $args[0], $args[1],
> $args[2];  # key of 
> %Connected and %Rollback.
>  
>  # the hash-reference differs between calls even
> in the same
>  # process, so de-reference the hash-reference
> @@ -96,7 +95,7 @@
>  # TODO - Fix mod_perl 2.0 here
>  if(!$Rollback{$Idx} and $needCleanup and 
> Apache->can('push_handlers')) {
>  print STDERR "$prefix push
> PerlCleanupHandler \n" if 
> $Apache::DBI::DEBUG > 1;
> -Apache->push_handlers("PerlCleanupHandler",
> \&cleanup);
> +Apache->push_handlers("PerlCleanupHandler",
> sub { cleanup($Idx) });
>  # make sure, that the rollback is called
> only once for every
>  # request, even if the script calls connect
> more than once
>  $Rollback{$Idx} = 1;
> @@ -1

Re: Modperl setup Linux (which version)?

2004-10-13 Thread Martin Moss
Not for Mp2 but did you come across this link?

http://www.brtnet.org/linux/rtinstall.htm

Marty 

--- Jon Forrest <[EMAIL PROTECTED]> wrote: 
> Maybe others know something that I don't know,
> but I was unable to build mod_perl2 with apache 2
> on either Mandrake 10.0 or Fedora Core 2. I sent
> several bug reports to this list summarizing
> the problems.
> 
> Since my goal was to build Request Tracker, and
> their documentation strongly advises against
> mod_perl2, I decided to forget about this for
> now and use mod_perl1 which builds and runs just
> fine on these platforms.
> 
> Cordially,





___ALL-NEW Yahoo! Messenger - 
all new features - even more fun!  http://uk.messenger.yahoo.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Re: Mod perl performance and DSO?

2004-10-13 Thread Martin Moss
eek, sorry, you guessed right at apache 1.x (1.3.31)

Marty

 --- William McKee <[EMAIL PROTECTED]> wrote: 
> On Wed, Oct 13, 2004 at 12:46:19PM +0100, Martin
> Moss wrote:
> > Hmmm, I'm a little concerned that using DSO does
> have
> > a performance hit for no real benefit for what we
> wish
> > to do. Hmm, now just need to find instructions on
> > building apache with mod_ssl, mod_perl and
> mod_php?
> > without using DSO, any ideas? (whilst I'm off to
> > google...)
> 
> Yes, that's been my decision as well. I still don't
> know what version of
> Apache you are using, but if it's 1.x, then you may
> want to try
> Apachetoolbox[1]. I use it to compile mod_perl and
> mod_ssl.  However, I
> have not tried to compile mod_php along with
> mod_perl. There is a pretty
> good online forum which you could turn to if you hit
> any snags.  Let me
> know how it turns out; I may need to do this myself
> one day.
> 
> Good luck,
> William
> 
> [1] http://www.apachetoolbox.com/
> 
> 
> -- 
> Knowmad Services Inc.
> http://www.knowmad.com
> 
> -- 
> Report problems: http://perl.apache.org/bugs/
> Mail list info:
> http://perl.apache.org/maillist/modperl.html
> List etiquette:
> http://perl.apache.org/maillist/email-etiquette.html
> 
>  





___ALL-NEW Yahoo! Messenger - 
all new features - even more fun!  http://uk.messenger.yahoo.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Re: Mod perl performance and DSO?

2004-10-13 Thread Martin Moss
Hmmm, I'm a little concerned that using DSO does have
a performance hit for no real benefit for what we wish
to do. Hmm, now just need to find instructions on
building apache with mod_ssl, mod_perl and mod_php?
without using DSO, any ideas? (whilst I'm off to
google...)

Marty


 --- William McKee <[EMAIL PROTECTED]> wrote: 
> On Tue, Oct 12, 2004 at 05:06:18PM +0100, Martin
> Moss wrote:
> > Most information I find on the web to do this uses
> > DSO. Performance is absolutely critical for this
> > machine, it's going to be handling millions of web
> > 'hits' per day. 
> > 
> > My question is, should we use DSO or not?
> > My second question is, is this a daft question?
> 
> You didn't mention what version of Apache you were
> using but try this
> url for a starter:
> 
>
http://perl.apache.org/docs/1.0/guide/install.html#Pros_and_Cons_of_Building_mod_perl_as_DSO
> 
> You can answer the 2nd question for yourself after
> you read the above :).
> 
> 
> William
> 
> -- 
> Knowmad Services Inc.
> http://www.knowmad.com
> 
> -- 
> Report problems: http://perl.apache.org/bugs/
> Mail list info:
> http://perl.apache.org/maillist/modperl.html
> List etiquette:
> http://perl.apache.org/maillist/email-etiquette.html
> 
>  





___ALL-NEW Yahoo! Messenger - 
all new features - even more fun!  http://uk.messenger.yahoo.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Mod perl performance and DSO?

2004-10-12 Thread Martin Moss
All,

I have a brand new redhat 9 box. I have plenty of
diskspace and I need to install apache mode perl mod
php and mod ssl. 

Most information I find on the web to do this uses
DSO. Performance is absolutely critical for this
machine, it's going to be handling millions of web
'hits' per day. 

My question is, should we use DSO or not?
My second question is, is this a daft question?

Kind regards

Marty







___ALL-NEW Yahoo! Messenger - 
all new features - even more fun!  http://uk.messenger.yahoo.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Re: Embedding another webpage within a web page

2004-10-07 Thread Martin Moss
Thanks guys, 

Marty


 --- Tom Schindl <[EMAIL PROTECTED]> wrote: 
> Martin Moss wrote:
> > All,
> > 
> > I have an interesting issue. I'm in the process of
> > whitelabeling a website, but part of the process I
> > need to whitepabel is hosted by an outsourced
> company.
> > 
> > 
> > Rather than get the outsource company to change
> their
> > html, I would rather download and edit the html
> from
> > the outsourced website on the fly. 
> > 
> > I was thinking of writing a contentHandler which
> uses
> > LWP::Useragent etc.. to download from the
> outsourced
> > website. however I have only limited experience
> with
> > it.  Also, if the page I wish to download is
> itself a
> > form, how would I go about getting LWP to 'submit'
> > values etc...
> > 
> 
> I hope you don't use this in production but this
> should work if I'm not 
> completely mistaken:
> 
> 8<
> package Fake::FormRequest;
> 
> use LWP::UserAgent();
> use Apache::Constants();
> 
> my $ua = LWP::UserAgent->new;
> 
> sub handler {
> my $r = shift;
> my $request;
> 
> if( $r->method_number() ==
> Apache::Constants::M_GET ) {
>   $request = HTTP::Request->new(GET => 
>
'http://bla.com/my.cgi?'.$r->args,&getHeaderAsArrayRef($r));
> } else {
>   $request = HTTP::Request->new(POST => 
>
'http://bla.com/my.cgi?',&getHeaderAsArrayRef($r),$->content);
> }
> 
> my $response = $ua->request($request);
> ## .
> }
> 
> sub getHeaderAsArrayRef {
> my $r = shift;
> my %headers = $r->headers_in();
> my @rv;
> 
> map { push @rv, [ $_, $headers{$_} ] } keys
> %headers;
> 
> return [EMAIL PROTECTED];
> }
> 8<
> 
> 
> > Kind Regards
> > 
> > Marty
> > 
> > 
> > 
> > 
> > 
> >
>
___ALL-NEW
> Yahoo! Messenger - all new features - even more fun!
>  http://uk.messenger.yahoo.com
> > 
> 
> 
> -- 
> Report problems: http://perl.apache.org/bugs/
> Mail list info:
> http://perl.apache.org/maillist/modperl.html
> List etiquette:
> http://perl.apache.org/maillist/email-etiquette.html
> 
>  





___ALL-NEW Yahoo! Messenger - 
all new features - even more fun!  http://uk.messenger.yahoo.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Embedding another webpage within a web page

2004-10-06 Thread Martin Moss
All,

I have an interesting issue. I'm in the process of
whitelabeling a website, but part of the process I
need to whitepabel is hosted by an outsourced company.


Rather than get the outsource company to change their
html, I would rather download and edit the html from
the outsourced website on the fly. 

I was thinking of writing a contentHandler which uses
LWP::Useragent etc.. to download from the outsourced
website. however I have only limited experience with
it.  Also, if the page I wish to download is itself a
form, how would I go about getting LWP to 'submit'
values etc...

Kind Regards

Marty





___ALL-NEW Yahoo! Messenger - 
all new features - even more fun!  http://uk.messenger.yahoo.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Re: Method Handler not working

2004-07-26 Thread MARTIN MOSS
--- Perrin Harkins <[EMAIL PROTECTED]> wrote: > On Fri,
2004-07-23 at 18:12, MARTIN MOSS wrote:
> > My question is, If you don't have a PerlModule
> > statement or a use My::Module, or a require or a
> > +My::Module statement  so it looks like this
> > 
> > #PerlModule My:Module
> > 
> > set-handler PerlScript
> > PerlHandler My::Module 
> > 
> > 
> > But the module My::Module is on the Include path
> for
> > apache (hmm or is that the apache user), What
> exactly
> > happens?
> 
> mod_perl tries to load it at request time.  There
> are two reasons why
> this is bad.  The first is that it doesn't allow for
> copy-on-write
> shared memory.  You want to load it before the fork,
> and this doesn't do
> that.  The second is that it doesn't know about the
> method prototyping
> and thus your handler is not called as a method.
> 
> So, load the module first.  You can do it in any
> number of ways
> (startup.pl is common).  I think this will fix your
> problem.
> 
> - Perrin

I have a little note to add, It seems that under
freeBSD the above bad method does seem to work ok (or
at least gives that illusion),  But on Redhat, it
doesn't. Anybody have any ideas why this is?

Marty







___ALL-NEW Yahoo! Messenger - 
all new features - even more fun!  http://www.allnewmessenger.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Re: Method Handler not working

2004-07-24 Thread MARTIN MOSS
Thanks very much Perrin,

Have a nice weekend,

Marty


--- Perrin Harkins <[EMAIL PROTECTED]> wrote: > On Fri,
2004-07-23 at 18:12, MARTIN MOSS wrote:
> > My question is, If you don't have a PerlModule
> > statement or a use My::Module, or a require or a
> > +My::Module statement  so it looks like this
> > 
> > #PerlModule My:Module
> > 
> > set-handler PerlScript
> > PerlHandler My::Module 
> > 
> > 
> > But the module My::Module is on the Include path
> for
> > apache (hmm or is that the apache user), What
> exactly
> > happens?
> 
> mod_perl tries to load it at request time.  There
> are two reasons why
> this is bad.  The first is that it doesn't allow for
> copy-on-write
> shared memory.  You want to load it before the fork,
> and this doesn't do
> that.  The second is that it doesn't know about the
> method prototyping
> and thus your handler is not called as a method.
> 
> So, load the module first.  You can do it in any
> number of ways
> (startup.pl is common).  I think this will fix your
> problem.
> 
> - Perrin
> 
>  





___ALL-NEW Yahoo! Messenger - 
all new features - even more fun!  http://www.allnewmessenger.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Re: Method Handler not working

2004-07-24 Thread MARTIN MOSS

> > > It is setup like this:-
> > > 
> > > 
> > > SetHandler  perl-script
> > > PerlHandler My::Package
> > > 
> > Shouldn't that be
> >PerlHandler My::Package->handler
> 
> Technically that isn't necessary if your method is
> called handler() and
> you have prototyped it with ($$).
> 
I've got a kinda technical details point here, which
is maybe part of this issue.

I was always under the impression that in order to use
a module you should declare it with 
PerlModule My::Module


set-handler PerlScript
PerlHandler My::Module  #in whatever permutation


My question is, If you don't have a PerlModule
statement or a use My::Module, or a require or a
+My::Module statement  so it looks like this

#PerlModule My:Module

set-handler PerlScript
PerlHandler My::Module 


But the module My::Module is on the Include path for
apache (hmm or is that the apache user), What exactly
happens? or should happen?

I ask because this is how the system I'm using has
been configured. Everything seems to work, but I'm
wondering if the previous posted issue is a
consequence of doing this on two different OS systems,
one is Redhat, the other is freeBSD

I've never come across this method before.

Regards

Marty






___ALL-NEW Yahoo! Messenger - 
all new features - even more fun!  http://www.allnewmessenger.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Re: Method Handler not working

2004-07-22 Thread MARTIN MOSS


Michael <[EMAIL PROTECTED]> wrote:Perrin Harkins
wrote:
> On Thu, 2004-07-22 at 11:26, MARTIN MOSS wrote:
> 
>>This error doesn't occur on machines running the
same code (mirrored
>>in the same way as the redhat box), it works
perfectly fine.
>> 
>>Has anybody seen this type of error before, is it
the symptom of some
>>other issue that I've missed somehow?
> 
> 
> Did you compile with support for method handlers?
That has to be
> enabled. Also, are there any httpd.conf differences?

>right. Does your httpd.conf say
>SetHandler MyPackage::handler
>or
>SetHandler MyPackage

It is setup like this:-


SetHandler  perl-script
PerlHandler My::Package






Michael Peters
Developer
PlusThree







___ALL-NEW Yahoo! Messenger - 
so many all-new ways to express yourself http://uk.messenger.yahoo.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Re: Method Handler not working

2004-07-22 Thread MARTIN MOSS
I'm not sure, is there a way to find out what options apache has been built with?
 
There are no differences in code & http.conf between the working machines, only OS versions.
 
MartyPerrin Harkins <[EMAIL PROTECTED]> wrote:
On Thu, 2004-07-22 at 11:26, MARTIN MOSS wrote:> This error doesn't occur on machines running the same code (mirrored> in the same way as the redhat box), it works perfectly fine.> > Has anybody seen this type of error before, is it the symptom of some> other issue that I've missed somehow?Did you compile with support for method handlers? That has to beenabled. Also, are there any httpd.conf differences?- Perrin-- Report problems: http://perl.apache.org/bugs/Mail list info: http://perl.apache.org/maillist/modperl.htmlList etiquette: http://perl.apache.org/maillist/email-etiquette.html
		 ALL-NEW 
Yahoo! Messenger - so many 
all-new ways to express yourself 

Method Handler not working

2004-07-22 Thread MARTIN MOSS
All,
 
I have a quirky issue concerning a redhat machine and Apache 1.
I have a method handler
 
sub handler ($$)
{
  my $class=shift;
  my $r = shift;
}
 
Which when running on a redhat linux machine dies with the error message "Attempt to bless into a reference"  and when analysing the incoming variuables, $class is really $r. So apache seems to be ignoring the method handler directive. 
 
This error doesn't occur on machines running the same code (mirrored in the same way as the redhat box), it works perfectly fine.
 
Has anybody seen this type of error before, is it the symptom of some other issue that I've missed somehow?
 
Regards
 
Marty
		 ALL-NEW 
Yahoo! Messenger - so many 
all-new ways to express yourself 

Re: DBI and Apache::DBI

2004-05-14 Thread MARTIN MOSS
You didn't specify which Database server you're using. If it's mysql you need to be cautious of the 'ping' method used by Apache::DBI to check if a connection is stale or not. the DBD::mysql ping method always returns a 'true' string e.g. "0 but true" rather than a 1 or a 0.
 
I believe the latest version of DBD::mysql has an automatic 'reconnect' feature, but We're still seeing failed connections occuring infrequently on our systems. (Still investigating).
 
MartyPerrin Harkins <[EMAIL PROTECTED]> wrote:
On Wed, 2004-05-12 at 12:15, I S wrote:> a) I don't understand why the database sometimes gets> dropped. It happens randomly but frequently.> > could not prepare: Database disconnected at> /dssweb/httpd/cgi-bin/feeds/viewReport line 157.Usually this is caused by an inactivity timeout on your databaseserver. If you call DBI->connect before that, Apache::DBI will ping theconnection to make sure it is still live and re-connect if it isn't.> b) I built mod_perl and apache with EVERYTHING=1. > Should I expect DBI.pm appear in Apache directory?EVERYTHING=1 affects which hooks are enabled for mod_perl handlers. Ithas nothing to do with which modules will be available.Apache::DBI comes with mod_perl, and you should see it in your site_perldirectory. It is a pure perl module, so it would not be
 under an i386directory (or whatever your architecture is). If you can do PerlModuleApache::DBI in your program without failure, it means that it is therein your @INC path.- Perrin-- Report problems: http://perl.apache.org/bugs/Mail list info: http://perl.apache.org/maillist/modperl.htmlList etiquette: http://perl.apache.org/maillist/email-etiquette.html

Refreshing Caches at server restart

2004-04-19 Thread MARTIN MOSS
All,
 
I have a few modules which cache a few arrays. I want to get around the problem of these arrays staying cached when Apache Restarts gracefully. I can't have the server stop and start, and Apache::Reload isn't really the solution for this problem (or at least I don't think it is).
 
Has anybody done something which can allow me to force certain modules to reload/refresh whenever Apache does a Graceful restart?
 
Marty
 
Chris Faust <[EMAIL PROTECTED]> wrote:
Thanks Geoffrey,That is exactly what I wanted to know.-Chris- Original Message - From: "Geoffrey Young" <[EMAIL PROTECTED]>To: "Chris Faust" <[EMAIL PROTECTED]>Cc: "Tom Schindl" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>Sent: Sunday, April 18, 2004 1:23 PMSubject: Re: Defining specific vars in conf for a shared script>>> Chris Faust wrote:> > That helps Tom, I wasn't even sure if it was "PerlSetVar" that I neededto> > do.> >> > Beyond that, how do I get that from within script? If I'm going to use> > something in my script to read in the conf file then how do I know which> > config file I want?> >> > Using your example is there some> > "$r->get_vhost_settings{'HTML_TEMPLATE_ROOT'}" to get that
 value?>> for PerlSetVar it's>> use Apache::RequestUtil ();> use APR::Table ();>> $r->dir_config->get('HTML_TEMPLATE_ROOT');>> $r will be scoped to the current request, so you'll only get those> PerlSetVar settings that apply to the current vhost or container.>> this is pretty standard stuff, so you might want to check out some of the> docs or books listed at perl.apache.org for more on directive scoping,> PerlSetVar and the like.>> HTH>> --Geoff>-- Report problems: http://perl.apache.org/bugs/Mail list info: http://perl.apache.org/maillist/modperl.htmlList etiquette: http://perl.apache.org/maillist/email-etiquette.html

anchor tag

2003-11-01 Thread martin moss
Heyho,

If I have a url of http://some.domain.com/test/index.html#test

When I do a $r->uri I ge the url path /test/index.html
and $r->path_info is blank.

How do I get the #test anchor bit on the end of the url?

Regards

Marty