You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Lee Goddard <ho...@LeeGoddard.com> on 2003/02/03 23:00:29 UTC

Re[2]: cgi and mod_perl-1.26, Apache-1.27, perl-5.8.0, FreeBSD failwith 'The document contained no data'

-----BEGIN PGP SIGNED MESSAGE-----
Hash: MD5

Hi George,

On Monday, February 3, 2003 at 10:47:47 PM, you wrote:

GS> Hi Lee,

GS> Thanks for your reply.  I tried the script you sent and it failed
GS> with "document contains no data".  This is odd because I
GS> previously found that mod_perl API scripts ran ok but CGI scripts
GS> running under mod_perl failed.

GS> The script printed some output in the log which I have attached
GS> below.  I've also attached the earlier messages in the thread in
GS> case they might help.

Yes, sorry: it sent the warnings to the log.
I just meant that if you ran that little script
from the command line, it should show you exactly
what you are getting back: whether or not the
document really has no data, or whether there is
a CRLF missing between the header and content body.

My guess is that it's your user agent, not your
server. I've had all sorts of problems with Macintosh
browsers not displaying things that everything except
Lynx will.....

I don't know: you're doing this:

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

Does it (probably not) make any difference if
you do a full CRLF, as perldoc perlop:

    For example, most networking protocols expect
    and prefer a CR+LF (""\015\012"" or ""\cM\cJ"") for line terminators,
    and although they often accept just ""\012"", they seldom tolerate just
    ""\015"". If you get in the habit of using ""\n"" for networking, you
    may be burned some day.

- --
Cheers
 Lee                            mailto:home@LeeGoddard.com

$$=qw$808273788400074285838400657879847269820080698276007265677569820727$;
$$=~s$(\d\d)$\$_.=chr(\$1+32)$ge;eval;

-----BEGIN PGP SIGNATURE-----
Version: 2.6

iQCVAwUAPj7mfqdrfekeF/QBAQHcogP+P6ebE/Qz72C6s960eRTG7v18IMBW3y1U
e0QD4gjmlrDKwXhUKSfQYj3PEE0RJ06E/XeyqkGa08wnHWmMvAURuIDsiffaSIbl
pmWBEWMwoJBy0ywXPa4vMVRH/FvII7nGdymCkFSW5bzwRi2TxTxnIogZScMaB1Kd
5GFV7Wpgsj8=
=MQdQ
-----END PGP SIGNATURE-----


Re: cgi and mod_perl-1.26, Apache-1.27, perl-5.8.0, FreeBSD failwith 'The document contained no data'

Posted by Stas Bekman <st...@stason.org>.
Lee Goddard wrote:

>>>I don't know: you're doing this:
>>>
>>>  print "Content-type: text/plain\n\n";
>>>  print "Hello World\n";
>>>
>>>Does it (probably not) make any difference if
>>>you do a full CRLF, as perldoc perlop:
>>>
>>>    For example, most networking protocols expect
>>>    and prefer a CR+LF (""\015\012"" or ""\cM\cJ"") for line terminators,
>>>    and although they often accept just ""\012"", they seldom tolerate just
>>>    ""\015"". If you get in the habit of using ""\n"" for networking, you
>>>    may be burned some day.
>>
> 
> SB> Apache already fixes up "\n\n" to the right thing. What it really does
> SB> is identifying the Content-type: header, and then adds the terminating
> SB> by itself, because it really sends other headers, before adding an
> SB> empty new line. So it shouldn't matter if you say "\r\n\r\n" or just
> SB> "\n\n", unless there is a bug.
> 
> So if Apache (mod_perl) adds this to his script, even
> though it is not a mod_perl script, then shouldn't he
> be calling it from a <Location> that isn't mod_perl
> enabled...?
> 
> Sorry, just getting into this Apache module thing....

The script sends the header, which could be multiline and terminates it with 
an empty new line. By saying 'PerlSendHeader On' you tell mod_perl to parse 
the headers (which is actually done by an apache functions) and separate them 
from the body. Apache then adds other headers (Server token, Date, etc) and 
sends the response as if it was a mod_perl module. Think of Apache::Registry 
and friends as mod_cgi on mushrooms.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: cgi and mod_perl-1.26, Apache-1.27, perl-5.8.0, FreeBSD failwith 'The document contained no data'

Posted by George Savvides <gs...@kilani.demon.co.uk>.
Hi guys,

Thanks for your replies.  Problem still not solved but I'll let
you know if I find an answer.

George.



