You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Martin Wood <mw...@orctel.co.uk> on 2000/09/22 12:54:03 UTC
Apache::Registry & error_log quirk
We have a collection of CGIs in a single directory handled by Apache::Registry, however if we enter the name of a resource under that location that doesn't exist, say www.noddy.com/registry_dir/dont_exist.cgi this is not recorded in the error_log, just the access log, yet the correct 404 "File not found" response is displayed to the client.
For locations managed by default handlers, attempts to access non-existent files is logged in both the access and error logs. Is is possible to activate this behaviour for the Apache::Registry handled location?
Thanks for any info,
Martin
Re: Apache::Registry & error_log quirk
Posted by Martin Wood <mw...@orctel.co.uk>.
Thanks, this works fine and is just what we required.
Martin
On Thu, Sep 28, 2000 at 09:33:38AM -0700, Doug MacEachern wrote:
> On Fri, 22 Sep 2000, Martin Wood wrote:
>
> > We have a collection of CGIs in a single directory handled by Apache::Registry, however if we enter the name of a resource under that location that doesn't exist, say www.noddy.com/registry_dir/dont_exist.cgi this is not recorded in the error_log, just the access log, yet the correct 404 "File not found" response is displayed to the client.
> >
> > For locations managed by default handlers, attempts to access non-existent files is logged in both the access and error logs. Is is possible to activate this behaviour for the Apache::Registry handled location?
>
> i guess that's because Apache::Registry doesn't log an error,
> whoopsie. this patch fixes that.
>
> Index: lib/Apache//PerlRun.pm
> ===================================================================
> RCS file: /home/cvs/modperl/lib/Apache/PerlRun.pm,v
> retrieving revision 1.29
> diff -u -r1.29 PerlRun.pm
> --- lib/Apache//PerlRun.pm 2000/06/01 21:07:56 1.29
> +++ lib/Apache//PerlRun.pm 2000/09/28 16:31:12
> @@ -60,6 +60,7 @@
> $pr->{'mtime'} = -M _;
> return wantarray ? (OK, $pr->{'mtime'}) : OK;
> }
> + $pr->log_error("$filename not found or unable to stat");
> return NOT_FOUND;
> }
>
> Index: lib/Apache//Registry.pm
> ===================================================================
> RCS file: /home/cvs/modperl/lib/Apache/Registry.pm,v
> retrieving revision 1.32
> diff -u -r1.32 Registry.pm
> --- lib/Apache//Registry.pm 2000/08/02 15:53:15 1.32
> +++ lib/Apache//Registry.pm 2000/09/28 16:31:15
> @@ -165,6 +165,7 @@
> # }
> return $r->status($old_status);
> } else {
> + $r->log_error("$filename not found or unable to stat");
> return NOT_FOUND unless $Debug && $Debug & 2;
> return Apache::Debug::dump($r, NOT_FOUND);
> }
Re: Apache::Registry & error_log quirk
Posted by Martin Wood <mw...@orctel.co.uk>.
Thanks for the help, added an appropriate logging message for items not found (needed because we pipe error_log into an app which popups an alert on our displays each time a line is added - useful and annoying in equal measures!)
Martin
On Fri, Sep 22, 2000 at 02:00:21PM +0100, G.W. Haywood wrote:
>
> Have a look around lines 44-56 of Apache/Registry.pm - I'm sure you'll
> see what you need there. That is if you've got mod_perl 1.24. Dunno if
> the line numbers are the same elsewhere. it goes like this...
>
> if (-r $filename && -s _) {
> if (-d _) {
> return DECLINED;
> }
> if (!($r->allow_options & OPT_EXECCGI)) {
> $r->log_reason("Options ExecCGI is off in this directory",
> $filename);
> return FORBIDDEN;
> }
> unless (-x _ or $Is_Win32) {
> $r->log_reason("file permissions deny server execution",
> $filename);
> return FORBIDDEN;
> }
>
>
> 73,
> Ged.
Re: Apache::Registry & error_log quirk
Posted by "G.W. Haywood" <ge...@www.jubileegroup.co.uk>.
PS:
'Scuse my ignorance (haven't got Perl on my W2k box:) but does the
variable $Is_Win32 get set true for NT/Win2000?
As I understand it there is a concept of execute permission in W2k
(dunno about NT) and if this flag is set they're ignored.
> around lines 50-56 of Apache/Registry.pm -
> unless (-x _ or $Is_Win32) {
> $r->log_reason("file permissions deny server execution",
> $filename);
> return FORBIDDEN;
> }
Re: Apache::Registry & error_log quirk
Posted by "G.W. Haywood" <ge...@www.jubileegroup.co.uk>.
Hi there,
On Fri, 22 Sep 2000, Martin Wood wrote:
> We have a collection of CGIs in a single directory handled by
> Apache::Registry, however if we enter the name of a resource under
> that location that doesn't exist, say
> www.noddy.com/registry_dir/dont_exist.cgi this is not recorded in
> the error_log, just the access log, yet the correct 404 "File not
> found" response is displayed to the client.
> For locations managed by default handlers, attempts to access
> non-existent files is logged in both the access and error logs. Is
> is possible to activate this behaviour for the Apache::Registry
> handled location?
Have a look around lines 44-56 of Apache/Registry.pm - I'm sure you'll
see what you need there. That is if you've got mod_perl 1.24. Dunno if
the line numbers are the same elsewhere. it goes like this...
if (-r $filename && -s _) {
if (-d _) {
return DECLINED;
}
if (!($r->allow_options & OPT_EXECCGI)) {
$r->log_reason("Options ExecCGI is off in this directory",
$filename);
return FORBIDDEN;
}
unless (-x _ or $Is_Win32) {
$r->log_reason("file permissions deny server execution",
$filename);
return FORBIDDEN;
}
73,
Ged.
Re: Apache::Registry & error_log quirk
Posted by Doug MacEachern <do...@covalent.net>.
On Fri, 22 Sep 2000, Martin Wood wrote:
> We have a collection of CGIs in a single directory handled by Apache::Registry, however if we enter the name of a resource under that location that doesn't exist, say www.noddy.com/registry_dir/dont_exist.cgi this is not recorded in the error_log, just the access log, yet the correct 404 "File not found" response is displayed to the client.
>
> For locations managed by default handlers, attempts to access non-existent files is logged in both the access and error logs. Is is possible to activate this behaviour for the Apache::Registry handled location?
i guess that's because Apache::Registry doesn't log an error,
whoopsie. this patch fixes that.
Index: lib/Apache//PerlRun.pm
===================================================================
RCS file: /home/cvs/modperl/lib/Apache/PerlRun.pm,v
retrieving revision 1.29
diff -u -r1.29 PerlRun.pm
--- lib/Apache//PerlRun.pm 2000/06/01 21:07:56 1.29
+++ lib/Apache//PerlRun.pm 2000/09/28 16:31:12
@@ -60,6 +60,7 @@
$pr->{'mtime'} = -M _;
return wantarray ? (OK, $pr->{'mtime'}) : OK;
}
+ $pr->log_error("$filename not found or unable to stat");
return NOT_FOUND;
}
Index: lib/Apache//Registry.pm
===================================================================
RCS file: /home/cvs/modperl/lib/Apache/Registry.pm,v
retrieving revision 1.32
diff -u -r1.32 Registry.pm
--- lib/Apache//Registry.pm 2000/08/02 15:53:15 1.32
+++ lib/Apache//Registry.pm 2000/09/28 16:31:15
@@ -165,6 +165,7 @@
# }
return $r->status($old_status);
} else {
+ $r->log_error("$filename not found or unable to stat");
return NOT_FOUND unless $Debug && $Debug & 2;
return Apache::Debug::dump($r, NOT_FOUND);
}