That does indeed make the HTML headers come through, however, I get
about 20 "Content-type: text/html" lines in my web page because that
print function is used to print out ALL HTML, not just the headers.

httpd.conf has:

$Location{"/perl"}={
  SetHandler      =>  'perl-script',
  PerlHandler     =>  'ModPerl::Registry',
#  Options         =>  '+ExecCGI',
  allow           =>  'from all',
  PerlSendHeader  =>  'On',
};

The code I am running is the directory "/perl", so it is
ModPerl::Registry that should be handling these.

So each perl script under /perl should specifically print out a
"Content-type: text/html\n\n" line?

-----Original Message-----
From: Clinton Gormley [mailto:[EMAIL PROTECTED] 
Sent: 16 April 2007 10:38
To: michael watson (IAH-C)
Cc: modperl
Subject: RE: Malformed header from script

On Mon, 2007-04-16 at 10:33 +0100, michael watson (IAH-C) wrote:
> If I was missing the "Content-type: text/html" line, then my web
browser
> would not display anything except the "500: Internal Server Error"
line,
> wouldn't it?

No.

Try it.

Just add:

$r->print ("Content-Type: text/html\n\n")

...before you print the rest.

I may be wrong, but it is easy enough to figure out if it works or not.

clint

> 
> My error logs say:
> 
> [Mon Apr 16 10:24:07 2007] [error] [client 149.155.42.148] malformed
> header from script. Bad header=<head>: contigview
> [Mon Apr 16 10:24:07 2007] [warn] /perl/Gallus_gallus/contigview did
not
> send an HTTP header
> 
> OK, I can accept it may be the HTTP header that is not coming through,
> but would that explain why my HTML header doesn't come through?  What
> about the special characters?
> 
> I'll get Firefox now.. :)
> 
> Thanks
> 
> Mick
> 
> -----Original Message-----
> From: Clinton Gormley [mailto:[EMAIL PROTECTED] 
> Sent: 16 April 2007 10:28
> To: michael watson (IAH-C)
> Cc: modperl@perl.apache.org
> Subject: RE: Malformed header from script
> 
> > r is Apache2::RequestRec=SCALAR(0x98d2108)
> > I was given '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
> > Transitional//EN"
> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> >  <html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en-gb"
> > lang="en-gb">
> >  <head>
> > '
> > 
> > So, the perl code is using an Apache2::RequestRec object to print
out
> > the header, and I am using a simple 'print STDERR' statement to
print
> > out the same thing to the error log.  My 'print STDERR' statement
> works
> > fine and the header gets printed to the apache error log.  However,
my
> > web page DOES NOT have an HTML header:
> 
> It is not an HTML header that is lacking, but an HTTP header - your
web
> browser has no idea what type of page you are sending it.
> 
> At the very least, you need:
> --------------------------------
> Content-Type: text/html
> 
> --------------------------------
> (not the dashed lines, but the bits in between _ a content-type header
> plus a new line to separate the headers from the content itself.
> 
> You'll find debugging a whole lot easier if you use Firefox with an
> add-on like Firebug - it gives you much more information about what is
> going on behind the scenes. 
> 
> 
> Clint
> 

Reply via email to