Hi Robert

Thanks for answering.  

If I restart the web server and use the HEAD command as the very first
request, I get:

%> HEAD http://iahc-linux13.iah.bbsrc.ac.uk/Gallus_gallus/mapview?chr=1
500 Internal Server Error
Connection: close
Date: Wed, 18 Apr 2007 08:56:57 GMT
Server: Apache
Content-Type: text/plain
Client-Date: Wed, 18 Apr 2007 08:56:58 GMT
Client-Response-Num: 1 

(however the same address displays in IE without HTML headers and with
special characters).
My log file shows:

[Wed Apr 18 09:56:55 2007] [notice] Apache/2.2.4 (Unix) mod_perl/2.0.3
Perl/v5.8.0 configured -- resuming normal operations
[Wed Apr 18 09:56:57 2007] [error] [client 149.155.40.20] malformed
header from script. Bad header=<head>: mapview
[Wed Apr 18 09:56:57 2007] [warn] /perl/Gallus_gallus/mapview did not
send an HTTP header
[Wed Apr 18 09:57:45 2007] [error] [client 149.155.42.148] malformed
header from script. Bad header=<head>: mapview
[Wed Apr 18 09:57:45 2007] [warn] /perl/Gallus_gallus/mapview did not
send an HTTP header

I must confess, I don't really know what the Apache::Registry and
ModPerl::Registry modules actually do, but the code in question is
handled by ModPerl::Registry.  From httpd.conf (mostly a perl script!):

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

Now, in terms of grepping "Content-type", or indeed "content_type" (to
check for calls to apache modules to set the header) there isn't really
anything obvious... A bunch of test scripts, some user web pages etc,
but nothing that seems to specifically print out these headers...

Thanks
Mick

-----Original Message-----
From: Robert Landrum [mailto:[EMAIL PROTECTED] 
Sent: 16 April 2007 17:45
To: michael watson (IAH-C)
Cc: modperl@perl.apache.org
Subject: Re: Malformed header from script

michael watson (IAH-C) wrote:
> Sorry for the confusion....
> 
> The code also actually attempts to print out HTML headers ie
> "<HTML><HEAD> etc" but these DO NOT come through to the webpage -
> instead, a bunch of special characters are printed out... 

Right...  because the <HTML> and <HEAD> tags are being (incorrectly) 
shoved into the Content-type field by apache..

 From the command line do:

HEAD http://my.web.host.com

I bet you'll see Content-Type: <HTML><HEAD> or something close to that.

Apache is expecting the first two lines of your output to be a content 
type header.

I suspect that the reason you're running into this issue is because the 
original code was never intended to be run as a Apache::Registry script,

and that the content type printing is being controlled by a global
variable.

i.e.

print "Content-type: foo/bar\n\n" if($HEADER_PRINTED == 0);
$HEADER_PRINTED = 1;

That global variable is never being reset to 0, and thus all requests 
(except the very first) end up being sent across without a header.

I could be wrong, but I would start grepping for 'Content-type' in the
code.

Rob

Reply via email to