You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Tom Allen <to...@nonserviam.net> on 2001/08/25 17:55:58 UTC

Connection Reset on Mandrake Linux 8.0 / Apache 1.3.20 / ModPerl 1.26

I installed ModPerl today, am excited, it seems to *mostly* work, 
however, every request is ending in a connection reset error.  This is 
difficult to search for, since this is apparently a common problem in NT 
under some situations.  I am running :
Mandrake Linux 8.0 (kernel 2.4.3-20mdk)
Apache 1.3.20
ModPerl 1.26

This is the script I am running :

#!/usr/bin/perl -w
use strict;

if ($ENV{"MOD_PERL"}) {
   print "Hello!";
   } else {
   print "I'm in slow motion :)";
}

I have two copies of the script, one running under ScriptAlias, the 
other running Alias under mod_perl.  Here is the location block for the 
modperl version:

<Location /modperl>
   AllowOverride None
   Options ExecCGI Indexes
   SetHandler perl-script
   PerlHandler Apache::Registry
   PerlSendHeader Off
</Location>

It appears to work ( I get a webpage that says Hello!), in a Mozilla 
browser, but httperf shows a connection reset instead of a success 
message, the same goes for lynx (Alert!: Unexpected network read error; 
connection aborted.).  The ScriptAlias version works fine.  The two 
scripts can be seen online at

Regular CGI version : http://www.nonserviam.net/perl/index.pl
ModPerl version: http://www.nonserviam.net/modperl/index.pl

Any thoughts / suggestions would be greatly appreciated.


Re: Connection Reset on Mandrake Linux 8.0 / Apache 1.3.20 / ModPerl 1.26

Posted by Joshua Chamas <jo...@chamas.com>.
Tom Allen wrote:
> ...
> <Location /modperl>
>    AllowOverride None
>    Options ExecCGI Indexes
>    SetHandler perl-script
>    PerlHandler Apache::Registry
>    PerlSendHeader Off
> </Location>
> 
> It appears to work ( I get a webpage that says Hello!), in a Mozilla
> browser, but httperf shows a connection reset instead of a success
> message, the same goes for lynx (Alert!: Unexpected network read error;
> connection aborted.).  The ScriptAlias version works fine.  The two
> scripts can be seen online at
> 
> Regular CGI version : http://www.nonserviam.net/perl/index.pl
> ModPerl version: http://www.nonserviam.net/modperl/index.pl
> 

When I test it, I get a 404 Not Found, which could explain
it.  But even when it is found, you might try setting
PerlSendHeader On, as it may not send a header otherwise.
Or you could try explicitly calling Apache->send_http_header
in your mod_perl version.

--Josh

]# lwp-request -eS http://www.nonserviam.net/modperl/index.pl
GET http://www.nonserviam.net/modperl/index.pl --> 404 Not Found
Connection: close
Date: Sat, 25 Aug 2001 23:58:43 GMT
Server: Apache/1.3.20 (Unix) mod_perl/1.26 PHP/4.0.6
Content-Type: text/html
Client-Date: Sun, 26 Aug 2001 00:00:09 GMT
Client-Peer: 65.34.152.103:80
Title: NonServiam!
X-Powered-By: PHP/4.0.6

<HTML>
<HEAD><TITLE>An Error Occurred</TITLE></HEAD>
<BODY>
<H1>An Error Occurred</h1>
404 Not Found
</BODY>
</HTML>

Re: Connection Reset on Mandrake Linux 8.0 / Apache 1.3.20 / ModPerl 1.26

Posted by Stas Bekman <st...@stason.org>.
> I guess the only thing I don't understand is why
> with PerlSendHeader Off, isnt the webserver supposed to send headers?
> Does it not because it doesn't know what kind of content a .pl file is?
> In that case, shouldn't it send DefaultType (text/plain) ?

http://perl.apache.org/guide/config.html#_Location_Configuration
(scroll down a bit)

_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
mailto:stas@stason.org   http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/



Re: Connection Reset on Mandrake Linux 8.0 / Apache 1.3.20 / ModPerl 1.26

Posted by Tom Allen <to...@nonserviam.net>.
Philip Mak wrote:

> I tried telneting to your web server to see what's going on. Look at this:
> 
> $ telnet www.nonserviam.net 80
> Trying 65.34.152.103...
> Connected to nonserviam.net.
> Escape character is '^]'.
> GET /modperl/index.pl HTTP/1.1
> Host: www.nonserviam.net
> 
> Hello!Connection closed by foreign host.
> 
> The HTTP server did not return a proper HTTP header, which is why lynx
> doesn't like it.
> 
> Looking at your mod_perl configuration...
> 
>>    PerlSendHeader Off
> 
> 
> Try doing it with PerlSendHeader On. You also might need to add this line
> at the beginning of your script:
> 
> print "Content-type: text/plain\n\n";
> 
> (or text/html)
> 
> 
Thanks a million.  I'm having one of those saturdays :-)  It works like 
a champ, of course.  I guess the only thing I don't understand is why 
with PerlSendHeader Off, isnt the webserver supposed to send headers?  
Does it not because it doesn't know what kind of content a .pl file is?  
In that case, shouldn't it send DefaultType (text/plain) ?

Thanks again, I'm going to run autobench again and see if we get better 
results :)



Re: Connection Reset on Mandrake Linux 8.0 / Apache 1.3.20 / ModPerl 1.26

Posted by Stas Bekman <st...@stason.org>.
On Sat, 25 Aug 2001, Philip Mak wrote:

> I tried telneting to your web server to see what's going on. Look at this:
>
> $ telnet www.nonserviam.net 80
> Trying 65.34.152.103...
> Connected to nonserviam.net.
> Escape character is '^]'.
> GET /modperl/index.pl HTTP/1.1
> Host: www.nonserviam.net
>
> Hello!Connection closed by foreign host.
>
> The HTTP server did not return a proper HTTP header, which is why lynx
> doesn't like it.
>
> Looking at your mod_perl configuration...
>
> >    PerlSendHeader Off
>
> Try doing it with PerlSendHeader On. You also might need to add this line
> at the beginning of your script:
>
> print "Content-type: text/plain\n\n";
>
> (or text/html)

I just wanted to add that you always have to send 'Content-type' header.
It's just that PerlSendHeader On reads your STDOUT, recognizes the header
at a cost (see the guide) and then sends it along with other headers. With
PerlSendHeader Off, you should use either CGI.pm or mod_perl native
methods to set the headers. It's all in the guide :)


_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
mailto:stas@stason.org   http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/



Re: Connection Reset on Mandrake Linux 8.0 / Apache 1.3.20 / ModPerl 1.26

Posted by Philip Mak <pm...@aaanime.net>.
I tried telneting to your web server to see what's going on. Look at this:

$ telnet www.nonserviam.net 80
Trying 65.34.152.103...
Connected to nonserviam.net.
Escape character is '^]'.
GET /modperl/index.pl HTTP/1.1
Host: www.nonserviam.net

Hello!Connection closed by foreign host.

The HTTP server did not return a proper HTTP header, which is why lynx
doesn't like it.

Looking at your mod_perl configuration...

>    PerlSendHeader Off

Try doing it with PerlSendHeader On. You also might need to add this line
at the beginning of your script:

print "Content-type: text/plain\n\n";

(or text/html)