Skip Menu |

This queue is for tickets about the Apache-Pod CPAN distribution.

Report information
The Basics
Id: 1633
Status: new
Priority: 0/
Queue: Apache-Pod

People
Owner: Nobody in particular
Requestors: comdog [...] panix.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.02
Fixed in: (no value)



Subject: Apache::Pod::HTML returns server error for unknown files
if Apache::Pod::HTML cannot open the file getpod gives it, it does not handle the error. it should either decline the request or return something useful. this patch also returns the right apache constant in either case and uses the Apache::Log version of warn() instead of the builtin version. localhost_brian[3011]$ diff HTML.pm HTML.pm.bdf 9,11c9 < Version 0.02 < < $Header: /home/cvs/apache-pod/lib/Apache/Pod/HTML.pm,v 1.5 2002/09/30 04:42:05 andy Exp $ --- Show quoted text
> Version 0.02_01
19c17 < $VERSION = '0.02'; --- Show quoted text
> $VERSION = '0.02_01';
60a59,60 Show quoted text
> use Apache::Log; > use Apache::Constants qw(:common);
66d65 < $r->content_type('text/html'); 70c69 < warn "Got back [$file]"; --- Show quoted text
> $r->warn( "Got back [$file]" );
72c71 < if ( $file ) { --- Show quoted text
> if ( -e $file ) {
78c77 < $body = "<HTML><BODY>That module doesn't exist</BODY></HTML>"; --- Show quoted text
> return DECLINED;
80a80 Show quoted text
> $r->content_type('text/html');
82c82,84 < print $body; --- Show quoted text
> $r->print( $body ); > > return OK;
localhost_brian[3012]$ diff -u -d HTML.pm HTML.pm.bdf --- HTML.pm Tue Oct 8 16:29:46 2002 +++ HTML.pm.bdf Tue Oct 8 16:55:54 2002 @@ -6,9 +6,7 @@ =head1 VERSION -Version 0.02 - - $Header: /home/cvs/apache-pod/lib/Apache/Pod/HTML.pm,v 1.5 2002/09/30 04:42:05 andy Exp $ +Version 0.02_01 =cut @@ -16,7 +14,7 @@ eval 'use warnings' if $] >= 5.006; use vars qw( $VERSION ); -$VERSION = '0.02'; +$VERSION = '0.02_01'; =head1 SYNOPSIS @@ -58,28 +56,32 @@ =cut +use Apache::Log; +use Apache::Constants qw(:common); use Apache::Pod; use Pod::Simple::HTML; sub handler { my $r = shift; - $r->content_type('text/html'); my $body; my $file = Apache::Pod::getpodfile( $r ); - warn "Got back [$file]"; + $r->warn( "Got back [$file]" ); - if ( $file ) { + if ( -e $file ) { my $parser = Pod::Simple::HTML->new; $parser->output_string( \$body ); $parser->parse_file( $file ); # XXX Send the timestamp of the file in the header } else { - $body = "<HTML><BODY>That module doesn't exist</BODY></HTML>"; + return DECLINED; } + $r->content_type('text/html'); $r->send_http_header; - print $body; + $r->print( $body ); + + return OK; } 1;