Re: Configuration with

2003-04-05 Thread Richard Clarke
Perrin,
Somehow I managed to completely miss your reply to my question until
just now I tried googling for a solution to my problem and saw your reply.

> Yes.  See
>
http://perl.apache.org/docs/1.0/guide/config.html#Apache_Restarts_Twice_On_S
tart
>

This is happening when I first start the server, apachectl start, httpd -X
.. they all cause half of my  section to be processed twice.. or at
least MOD_PERL_TRACE shows half the configuration directives being set twice
even though they only appear once.
I thought I had fixed it after upgrading from 5.6.1 to 5.8 but alas I
was temporarily tricked :(

print STDERR "Server is Starting\n"   if $Apache::Server::Starting;
print STDERR "Server is ReStarting\n" if $Apache::Server::ReStarting;

Sticking this code in my  section only results in the first line being
printed.

> I don't use  sections, so I've never had this problem before, but
> it seems strange that this should trigger complaints from something like
> setting a virtual host.  Maybe you should clear the virtual host
> settings at the top of your  code.
>

I never used them until I had a brainwave that I could centralise my site
configuration by moving all my different server settings into a database and
autogenerating the config based on where apache was being booted from..

My problem can be shown using a completely minimal configuration file so I'm
sure someone else must have come across this before or at least there must
be some caveat I have overlooked in the documentation.

The vhost clash doesn't actually stop anything working.. at least not now..
at the start apache just refused to serve anything, now it all works apart
from the bombardment of "this vhost overlaps with that vhosts" messages at
the start.

Richard.



Re: Configuration with

2003-04-02 Thread Richard Clarke
List,
No matter what I can't understand why the following tiny 
configuration won't work.
If I comment out $ServerRoot, it works. If I instead comment out
DocumentRoot, it works.
If I comment out $$l, it works. I don't understand :(


#!perl -w

$ServerRoot = "/usr/local/app/apache_modperl";
$DocumentRoot   = "/usr/local/app/static";

$PerlRequire= "/usr/local/app/conf/startup.perl";

foreach my $l (qw/ErrorLog TransferLog LockFile PidFile ScoreBoardFile/) {
 $$l  = "/usr/local/app/apache_modperl/logs/$l";
};

$VirtualHost{"10.10.10.42:3128"} = {
ServerName => "mp2.local.com"
   };




startup.perl only contains,
#!/usr/bin/perl -w
use strict;

use lib qw (/usr/local/app/lib);

1;


PERL_TRACE output clearly shows that half of the perl section is being
processed twice, causing a VirtualHost overlap warning.
Is it supposed to work like this?

Richard.



Configuration with

2003-04-02 Thread Richard Clarke
I'm fairly sure my head is about to explode from frustration here. Any help
would be MUCH appreciated.

I'm trying to get my httpd.conf working with .., however things
don't seem to be working out.
As soon as I add either $PerlModule or $PerlRequire for any module, apache
seems to try load/bind/or something, itself "twice"?

[Wed Apr  2 21:52:50 2003] [warn] VirtualHost 10.10.10.1:3128 overlaps with
VirtualHost 10.10.10.1:3128, the first has precedence, perhaps you need a
NameVirtualHost directive
[Wed Apr  2 21:52:50 2003] [warn] VirtualHost 10.10.10.2:3128 overlaps with
VirtualHost 10.10.10.2:3128, the first has precedence, perhaps you need a
NameVirtualHost directive
[Wed Apr  2 21:52:50 2003] [crit] (48)Address already in use: make_sock:
could not bind to address 10.10.10.2 port 3128

This happens no matter where in the file or what in order I put these
directives.

Did I make a massive oversight when reading the documentation on this?


Richard.




Segmentation fault - is Error.pm the culprit?

2003-03-30 Thread Richard Clarke
I'm using a subclass of Error.pm to throw exceptions when a DBI error
happens.
The SEGV only happens after I "return SERVER_ERROR" in response to the
thrown and propogated error.
This code essentially worked fine 2 weeks ago but at the time I removed my
DBI HandleError subroutine. Today when adding it back in I am facing this
problem

Running with my debug httpd gives me a backtrace of,

Program received signal SIGSEGV, Segmentation fault.
0x810839d in Perl_sv_setsv ()
(gdb) bt
#0  0x810839d in Perl_sv_setsv ()
#1  0x80ff194 in Perl_pp_sassign ()
#2  0x80fedf6 in Perl_runops_standard ()
#3  0x80c1cd6 in S_call_body ()
#4  0x80c1aba in perl_call_sv ()
#5  0x80c1725 in perl_call_method ()
#6  0x807d458 in perl_call_handler (sv=0x978809c, r=0x97db034, args=0x0) at
mod_perl.c:1655
#7  0x807cbf5 in perl_run_stacked_handlers (hook=0x8147199 "PerlHandler",
r=0x97db034, handlers=0x97a4f30) at mod_perl.c:1371
#8  0x807afab in perl_handler (r=0x97db034) at mod_perl.c:897
#9  0x809a841 in ap_invoke_handler (r=0x97db034) at http_config.c:518
#10 0x80afed0 in process_request_internal (r=0x97db034) at
http_request.c:1308
#11 0x80aff3a in ap_process_request (r=0x97db034) at http_request.c:1324
#12 0x80a68ab in child_main (child_num_arg=0) at http_main.c:4603
#13 0x80a6a6d in make_child (s=0x817f034, slot=0, now=1049069980) at
http_main.c:4718
#14 0x80a6be6 in startup_children (number_to_start=50) at http_main.c:4800
#15 0x80a7214 in standalone_main (argc=2, argv=0xbfbffb74) at
http_main.c:5108
#16 0x80a7a74 in main (argc=2, argv=0xbfbffb74) at http_main.c:5456
#17 0x8061f21 in _start ()

For the time being I can use die instead of throw since they are both caught
by my try{} block... this isn't ideal however since I can't identify the
type of exception like this.
Is this likely to be related to Error.pm? Could something else be causing
this? Any advice at all?


This is on,
   mod_perl 1.27, apache 1.3.27, fbsd 4.7-release.

Richard.



Re: Tracing double accesshandler invocation