Lee Goddard wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: MD5
> 
> Hi Stas,
> 
> On Tuesday, February 4, 2003 at 2:47:43 AM, you wrote:
> 
> SB> Lee Goddard wrote:
> SB> [...]
> >> I don't know: you're doing this:
> >>
> >>   print "Content-type: text/plain\n\n";
> >>   print "Hello World\n";
> >>
> >> Does it (probably not) make any difference if
> >> you do a full CRLF, as perldoc perlop:
> >>
> >>     For example, most networking protocols expect
> >>     and prefer a CR+LF (""\015\012"" or ""\cM\cJ"") for line terminators,
> >>     and although they often accept just ""\012"", they seldom tolerate just
> >>     ""\015"". If you get in the habit of using ""\n"" for networking, you
> >>     may be burned some day.
> 
> SB> Apache already fixes up "\n\n" to the right thing. What it really does
> SB> is identifying the Content-type: header, and then adds the terminating
> SB> by itself, because it really sends other headers, before adding an
> SB> empty new line. So it shouldn't matter if you say "\r\n\r\n" or just
> SB> "\n\n", unless there is a bug.
> 
> So if Apache (mod_perl) adds this to his script, even
> though it is not a mod_perl script, then shouldn't he
> be calling it from a <Location> that isn't mod_perl
> enabled...?
> 
> Sorry, just getting into this Apache module thing....
> 
> Cheers
> lee
> 
> - --
> Cheers
>  Lee                            mailto:home@LeeGoddard.com
> 
> $$=qw$808273788400074285838400657879847269820080698276007265677569820727$;
> $$=~s$(\d\d)$\$_.=chr(\$1+32)$ge;eval;
> 
> -----BEGIN PGP SIGNATURE-----
> Version: 2.6
> 
> iQCVAwUAPj+AYqdrfekeF/QBAQErkgQApGgGWv78D4in/2NmcoBTqMPdKKyYUZia
> ZN7chLUcduSoyqftj70iU0+PCAheJqX6k+9Q/bErraOoP4g3S5aMW99zYMLfXKtx
> XhTHhusNkroSGKpyXI7FlyKOaQqDLN+S8vm5QAlEkZlK6ZfgovgevSnCqfsiuc48
> /EW2drjX1w0=
> =Ef7H
> -----END PGP SIGNATURE-----

-- 
7, College View, Cirencester, Gloucestershire, GL7 1WD, UK
07957 141204
gs@kilani.demon.co.uk

Re[2]: cgi and mod_perl-1.26, Apache-1.27, perl-5.8.0, FreeBSD failwith 'The document contained no data'

Posted by Lee Goddard <ho...@LeeGoddard.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: MD5

Hi Stas,

On Tuesday, February 4, 2003 at 2:47:43 AM, you wrote:

SB> Lee Goddard wrote:
SB> [...]
>> I don't know: you're doing this:
>>
>>   print "Content-type: text/plain\n\n";
>>   print "Hello World\n";
>>
>> Does it (probably not) make any difference if
>> you do a full CRLF, as perldoc perlop:
>>
>>     For example, most networking protocols expect
>>     and prefer a CR+LF (""\015\012"" or ""\cM\cJ"") for line terminators,
>>     and although they often accept just ""\012"", they seldom tolerate just
>>     ""\015"". If you get in the habit of using ""\n"" for networking, you
>>     may be burned some day.

SB> Apache already fixes up "\n\n" to the right thing. What it really does
SB> is identifying the Content-type: header, and then adds the terminating
SB> by itself, because it really sends other headers, before adding an
SB> empty new line. So it shouldn't matter if you say "\r\n\r\n" or just
SB> "\n\n", unless there is a bug.

So if Apache (mod_perl) adds this to his script, even
though it is not a mod_perl script, then shouldn't he
be calling it from a <Location> that isn't mod_perl
enabled...?

Sorry, just getting into this Apache module thing....

Cheers
lee

- --
Cheers
 Lee                            mailto:home@LeeGoddard.com

$$=qw$808273788400074285838400657879847269820080698276007265677569820727$;
$$=~s$(\d\d)$\$_.=chr(\$1+32)$ge;eval;

-----BEGIN PGP SIGNATURE-----
Version: 2.6

iQCVAwUAPj+AYqdrfekeF/QBAQErkgQApGgGWv78D4in/2NmcoBTqMPdKKyYUZia
ZN7chLUcduSoyqftj70iU0+PCAheJqX6k+9Q/bErraOoP4g3S5aMW99zYMLfXKtx
XhTHhusNkroSGKpyXI7FlyKOaQqDLN+S8vm5QAlEkZlK6ZfgovgevSnCqfsiuc48
/EW2drjX1w0=
=Ef7H
-----END PGP SIGNATURE-----


Re: cgi and mod_perl-1.26, Apache-1.27, perl-5.8.0, FreeBSD failwith 'The document contained no data'

Posted by Stas Bekman <st...@stason.org>.
Lee Goddard wrote:
[...]
> I don't know: you're doing this:
> 
>   print "Content-type: text/plain\n\n";
>   print "Hello World\n";
> 
> Does it (probably not) make any difference if
> you do a full CRLF, as perldoc perlop:
> 
>     For example, most networking protocols expect
>     and prefer a CR+LF (""\015\012"" or ""\cM\cJ"") for line terminators,
>     and although they often accept just ""\012"", they seldom tolerate just
>     ""\015"". If you get in the habit of using ""\n"" for networking, you
>     may be burned some day.

Apache already fixes up "\n\n" to the right thing. What it really does
is identifying the Content-type: header, and then adds the terminating
by itself, because it really sends other headers, before adding an
empty new line. So it shouldn't matter if you say "\r\n\r\n" or just
"\n\n", unless there is a bug.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com