2003-03-14 Thread Richard Clarke
> > sub handler {
> > my $r = shift;
> > my $uri = $r->the_request;
> > return OK unless $r->is_initial_req; # stops dbl execution
>
> "Stops dbl execution" _after_ this point, of course. If you request a
> directory, the server will return an internal redirect to $dir/index.html
> (or whatever) -- that would make your handler run twice up to this point.
>

I'm not sure what you mean.
The reason that I put that code there is because if it's not there then the
accesshandler is always run twice.
There seems to be a subrequest triggering the accesshandler, yet I'm not
explicitly performing any subrequests.
Ideally I would like to find someway to trace the who/what/where/why of
handler execution. Running with PERL_TRACE left me none the wiser so I was
hoping a user might know a better way?

Richard.



Re: Tracing double accesshandler invocation

2003-03-14 Thread Richard Clarke
package AC::Centry::Access;
$AC::Centry::Access::VERSION = qw$Revision: 1.2 $[1];

use strict;
use Apache::Constants qw(:common);
use AC::Centry::Tool();

# handler()
# Process requests to protected URI's
sub handler {
my $r = shift;
my $uri = $r->the_request;
return OK unless $r->is_initial_req; # stops dbl execution
$r->log->warn("Centry::Access triggered for $uri");
my $group = int $r->dir_config('AccessGroup');

# Create Config, Centry::Tool and verify_ticket
my $centry_tool = AC::Centry::Tool->new($r);
$r->log_reason("Bad Centry::Tool",$r->filename) unless $centry_tool;
my ($result, $msg) = $centry_tool->verify_ticket($r,$group);

# Return FORBIDDEN or short circuit with group
unless ($result) {
$r->log_reason($msg, $r->filename);
$centry_tool->expire_cookie($r); # Expire cookie from browser
unless ($group==0) {
my $cookie = $centry_tool->make_return_address($r);
$r->err_header_out('Set-Cookie' => $cookie->as_string);
return FORBIDDEN;
}
}

# Ticket is verified, Refresh ticket
$r->log->warn("Reissuing ticket with ",join ':',@$msg);
my $ticket = $centry_tool->make_ticket($r,@$msg);
$r->err_header_out('Set-Cookie', $ticket->as_string);

return OK;
}


Re: Tracing double accesshandler invocation

2003-03-14 Thread Richard Clarke
> The only thing which it does which is affected by anything outside of its
> immediate environment is call, $r->prev. This shouldn't call the
> accesshandler though... should it?
>

Erm, doh, not sure why I said this. This only happens when a 403 happens and
the user is sent to the /login location. So my actual AccessHandler doesn't
do anything which even resembles a subrequest.

Ric.



Re: Tracing double accesshandler invocation

2003-03-14 Thread Richard Clarke
Nick,

> if ($r->lookup_uri($r->uri)->content_type =~ /image/) {
> return Apache::DECLINED;
> }
>
>
> Do you have this, or something similar, in your code?

I greped my entire directory tree for any of the subrequest mechanisms
and the only place I am using them are in some handlers from a completely
different .

My access handler is essentially the same as the one from the eagle book but
with various modifications to suit my applications security requirements and
to use my own db/template objects. It doesn't use any subrequest mechanisms.
The only thing which it does which is affected by anything outside of its
immediate environment is call, $r->prev. This shouldn't call the
accesshandler though... should it?

Ric.





Re: mod_perl not sending cookies

2003-03-13 Thread Richard Clarke
Are you using Apache::Cookie?

If so,

 #same as $cookie->bake
 $r->err_headers_out->add("Set-Cookie" => $cookie->as_string);

Are you doing this?

Richard.


- Original Message - 
From: "Andrew Fritz" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 13, 2003 8:24 PM
Subject: mod_perl not sending cookies


> I'm using Apache:AuthCookie. I have set up a basic test site. It appears 
> that AuthCookie never send the cookie even though the call to:
> $r->err_headers_out->add("Set-Cookie" => $cookie);
> is there. If I modify the call to include a simple cookie:
> $r->err_headers_out->add("Set-Cookie" => 'a=b');
> it works.
> 
> The value of $cookie is:
> jza70AuthHandler_JZA70=\"Thisisatest\"; expires=Tue, 11 Mar 2003 
> 06:33:50 GMT; path=/thisisatest; domain=jza70
> 
> The expires field is from a log of a few days ago, but was valid (about 
> 24 hours in the future) when it was sent.
> 
> Any thoughts are apreciated.
> 
> Andrew Fritz
> 
> 
> 
> 


Tracing double accesshandler invocation

2003-03-05 Thread Richard Clarke
Hi,
I'm trying to figure out why my accesshandler is getting triggered twice
for each request that I make. I'm 100% sure that I'm doing no explicit
lookups/redirects anywhere in my code. The particular uri I am fetching
should only invocate an accesshandler followed by a contenthandler.
After watching the request with MOD_PERL_TRACE=h and MOD_PERL_TRACE=all I
think I'm still non the wiser.
Testing for $r->is_initial_req solves the "problem" but I'm more interested
in finding out exactly why it's being called twice.
Any tips for tracing this easier?

Ric.



Re: How to figure out with what options a mod_perl is built

2003-03-02 Thread Richard Clarke
> Hi,
>
> Is there a way, like PHP has   , to figure out with
> what options a standard  linux distribution mod_perl is built ?
>
> I would like to know if it was built with EVERYTHING=1 or if
> PERL_CHILD_INIT=1
>

http://perl.apache.org/docs/1.0/guide/install.html#Discovering_Whether_Some_
Option_Was_Configured

perl -MApache::MyConfig -e 'print $Apache::MyConfig::Setup{PERL_CHILD_INIT}'

The manual also suggests this,

If you are faced with a compiled Apache and no trace of the parameters used
to build it, you can usually still find them if the sources were not make
clean'd. You will find the Apache specific parameters in
apache_1.3.xx/config.status and the mod_perl parameters in
mod_perl-1.xx/apaci/mod_perl.config.

Though personally the mod_perl.config file doesn't exist for me.

I've never needed to do this so I'm only regurgitating the search results of
http://perl.apache.org/search/swish.cgi?query=build+options&sbm=&submit=sear
ch

Ric.






Re: Apache dies when configure mod_perl for use with Apache::DBI

2003-03-02 Thread Richard Clarke
> As soon as I activate the line identified as 'trouble line', my apache
> server dies.

Can you elaborate on this.. how does it die?, what is the error msg? etc..

(That is assuming it's still a problem after upgrading to latest
DBI/Apache::DBI as Stas suggested).

Ric.



Re: Apache dies when configure mod_perl for use with Apache::DBI

2003-03-01 Thread Richard Clarke
> PerlModule Apache::DBI;<<-- trouble line

This line belongs in your httpd.conf file.
PerlModule is an apache configuration directive, not a perl 'command'.

http://perl.apache.org/docs/1.0/guide/config.html#PerlModule_and_PerlRequire
_Directives

Ric.



Re: Authorization question

2003-02-27 Thread Richard Clarke
I've never had any reason to do this so there might be a shortcut but I
think something along the lines of the following should work (As long as
your access/auth handler doesnt make use of $r->is_intial_req())

use Apache::Constants (:common);
my $subr   = $r->lookup_uri('/new/request/?foo=bar');
my $status = $subr->status;
my $ok = $status==AUTH_REQUIRED ? 0:1;

Ric.

- Original Message -
From: "Jean-Michel Hiver" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 27, 2003 10:42 AM
Subject: Authorization question


> Hi List,
>
> In theory Authentication / Authorization handlers are very cool, because
> the application underneath it doesn't need to know the logic of it, and
> as long as you design web applications with nice, RESTful, sensible URIs
> it would all work beautifully.
>
> BUT, I cannot figure out how to 'ask' apache wether a request would
> succeed or not. I'm wondering wether there would be a way to do:
>
>   my $ok = $r->would_be_authorized ($uri);
>
>   # or
>   my $ok = $r->would_be_authorized ($uri, 'GET');
>
>   # or
>   my $ok = $r->would_be_authorized ($uri, 'POST', $fh);
>
>
> This would be handy because for example in your web application you
> might want certain controls or links to be replaced by proper messages
> rather than directing the user to a location that he/she doesn't have
> access to.
>
> If I missed something obvious please point out a URI so that I can RTFM!
> All ideas appreciated!
>
> Cheers,
> --
> Building a better web - http://www.mkdoc.com/
> -
> Jean-Michel Hiver
> [EMAIL PROTECTED]  - +44 (0)114 255 8097
> Homepage: http://www.webmatrix.net/
>
>
>



Re: Program received signal SIGBUS, Bus error. 0x80b2953 in ap_unescape_url ()

2003-02-18 Thread Richard Clarke
Stas,

> Doesn't seem like an apreq problem. It happens in the modperl function.
Any
> chance you can rebuild mod_perl with debug mode enabled (PERL_DEBUG=1), so
we
> can see the arguments and file/linenumbers? See:
> http://perl.apache.org/docs/1.0/guide/debug.html#PERL_DEBUG_1_Build_Option
>


Program received signal SIGBUS, Bus error.
0x80b445b in ap_unescape_url (url=0x8162e89 "") at util.c:1609
1609url[x] = '\0';
(gdb) bt
#0  0x80b445b in ap_unescape_url (url=0x8162e89 "") at util.c:1609
#1  0x8085c20 in XS_Apache_unescape_url (cv=0x8227b0c) at Apache.c:931
#2  0x81040fb in Perl_pp_entersub ()
#3  0x80fea26 in Perl_runops_standard ()
#4  0x80c1d3e in S_call_body ()
#5  0x80c1b22 in perl_call_sv ()
#6  0x807d4de in perl_call_handler (sv=0x85cfb6c, r=0x8657034, args=0x0) at
mod_perl.c:1658
#7  0x807cc69 in perl_run_stacked_handlers (hook=0x8146daa
"PerlTransHandler", r=0x8657034, handlers=0x85cfbe4)
at mod_perl.c:1371
#8  0x807b78f in perl_translate (r=0x8657034) at mod_perl.c:999
#9  0x809a403 in run_method (r=0x8657034, offset=0, run_all=0) at
http_config.c:370
#10 0x809a46a in ap_translate_name (r=0x8657034) at http_config.c:382
#11 0x80afa30 in process_request_internal (r=0x8657034) at
http_request.c:1199
#12 0x80affae in ap_process_request (r=0x8657034) at http_request.c:1324
#13 0x80a691f in child_main (child_num_arg=0) at http_main.c:4603
#14 0x80a6ae1 in make_child (s=0x817f034, slot=0, now=1045623388) at
http_main.c:4718
#15 0x80a6c5a in startup_children (number_to_start=50) at http_main.c:4800
#16 0x80a7288 in standalone_main (argc=2, argv=0xbfbffbb0) at
http_main.c:5108
#17 0x80a7ae8 in main (argc=2, argv=0xbfbffbb0) at http_main.c:5456
#18 0x8061f95 in _start ()

Its worth noting that the same function runs fine in a contenthandler, just
not in the transhandler.

Richard.




Program received signal SIGBUS, Bus error. 0x80b2953 in ap_unescape_url ()

2003-02-18 Thread Richard Clarke
I'm using FreeBSD 4.7 Release. perl 5.6.1 & Mod_Perl/Apache Latest &
libapreq 1.1.

Program received signal SIGBUS, Bus error.
0x80b2953 in ap_unescape_url ()
(gdb) bt
#0  0x80b2953 in ap_unescape_url ()
#1  0x8084094 in XS_Apache_unescape_url ()
#2  0x8102623 in Perl_pp_entersub ()
#3  0x80fcf4e in Perl_runops_standard ()
#4  0x80c0266 in perl_call_sv ()
#5  0x80c004a in perl_call_sv ()
#6  0x807c6ba in perl_call_handler ()
#7  0x807bfc0 in perl_run_stacked_handlers ()
#8  0x807b083 in perl_translate ()
#9  0x8098863 in ap_cleanup_method_ptrs ()
#10 0x80988ca in ap_translate_name ()
#11 0x80adf00 in ap_some_auth_required ()
#12 0x80ae47e in ap_process_request ()
#13 0x80a4db7 in ap_child_terminate ()
#14 0x80a4f79 in ap_child_terminate ()
#15 0x80a50f2 in ap_child_terminate ()
#16 0x80a5724 in ap_child_terminate ()
#17 0x80a5f84 in main ()
#18 0x8061f4d in _start ()
(gdb) quit

I'm performing unescape_uri() in a PerlTransHandler. This works perfectly
well on my Linux libapreq 1.0 box, so I'll try 1.0 instead.

I remember there was some discussion about 1.1 segv's when it was announced
but a quick search told me these were aimed at either 5.8 or file uploads.

Anyone got any suggestions whilst I go try libapreq 1.0

Richard.




Object Handlers & internal_redirect

2003-01-23 Thread Richard Clarke
I am using an object transhandler like so,

PerlTransHandlerUtil::Tour::Translate->handler

I then have a content handler like so,

SetHandlerperl-script
PerlHandler   Util::Tour::Banner


My content handler is used to select an image by processing data in the
path_info and performing an internal_redirect to the actual image,
$r->internal_redirect("/img/$id/banners/$img.gif");

However, as soon as the internal_redirect happens (which inevitably triggers
the PerlTransHandler again) I get,

[Thu Jan 23 17:35:36 2003] [error] Undefined subroutine
&Util::Tour::Translate->handler::handler called at
/home/www.website.com/lib/Util/Tour/Banner.pm line 66.

So I converted Util::Tour::Translate's handler into a regular non object
handler and everythings works fine. I would rather use object handlers but
this doesn't seem possible if a content handler is performing an
internal_redirect which might invoke that handler.

Can somone shed some light on this for me please.

Richard.

p.s. I didnt yet try converting Util::Tour::Banner into an object handler.
Is it neccessary for all handlers in a chain to be either object or regular
but not a mix?.




Re: web link broken when access cgi-bin

2002-12-22 Thread Richard Clarke
> And sent messages about using Windows to a Linux list, and CGI questions
to
> mod_perl list and seems to ignore the many requests to read some basic CGI
> tutorials.   I'd guess troll if he wasn't so clueless. ;)

Since when did mod_perl becomes Linux only?

Richard.




0x444ba45b in prof_mark () from /usr/lib/perl5/5.6.1/i686-linux/auto/Devel/DProf/DProf.so

2002-12-07 Thread Richard Clarke
List,
I seem to have hit a slight stumbling block in my mod_perl development.
Without wanting to write a whole essay on the exact combination of events
that causes this segv to happen I'll just say for now that it happens after
my custom Template::Provider returns a status indicating a template could
not be found. My apache error log indicates that the segv happens
immediately after my contenthandler returns SERVER_ERROR.
As you can see from the topic, the segv happens in the DProf library. I have
listed the gdb output at the end of my email.
My question is simply, is this a mod_perl problem, a template toolkit
problem or a problem somewhere in the dprof library?.
If I really need to use Apache::DProf then I'll just avoid requesting
templates that don't exist. I'm still curious however, as to whether there
is a more sinister problem waiting to cause my problems in the future.
Any advice? Has anyone else ever experienced a code path which causes a
similar segv in dprof?

Richard.

(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x4477145b in prof_mark () from
/usr/lib/perl5/5.6.1/i686-linux/auto/Devel/DProf/DProf.so
(gdb) bt
#0  0x4477145b in prof_mark () from
/usr/lib/perl5/5.6.1/i686-linux/auto/Devel/DProf/DProf.so
#1  0x44771b5d in XS_DB_sub () from
/usr/lib/perl5/5.6.1/i686-linux/auto/Devel/DProf/DProf.so
#2  0x444e2732 in Perl_pp_entersub () from /usr/lib/libperl.so
#3  0x444dc7e0 in Perl_runops_standard () from /usr/lib/libperl.so
#4  0x444900cc in S_call_body () from /usr/lib/libperl.so
#5  0x4448c28e in perl_call_sv () from /usr/lib/libperl.so
#6  0x4448fcbe in perl_call_method () from /usr/lib/libperl.so
#7  0x0806fbe1 in perl_call_handler ()
#8  0x0806f472 in perl_run_stacked_handlers ()
#9  0x0806dfc4 in perl_handler ()
#10 0x0808e1b9 in ap_invoke_handler ()
#11 0x080a3f7f in ap_some_auth_required ()
#12 0x080a3fea in ap_process_request ()
#13 0x0809a876 in ap_child_terminate ()
#14 0x0809aa35 in ap_child_terminate ()
#15 0x0809abb6 in ap_child_terminate ()
#16 0x0809b24d in ap_child_terminate ()
#17 0x0809babc in main ()
#18 0x445743bd in __libc_start_main () from /lib/libc.so.6
(gdb)




Re: What triggers the User Handler?

2002-11-18 Thread Richard Clarke
Marc,
If the webpage has images then a request will be made for each of these
images as well. Depending on your configuration this could account for it
being run several times.

Ric.

- Original Message -
From: "Marc Murphy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, November 18, 2002 3:07 PM
Subject: What triggers the User Handler?


> When a request is made I thought each of the 11 or so handlers runs and
> that's it.  I'm seeing some behaviour where a homepage is loaded but the
> user handler that I designated seems to run several times (I have some
> print statements that print to a file), but I'm only loading one
> webpage.  It doesn't have any frames.  What's going on?
>
>
>
>




Apache::Request + Apache::Filter

2002-11-12 Thread Richard Clarke
List,
Can anyone tell me if a module exists that combines these two modules so
that, for example, when using Apache::Dispatch one can create an instance of
Apache::Request in the handler without clobbering the overridden methods
sent as part of the Apache::Filter object. Before I try and do this I
wondered if it had already been done? Apache::RequestFilter would make sense
to me but something like this doesn't seem to exist on CPAN.

Ric




AB Segfault on mod_perl Handler

2002-11-12 Thread Richard Clarke
List,
Does anyone know why apache ab might segfault when accessing one
particular mod_perl handler on my site? Is this something I could be doing
wrong in my handler (I can't think what.. the page works find in all
browsers).

Richard.




Re: OO handlers

2002-11-06 Thread Richard Clarke
Now I feel stupid. $sub->handler was supposed to be "$sub->handler".

That's what you get for being impatient.

Ric

- Original Message -
From: "Richard Clarke" <[EMAIL PROTECTED]>
To: "Richard Clarke" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, November 06, 2002 4:08 PM
Subject: Re: OO handlers


> I should add that this segv only happens when using push_handlers like
> below. If I put Control::Super::Sub->handler inside a  tag in
> httpd.conf then it is fine.
>
> Ric
>
> - Original Message -
> From: "Richard Clarke" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, November 06, 2002 3:55 PM
> Subject: OO handlers
>
>
> > List,
> > Tired of having 10 modules all with near identical handler methods I
> > decided to put the handler method into a superclass and be done with
> > maintaining the same code 10 times. I first tried this a couple of weeks
> ago
> > and it failed to work, because at the time I couldn't find the reference
> to
> > OO style handler methods in my Eagle book. Since the mod_perl cookbook
is
> > now available on safari I had a quick flick through and noticed a brief
> > mention on OO style handler methods along with the snippet of info I
> needed
> > i.e. sub handler ($$).
> >
> > To cut a long story short my subclasses are now empty (for the moment)
and
> > they inherit (or a least should be doing) from the main superclass.
> > Something like,
> > use Control/Super.pm
> > @Control::Super::Sub::ISA = Control::Super;
> >
> > I use a "dispatch" module with a basic handler to choose which module
will
> > process a particular uri.
> > It now adds the module to be called like follows,
> > my $sub = join '::', 'Control', ucfirst $module, ucfirst $sub_stage;
> > $r->push_handlers('PerlHandler',$sub->handler);
> >
> > The meaning of $module and $sub_stage is unimportant here.
> >
> > And the Superclass handler looks like
> > sub handler ($$) {
> > my $self = shift;
> > my $r = Apache::Request->instance(shift);
> > # do stuff
> > }
> >
> > Testing this with httpd -X causes a segfault every time I go to the URL.
> So
> > my question is, before I try to figure out why it segv's, is this kind
of
> > thing allowed?, or is there some caveat which prevents handlers being
> > invoked if they come from a supeclass?
> >
> > All help appreciated as usual,
> > Richard.
> >
> >
> >
> >
>
>
>
>




Re: OO handlers

2002-11-06 Thread Richard Clarke
I should add that this segv only happens when using push_handlers like
below. If I put Control::Super::Sub->handler inside a  tag in
httpd.conf then it is fine.

Ric

- Original Message -
From: "Richard Clarke" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, November 06, 2002 3:55 PM
Subject: OO handlers


> List,
> Tired of having 10 modules all with near identical handler methods I
> decided to put the handler method into a superclass and be done with
> maintaining the same code 10 times. I first tried this a couple of weeks
ago
> and it failed to work, because at the time I couldn't find the reference
to
> OO style handler methods in my Eagle book. Since the mod_perl cookbook is
> now available on safari I had a quick flick through and noticed a brief
> mention on OO style handler methods along with the snippet of info I
needed
> i.e. sub handler ($$).
>
> To cut a long story short my subclasses are now empty (for the moment) and
> they inherit (or a least should be doing) from the main superclass.
> Something like,
> use Control/Super.pm
> @Control::Super::Sub::ISA = Control::Super;
>
> I use a "dispatch" module with a basic handler to choose which module will
> process a particular uri.
> It now adds the module to be called like follows,
> my $sub = join '::', 'Control', ucfirst $module, ucfirst $sub_stage;
> $r->push_handlers('PerlHandler',$sub->handler);
>
> The meaning of $module and $sub_stage is unimportant here.
>
> And the Superclass handler looks like
> sub handler ($$) {
> my $self = shift;
> my $r = Apache::Request->instance(shift);
> # do stuff
> }
>
> Testing this with httpd -X causes a segfault every time I go to the URL.
So
> my question is, before I try to figure out why it segv's, is this kind of
> thing allowed?, or is there some caveat which prevents handlers being
> invoked if they come from a supeclass?
>
> All help appreciated as usual,
> Richard.
>
>
>
>




OO handlers

2002-11-06 Thread Richard Clarke
List,
Tired of having 10 modules all with near identical handler methods I
decided to put the handler method into a superclass and be done with
maintaining the same code 10 times. I first tried this a couple of weeks ago
and it failed to work, because at the time I couldn't find the reference to
OO style handler methods in my Eagle book. Since the mod_perl cookbook is
now available on safari I had a quick flick through and noticed a brief
mention on OO style handler methods along with the snippet of info I needed
i.e. sub handler ($$).

To cut a long story short my subclasses are now empty (for the moment) and
they inherit (or a least should be doing) from the main superclass.
Something like,
use Control/Super.pm
@Control::Super::Sub::ISA = Control::Super;

I use a "dispatch" module with a basic handler to choose which module will
process a particular uri.
It now adds the module to be called like follows,
my $sub = join '::', 'Control', ucfirst $module, ucfirst $sub_stage;
$r->push_handlers('PerlHandler',$sub->handler);

The meaning of $module and $sub_stage is unimportant here.

And the Superclass handler looks like
sub handler ($$) {
my $self = shift;
my $r = Apache::Request->instance(shift);
# do stuff
}

Testing this with httpd -X causes a segfault every time I go to the URL. So
my question is, before I try to figure out why it segv's, is this kind of
thing allowed?, or is there some caveat which prevents handlers being
invoked if they come from a supeclass?

All help appreciated as usual,
Richard.




Re: redirection halts if a message is printed

2002-11-04 Thread Richard Clarke
Sumitro Chowdhury wrote:





My question is : 
a)What is the reason for this behaviour ? Why does
printing a message halt the redirection ?

I don't know how to explain this really but, HTTP_MOVED_TEMPORARILY 
implies a 302 status code which means,

   "The requested resource resides temporarily under a different URI."

Print some text to the browser implies a 200 OK code meaning,

   "The request has succeeded."

These are both conflicting status'. The httpd can't send 2 status codes 
and as far as I am aware there is no scope in the HTTP protocol for 
returning a message in the response body about the fact that we are 
"Redirecting to a new site".

b)What needs to be done to display a message saying
"Redirecting .." and then the browser to auto-display
the new URL ?


http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=meta+refresh&btnG=Google+Search
   http://www.pageresource.com/html/metref.htm
   http://www.netmechanic.com/news/vol4/promo_no15.htm
   etc..

Any one of these should help you solve your problem I think


Thanks in advance ..
Sumitro Chowdhury.

 

Hope this helps,
   Richard Clarke.




Re: [OTish] Version Control?

2002-10-30 Thread Richard Clarke
Jim Martinez wrote:


On Oct 30 Richard Clarke wrote:

 

Does anyone in the list use any kind of version control (e.g. CVS) for
the perl/template codebase of their website?
   


Using cvs, I'm not sure of an elegant way to update.  I'm worried about 
CVS subdirectories sitting under htdocs, to be specific. 

Perhaps I just am not familiar enough with cvs.  Perhaps there is an 
option that will supress the CVS that will ease rollouts.

The specific comments given so far are great.

On Oct 30 Jesse Erlbaum wrote:

 

SSH is also encrypted and secure.  Just make sure to configure your
web server to block access to "CVS/" directories!
   


Also, Randal Schwartz wrote about cvs is a slightly more general setting: 

http://www.linux-mag.com/2002-07/perl_01.html

Jim
 

I should have known better. Is there any topic he *hasn't* written an 
article on?

Ric






 






Re: [OTish] Version Control?

2002-10-30 Thread Richard Clarke
Hsiao, Chang-Ping wrote:


CVS is easy to use but confusing at first.


This could be the root of my reservations.


Once you get used to it, you should not complain.

I don't quite get your saying "I don't however feel that the organizational
logic of a websites code base fits well into the CVS paradigm."  Isn't your
files hierarchical?  If so, why is CVS not fitting your purpose?


Indeed, I don't get what I'm saying either.
My organisation is something like (slightly over-simplified),

_lib/Example/Control/section_a.pm
_lib/Example/Control/section_b.pm
_lib/Example/Control/section_c.pm
_lib/Example/Config/section_a.pm
_lib/Example/Config/section_b.pm
_lib/Example/Config/section_c.pm
_lib/Example/Model/section_c.pm
_lib/Example/Model/section_c.pm
_lib/Example/Model/section_c.pm
_tmpl/section_a/view1.html
_tmpl/section_a/view2.html
_tmpl/section_a/view3.html
_tmpl/section_b/view1.html
_tmpl/section_b/view2.html
_tmpl/section_b/view3.html
_tmpl/section_c/view1.html
_tmpl/section_c/view2.html
_tmpl/section_c/view3.html

I though CVS was more suited for something which looks more like
_lib/Example/Section_a/Control
_lib/Example/Section_a/Model
_lib/Example/Section_a/View/1
_lib/Example/Section_a/View/2
_lib/Example/Section_a/View/3
etc

i.e. more suited to a "procedural" orangisation than an "object" 
organisation

Then again, like i said... perhaps my assumptions were too short sighted.

Ric.




Re: [OTish] Version Control?

2002-10-30 Thread Richard Clarke
John,

[EMAIL PROTECTED] wrote:


We felt the same way but once we went to CVS we never looked back and 
can not imagine going with out source control. It may seem like the 
web doesnt fit that paradigm but if you break your modules up properly 
it works like a champ.

We broke out into 'html','components', 
'Libs','external_tools','internal_tools','perlinstall'. This gave us 
good control over each different area.

For our development team its more about consistency then versioning. 
If you go all the way with it like we did you can give each developer 
a sandbox that they work in and CVS merges for you, it is a huge 
benefit. Its to the point now where you check out all the modules and 
run one script. That script builds all the perl dependancies, rebuilds 
your http daemon, rebuilds the proxies, configures the server for the 
platform its on based on hostname and installs all the relevant files.
Every so often we bundle everything up into a tagged 'Release' and 
send it on its way to production. This works really well. A case in 
point was when we did our I18N conversion. We had one version of the 
code that was being entirely hacked apart to accomodate our changes 
but we still had to actively support bug fixes on the release. Without 
CVS[insert favorite source system here] this would have been impossible.

Do you use CVS checkouts to upgrade the live system or do you this 
manually. i.e. stop apache, tar and remove old code, untar new code, 
start apache et voila?


So, without good CVS things like our I18N effort, our auto-install 
systems etc would have not been possible or been a LOT more painful. 
As it was we busted through it in record time.

John-

Ric.






[OTish] Version Control?

2002-10-30 Thread Richard Clarke
Does anyone in the list use any kind of version control (e.g. CVS) for 
the perl/template codebase of their website?
Now that my code base is growing I feel the increasing need to provide 
better version/backup control than my current hourly crontab tar.
I don't however feel that the organizational logic of a websites code 
base fits well into the CVS paradigm. Am I being to short sighted in 
this assumption?
Does anyone have any recommended method? I don't use version numbers at 
all? Does anyone?

Richard.



[OT] Re: Yahoo is moving to PHP ??

2002-10-30 Thread Richard Clarke
List,
   You are probably not the best people to ask for an answer which 
might advocate PHP,
   but.
   Can someone who is more proficient in PHP than I (I have used it 
for 5 minutes) explain to me why it is quicker to prototype things in PHP?
   I can't understand this statement. Surely this is only 
applicable to people who are not proficient with mod_perl & [% 
my_templating_engine %]?
   Much of the code from PHP based websites which I have read has 
seemed to take this prototyping idea too much to heart. It looks more 
like an overly
   complex prototype than a well working application.

/me doesn't get it.



Re: Same $dbh under different pids?

2002-10-29 Thread Richard Clarke
harm wrote:


Moi,

a quick question: is it possible to have the 'same' dbh across the apache
children even if you do your best not to?

This minimalistic handler:
use strict;
package Foo;
use Apache::DBI;
use DBI;
use Apache::Constants qw':common';

my $dbh;


You haven't initialised this, so each request will get the same object 
that is made below.

$Apache::DBI::DEBUG = 1;


This should be in a start up file really.



sub handler {
  my $r = shift;
  $r->send_http_header;
  $r->print("ok");


You could just put,
   print "ok";


  $dbh ||= DBI->connect("dbi:mysql: ... etc);


Apache::DBI takes care of pooling connections.
Use,

   my $dbh = DBI->connect(@CONNECT);

and get rid of the global $dbh above.

Richard





Apache::Clean, Apache::Compress, mod_gzip/deflate, cross site scripting and more.

2002-10-27 Thread Richard Clarke
List,
Before I embark on a day exploring the pros and cons of today's
cleaning/compression tools, I wondered if any of you could give me some
feedback about your own experiences within the context of medium/large scale
web sites/applications (E-Toys etc).

Is it too presumtious to expect that many users now have high speed
connections and tools that clean and/or compress html are of a small benefit
anymore? That is not to mention the proliferation of "pretty" websites with
90% graphics.

Given that gzip style compressions work very well with plain text due to
whitespace characters etc, is the combination of modules like Apach::Clean,
Apache::Compress (and Apache::Filter) an overkill. Is there really much
benefit in using Apache::Clean AND Apache::Compress (Or similar compatible
modules/technologies) with consideration of performance trade offs arising
from using these modules.

Is there any advantage to using modules like HTML::Tree or HTML::Parser to
remove information (i.e. removing autoexecuting javascript tags and any
other CSS issues) from user submitted information. Will a well designed set
of regular expressions perform this sanitisation more efficiently? Not
forgetting that not all user input arrives via a form. e.g. web mail (Though
we can thank Anomy/Spamassassin/ClamAV/MIMEDefang and others for helping out
here).

I realise this post doesn't relate directly to mod_perl per se, however
mod_perl does a great deal to encourage a high ratio of coupling to cohesion
in the way we build our applications/sites. At the same time however we
can't deny the fact that the faster we can serve our webpages the happier
our users will be.

I have been following the discussion on the list for a few months and though
threads have cropped up addressing some of these issues I haven't really
seen anyone advocate a specific stance on the situation. Perhaps someone who
has faced these decisions many times can offer some insight? I'm curious as
to whether a lot of technologies are used outside of developement. Has much
changed in the past year to make any of the above discussions especially
different?

Just please point me to online references if this has been discussed to
death.

Richard.




Re: [RFC] Apache-GeoIP module

2002-10-25 Thread Richard Clarke
My IP is from the netherlands apparently :(
Can't even get quality british IP's these days... sheesh

Ric(England).



Re: code evaluation in regexp failing intermittantly

2002-10-24 Thread Richard Clarke
> If you're doing it because hacking perl is fun and you're in no rush, then
go ahead and have a good time.


And if so, would you like to swap jobs?

please?

Rich




[OT] Perl vs. PHP..... but where is mod_perl?

2002-10-18 Thread Richard Clarke
List,

http://www.newsfactor.com/perl/story/19716.html

...sigh?

Ric



Re: sql-relay

2002-07-15 Thread Richard Clarke

Perrin Harkins wrote:

> Richard Clarke wrote:
>
>>I came across http://www.firstworks.com/sqlrelay.html the other 
>> day. Have any of you come across this product before.
>
>
> It's been discussed here before (see the archives) but no one has 
> talked about any real experience with it yet.  Try it out and tell us 
> what you find.
>
> > With the whole problem
>
>> of providing seemless recovery at the "client" side from database 
>> failure this tool seems quite productive.
>
>
> What problem is that?  I don't think there's much you can do beyond 
> re-connecting, which Apache::DBI does.


I mean in the case of the database crashing and being able to switch to 
a replicated backup system.

>
> - Perrin
>
>
>





sql-relay

2002-07-15 Thread Richard Clarke

List,
I came across http://www.firstworks.com/sqlrelay.html the other day. 
Have any of you come across this product before. With the whole problem 
of providing seemless recovery at the "client" side from database 
failure this tool seems quite productive. I've not used it but figured 
maybe one of you has?

Richard




Re: leaks with Apache::Request?

2002-07-08 Thread Richard Clarke

Dave,
Perhaps this is why from the eagle book,
"During the child exit phase, mod_perl invokes the Perl API function 
perl_destruct( ) to run the contents of END blocks and to invoke the 
DESTROY method for any global objects that have not gone out of scope 
already."
So I think i'm right in saying that, "When I run this, the DESTROY 
method is not called until the server shuts down." is perfectly normal 
behaviour. I don't know how you are actually testing your "memory 
usage", but I might suggest that if you are sending larger amounts of 
data than previously, just once per 5000 requests then this memory is 
gonna be consumed by apache forever (at least until httpd is killed).

Richard


Dave Rolsky wrote:

>It looks like there may be a memory leak with Apache::Request.  I'm using
>version 1.0 with Perl 5.6.1, mod_perl 1.26, and Apache 1.3.26.  mod_perl
>is statically compiled into Apache.
>
>Here's some code that I think demonstrates the leak:
>
>  package My::APRTest;
>
>  use strict;
>
>  use Apache::Request;
>  sub Apache::Request::DESTROY{warn "DEAD: $_[0]\n"}
>  sub handler
>  {
>  my $r = shift;
>  $r = Apache::Request->new($r);
>
>  $r->send_http_header;
>  $r->print('apr test');
>
>  return 200;
>  }
>
>  1;
>
>When I run this, the DESTROY method is not called until the server shuts
>down.
>
>Watching memory using with top (against a server running as httpd -X) I
>can see that memory usage is growing a little less the 500K every 5000
>requests.
>
>This isn't catastrophic but fixing it would be a good thing.
>
>
>-dave
>
>/*==
>www.urth.org
>we await the New Sun
>==*/
>
>
>
>  
>





Re: Re: param trouble

2002-07-02 Thread Richard Clarke

http://thingy.kcilink.com/modperlguide/snippets/Reusing_Data_from_POST_reque
st.html

- Original Message -
From: "Tim Sebastian Böckers" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 01, 2002 2:24 PM
Subject: Fwd: Re: param trouble



Thanks to everyone giving their hints and help. I will try to search the
archive again Jean-Michel as it looks v. similar. At the moment I'm lucky
that I got my data in the url so in the end I just applied a regex.

Cheers,
Tim

--  Forwarded Message  --

Subject: Re: param trouble
Date: Sun, 30 Jun 2002 11:32:46 +0100
From: Jean-Michel Hiver <[EMAIL PROTECTED]>
To: Tim Sebastian Böckers <[EMAIL PROTECTED]>
Cc: [EMAIL PROTECTED]

> basically the whole thing is starting to bite its own tail and i would be
> very happy if anybody could give me any pointers as to why CGI won't read
> my data from the PerlInitHandler or after Apache::Request read them.

I seem to remember a post where someone had trouble because he was
trying to access POSTed data twice... problem was that once the POSTed
data was read, that was it.

Maybe it's something similar?
Cheers,
- --
IT'S TIME FOR A DIFFERENT KIND OF WEB

  Jean-Michel Hiver - Software Director
  [EMAIL PROTECTED]
  +44 (0)114 255 8097

  VISIT HTTP://WWW.MKDOC.COM

- ---







Propogating Errors / E-Toys

2002-06-30 Thread Richard Clarke

List,
Without wanting to fire up a huge thread about MVC seperation etc etc. I
just wondered if someone would share their expertise on the following
question.
Using Perrin's article on E-Toys is perhaps a good place to start. In the
Model object which performs various DB procedures, what actions were taken
if for some reason the connection to the database failed or if an SQL error
happened? Was the whole "execute()" block put in an eval procedure and then
a generic error page produced; Or were either per procedure evals or
Exception objects used to propogate specific errors up to the control object
so that it could display errors in the current page/view?

Richard




Storing and Serving Upload Images

2002-06-29 Thread Richard Clarke

List,
I find the following situation one which arises many times for me when
creating modperl applications for people. However, I always find myself
thinking there is a better way to do it. I wondered if the list would like
to share their thoughts on the best way. It concerns storing and serving
images/media uploaded by users of the webpage.

An example could be a website letting you set up your own shops to sell
products. The shop maker may allow you to upload preview images of products.
Assuming the product data is stored in a database, I personally wouldnt
store the binary image in the databas (assuming mysql here). A solution
springing to mind is to store a hash/id in the database and have a common
directory (/htdocs/_previews/) which holds the pictures named after that
hash/id. That way, either the modperl application can auto create the link
using src=/htdocs/_previews/imageid.jpg or a lightweight handler can be
used. For example /getimage?id=asdf09sd8fsa could then rewrite the uri to
the real location or perform a content subrequest and let apache serve the
image that way. Of course there are many solutions, but I'm wondering. Is
there a best one?

Any thoughts appreciated. I realise that the same situation might occur
using vanilla cgi, but mod_perl provides unique ways of solving the problem,
hence I post to this list.

Richard.





Re: (browser bug) Internet Explorer AuthCookie and others

2002-06-23 Thread Richard Clarke

I am an idiot. Please ignore the previous post.

Richard :(

- Original Message -
From: "Richard Clarke" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 24, 2002 2:00 AM
Subject: (browser bug) Internet Explorer AuthCookie and others


> List,
> I just wanted to post to see if anyone could help me understand this
> (probably internet explorer) based problem. In the past I have used my own
> custom authcookie type modules. Sometimes I experience problems where
> internet explorer sends back a cookie with the incorrect hash (maybe an
old
> cookie) and causes the authentication to fail since the hash's don't
match.
> I didn't have this problem "too" often though. However I am trying out
> Apache::dnszone which uses AuthCookie. The same type of things happens
with
> AuthCookie except here it happens nearly EVERY time I try to perform a
> priviliged operation. Of course with mozilla it works perfectly every
time.
> Is this another browser based bug?
>
> The section of AuthTicker.pm which croaks the error is
> 
> my $newhash = md5_hex($secret .
>   md5_hex(join ':', $secret, $ip,
>   @ticket{qw(version time expires user)})
>   );
>
> unless ($newhash eq $ticket{'hash'}) {
> # ticket hash does not match (ticket tampered with?)
> $r->subprocess_env(AuthTicketReason => 'tampered_hash');
> return 0;
> }
> ---
>
> This is pretty much identical code to where my code croaks (except mine
> doesnt seem as often).
>
> So I'm guessing internet explorer screws up somehow and sends and old
cookie
> or something weird. No doubt others have experience this and know what is
> happening. Please explain
>
> Yours,
> Richard
>
>
>
>




(browser bug) Internet Explorer AuthCookie and others

2002-06-23 Thread Richard Clarke

List,
I just wanted to post to see if anyone could help me understand this
(probably internet explorer) based problem. In the past I have used my own
custom authcookie type modules. Sometimes I experience problems where
internet explorer sends back a cookie with the incorrect hash (maybe an old
cookie) and causes the authentication to fail since the hash's don't match.
I didn't have this problem "too" often though. However I am trying out
Apache::dnszone which uses AuthCookie. The same type of things happens with
AuthCookie except here it happens nearly EVERY time I try to perform a
priviliged operation. Of course with mozilla it works perfectly every time.
Is this another browser based bug?

The section of AuthTicker.pm which croaks the error is

my $newhash = md5_hex($secret .
  md5_hex(join ':', $secret, $ip,
  @ticket{qw(version time expires user)})
  );

unless ($newhash eq $ticket{'hash'}) {
# ticket hash does not match (ticket tampered with?)
$r->subprocess_env(AuthTicketReason => 'tampered_hash');
return 0;
}
---

This is pretty much identical code to where my code croaks (except mine
doesnt seem as often).

So I'm guessing internet explorer screws up somehow and sends and old cookie
or something weird. No doubt others have experience this and know what is
happening. Please explain

Yours,
Richard





persistent Mail::ImapClient and webmail

2002-06-07 Thread Richard Clarke

List,
I have the task in my hands of creating a web mail application. Initial
thoughts lead me to think I would use an external popper to pop mail and
parse it into a database for retrieval by the modperl application. The only
problem here is that I must provide the implementation of the mail storage
and folder management etc. Something I would rather not spend my time on. So
my thoughts turned to IMAP. Retrieve the mail from an IMAP server. IMAP
itself supports most mail management methods such as move message, delete
message, save draft, mark seen etc. So a few lines of perl later I had a
PerlChildInitHandler which connected to the IMAP server and saved the
connection object. I wanted to know if people saw any immediate problems
with this solution and also if anyone could explain the following
percularities.

If I store a single imap object in $imap, e.g.
my $imap;
sub connect {
my ($self,$centro_id) = @_;
print STDERR $imap,"\n";
unless (defined $imap) {
print STDERR "Connecting to IMAP for $centro_id\n";
$imap = Mail::IMAPClient->new( Server => 'cyrus.andrew.cmu.edu',
   User   => 'anonymous',
   Password => '[EMAIL PROTECTED]',
   );
}
return $imap;
}

This seems to successfully save the connection object. However if I attempt
to store the object in a hash, e.g.
my %imap_cache;
sub connect {
my ($self,$centro_id) = @_;
print STDERR $imap,"\n";
unless (exists $imap_cache{$centro_id}) {
print STDERR "Connecting to IMAP for $centro_id\n";
$imap_cache{$centro_id} = Mail::IMAPClient->new( Server =>
'cyrus.andrew.cmu.edu',
   User   => 'anonymous',
   Password => '[EMAIL PROTECTED]',
   );
}
return $imap_cache{$centro_id};
}

I seem to have intermitent success in retrieving an already connected
object. Using the first example, as far as I can tell the object remains
available flawlessley. But storing the object in the hash doesn't. Am I
making a mistake here?

Another question sprung to mind, should I think about using Persistant::Base
or some similar approach to store the IMAP objects?, or should I lean
towards Randal's and others suggestions of having a seperate (possibles SOAP
or LWP::Daemon or even apache server in single user mode) server
specifically designed for performing IMAP requests?

Finally, does anyone with experience in having to write webmail interfaces
see any problems with using the functionality provided by IMAP.

Richard

p.s. Yes quite obviously if I have 100 children then I'll be connected to
the IMAP server 100 times per user, hence possibly the need to have a either
a dedicated daemon connected to the IMAP server once or some successfuly way
of sharing IMAP objects between children.




Problem: Internal redirection of ErrorDocument to mod_perl handler

2002-06-03 Thread Richard Clarke

List,
Before I present a detailed description of the problem I thought I'd
just bounce of an intro to see if its a common "fault".
I have found, using apache 1.x latest and mod_perl 1.x latest that if I use
internal redirection to a mod_perl handler for ErrorDocument 500
(server_error) then even though I return the perfectly correct data (html
headers etc) to the browser, every browser works fine. Except that is,
Internet Explorer 6 (maybe earlier too but I have no test bed). Internet
Explorer chooses to display the default Microsoft internal server error page
and not the html which is actually returned. If I use a network monitor like
Iris I can see that the data is returned perfectly...but Internet Explorer
refuses to display it. This problem my apply to other error codes. The only
fix I found is to use a fully qualified host redirect for the
ErrorDocument.. but then I lose fancy stuff like previous request analysis.
Any ideas?

Ric

p.s.

The kind of httpd.conf block I am talking about is,

ErrorDocument 500 /error


SetHandler blahblah
blahblah






Re: Scripts and passwd

2002-05-19 Thread Richard Clarke

You could migrate to a database based mail authentication solution.
Postfix+cyrus springs to mind.

Ric

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, May 19, 2002 9:56 AM
Subject: Re: Scripts and passwd


>
> Hello
>
> Thanks for the reply. Yes this server is running mod perl :)
>
> As for risky. Well the whole point of the script system is to add a pop
mail
> box for a user. But in order to do this i have to do the following:
>
> add user to the passwd/shadow file
> add user to the virtusertable and genericstable
> recompile the sendmail config files
>
> Then and only then is the new mailbox ready for use. This is the only way
I
> can think of to accomplish this via an automated web proccess. I dont even
> know if you can do it any other way with out touching the passwd/shadow
> files?
>
> Thanks! John.
>
> > You're doing something pretty risky there. the passwd/shadow files are
> only
> > writable by root. So I suppose that when running them from the command
> line
> > you run them as root. Apache doesn't run as root (its children which
serve
> > the requests atleast), so mod_perl (I suppose you *are* using mod_perl?
If
> > not, this is more appropriate for another newsgroup) won't either.
> >
> > If you can run your script as CGI, you could use suEXEC. But really,
> really
> > consider the security implications of what you're doing there before
> > allowing users to trash your machine very fast...
> >
> >
> > --
> > Per Einar Ellefsen
> > [EMAIL PROTECTED]
> >
> >
>




Re: modperl idle timeout....

2002-05-18 Thread Richard Clarke

Why don't you just set your maximum child requests to a reasonable number
and have them restart themselves after they have executed what you would
call "enough requests to need flushing".

Ric.

- Original Message -
From: "Jim Morrison [Mailinglists]" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, May 17, 2002 3:24 PM
Subject: modperl idle timeout


> Guys,
>
> I am currently using mod_perl & XML::Xalan.. which is going well.. (For
> those of you who answered questions of mine about memory usage, I found
some
> big memory leaks in my code... Doh!... Much better now... )
>
> However, because it's only a little box, and because Xalan (and therefore
> mod_perl) is not used 24x7 I have set up and apache graceful restart on a
> crontab, so that mod_perl gets flushed out of use every hour... which
keeps
> our mem usage down, and stops me having lots of big "httpd"'s lying around
> that don't need to have Perl compiled into them..
>
> Anyhow...  I was wondering... is there a simple way to set up a sort of
> "idle timeout" to get each single httpd to restart itself if two
conditions
> are met:
>  - 1 - It has compiled mod_perl
>  - 2 - The mod_perl aliases have not been accessed for 'x' minutes...
>
> What do you guys recon... is crontabbing a restart easier.. is it ill
> advised?  (Ofcourse the restart runs even when you are using mod_perl..
> which doesn't really help anyone.. cos then it has to go through the
restart
> lag.. )
>
>
> Oh well... would love to hear your thoughts,
>
> All the best,
>
>
> Jimbo
>
>
>
> Jim Morrison
> _
> Technology & Development Partner
> Isotope LLP
> 9, 2 Laura Place
> Bath, Somerset
> United Kingdom
>




Re: $r->args vs $r->content

2002-05-14 Thread Richard Clarke

Are you also processing the posted data at some earlier request stage? It
doesn't sound like you would be but I thought I would ask.

Richard


- Original Message -
From: Mike Melillo
To: [EMAIL PROTECTED]
Sent: Tuesday, May 14, 2002 5:22 PM
Subject: $r->args vs $r->content





Ok, I've switched to A::Request, but it still seems my parameters table is
empty.  I'll paste in the form data, as well as some code snippets to see if
that helps find the bug.

 

username



password






**End HTML Template**

** Join.pm **

sub submit {
my $DEBUG = 1;
my ($r) = shift;
my $apr = Apache::Request->new($r);
my $status = $apr->parse;
my @param = $apr->param;
$DEBUG && print STDERR Dumper($apr->parms)
$DEBUG && print STDERR Dumper(@param);

...
}


The first Data::Dumper print statement sends this to the errlog ->
$VAR1 = bless( {}, 'Apache::Table' );

The second print statement prints nothing.

I looked at perldoc Apache::Request, but didn't see anything wrong...

Help?

Mike



-Original Message-
From: Issac Goldstand [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 14, 2002 4:39 AM
To: Mike Melillo
Cc: [EMAIL PROTECTED]
Subject: Re: $r->args vs $r->content

Quoting Mike Melillo <[EMAIL PROTECTED]>:

>
> Hi,
>

> One of the fields is an image file that will be uploaded so I need to
> use POST requests.  Is this a job for Apache::Request?  The eagle book
> doesn't cover it much because it was "experimental" at the time of
> publishing.
>
There's a version 1.0 out by now.  That means stable as it's ever gonna get
:-)  I use it all the time, go for it!

  Issac


Internet is a wonderful mechanism for making a fool of
yourself in front of a very large audience.
  --Anonymous

Moving the mouse won\'t get you into trouble...  Clicking it might.
  --Anonymous

PGP Key 0xE0FA561B - Fingerprint:
7E18 C018 D623 A57B 7F37 D902 8C84 7675 E0FA 561B






Re: SOAP and web services

2002-05-03 Thread Richard Clarke

that too :)

- Original Message -
From: "Bart Frackiewicz" <[EMAIL PROTECTED]>
To: "Richard Clarke" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, May 03, 2002 4:15 PM
Subject: Re: SOAP and web services


Hi Ric,

>
> I use mod_perl/apache/soap::lite to create an internal
> "application server"
> so that I can distribute processing load from the public
> webserver. This
> also allows me to expose a soap web service to the public if
> I wished to
> give them direct access to a method on this application server, but of
> course they would need a soap client to access this service.
>
> Do you want to just return an xml to your user, or do you
> want to do what I
> do which is do internal RPC using SOAP.

in my opinion a web service has another great benefit - you can sperate the
logic and the front ends. we have here an application running on php/html,
and all the logic is inside this scripts, in case of running on another
medium/language (like flash or php for plain html) you must copy all the
logic - you can call this a nightmare.

in this case i think that a solution provides with PRC/SOAP is a good idea,
but on every article i read more, i realize that this technology is still
young and just experimental (e.g. php 4.x).

bart




Re: SOAP and web services

2002-05-02 Thread Richard Clarke

Are you sure soap is what you want?. Just because SOAP uses XML to encode
the parameters and data which it transmits doesnt necessarily mean you want
that same format sent to the user. Why would you not have a normal mod perl
content handler execute whatever procedures are necessary to get the
information and then build the XML structures from the plethora of modules
available?

I use mod_perl/apache/soap::lite to create an internal "application server"
so that I can distribute processing load from the public webserver. This
also allows me to expose a soap web service to the public if I wished to
give them direct access to a method on this application server, but of
course they would need a soap client to access this service.

Do you want to just return an xml to your user, or do you want to do what I
do which is do internal RPC using SOAP.

Ric.

p.s. apologies if I'm completely off track :)


- Original Message -
From: "Bart Frackiewicz" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 02, 2002 6:34 PM
Subject: SOAP and web services


Dear List,

i want to create a server in mod_perl/apache, which receives request via
get/post (plain), process this request (with database access and some
functions) and answers in xml (with correct header), after planning this
about a month i realized that this is called a "web service".

the difference between my solution and all articles was SOAP, which i
understand as an extension to http, so in my opinion i need something that
allows to parse the request and creates the output, is there a solution for
mod_perl anyway? and is this solution stable for a production server which
more than 10.000 request/day?

i hope this is the right place to ask, but in all articles i read there were
only examples for java/tomcat, not for perl/mod_perl.

Thanks in advance

Bart Frackiewicz


--
BART FRACKIEWICZ
systementwickler
inity - agentur fuer neue medien gmbh
birkenstrasse 71
40233 duesseldorf




escape the '+' character

2002-04-28 Thread Richard Clarke



Can someone tell me why the Apache::UTIL 
escape_uri() function doesnt escape the '+' character.
I need to pass a base64 string as a query string 
but I can't do this unless + is changed to %2B.
Should I just translate it manually...are there any 
other chars I should be translating manually?
 
Yours,
    Ric


Soaplite debugging with modperl

2002-04-25 Thread Richard Clarke

Hi Guys,
Can someone suggest a good method for debugging the server portion of
soaplite applications when used in a mod perl context.
Debugging in the sense that I want to print out strings to apache log or
similar.

Ric