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 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 Leemailto:[EMAIL PROTECTED] $$=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'
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 Leemailto:[EMAIL PROTECTED] $$=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 [EMAIL PROTECTED]
Re: cgi and mod_perl-1.26, Apache-1.27, perl-5.8.0, FreeBSD failwith 'The document contained no data'
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 BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] 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'
Hi Lee, Thanks for your reply. I tried the script you sent and it failed with document contains no data. This is odd because I previously found that mod_perl API scripts ran ok but CGI scripts running under mod_perl failed. The script printed some output in the log which I have attached below. I've also attached the earlier messages in the thread in case they might help. Any further comments much appreciated. George Savvides. Script output = I've edited the output, removing most of the HTML which is quite long, please let me know if I've left out something important. Connection: close Date: Mon, 03 Feb 2003 09:36:13 GMT Server: Apache Content-Type: text/html Client-Date: Mon, 03 Feb 2003 09:36:13 GMT Client-Peer: 194.203.134.150:80 Link: /xxx/styles/menu.css; rel=stylesheet; type=text/css Title: xxx - anti-virus for business X-Meta-Description: xxx Anti-Virus, leading anti-virus developer, provide information and software designed to counter computer viruses, trojan horses, and virus hoaxes. Software available for download. X-Meta-Generator: HTML Tidy for FreeBSD (vers 1st February 2002), see www.w3.org X-Meta-Keywords: xxx, anti-virus, anti virus, antivirus, data security, software, SWEEP, InterCheck, Windows, Windows 3.1x, DOS, Windows 95/98, Windows NT, OS/2, NetWare, OpenVMS, Unix, Macintosh, Windows 2000, free, protection, downloads gateway virus protection X-Meta-MSSmartTagsPreventParsing: TRUE Apache::ROOTse_2diceland_2exxx_2ecom::perlbin::testwarn_2epl::handler('Apache=SCALAR(0xb094330)') called at /usr/local/lib/perl5/site_perl/5.8.0/i386-freebsd/Apache/Registry.pm line 143 eval {...} called at /usr/local/lib/perl5/site_perl/5.8.0/i386-freebsd/Apache/Registry.pm line 143 Apache::Registry::handler('Apache=SCALAR(0xb094330)') called at /dev/null line 0 eval {...} called at /dev/null line 0 html lang=en head meta name=generator content=HTML Tidy for FreeBSD (vers 1st February 2002), see www.w3.org etc ... html /tr /table br !-- xxx Footer: end -- /body /html Apache::ROOTse_2diceland_2exxx_2ecom::perlbin::testwarn_2epl::handler('Apache=SCALAR(0xb094330)') called at /usr/local/lib/perl5/site_perl/5.8.0/i386-freebsd/Apache/Registry.pm line 143 eval {...} called at /usr/local/lib/perl5/site_perl/5.8.0/i386-freebsd/Apache/Registry.pm line 143 Apache::Registry::handler('Apache=SCALAR(0xb094330)') called at /dev/null line 0 eval {...} called at /dev/null line 0 Previous messages in thread === My original message --- Hi all, I am having problems running cgi scripts under mod_perl. I realise that this question has been asked before but I have not been able to find a reference to this particular behaviour in the manuals or newsgroups. Problem summary --- Scripts running under mod_perl fail. Netscape returns the popup 'The document contained no data' Nothing is printed in the browser window. Scripts that use the mod_perl api work OK. Example scripts --- The cgi script below fails. #!/usr/bin/perl -w print Content-type: text/plain\n\n; print Hello World\n; The mod_perl api script below works. my $r = Apache-request; $r-content_type(text/plain); $r-send_http_header; $r-print(Hello World); Script configuration Alias /perlbin ${TOP}/perlbin PerlModule Apache::Registry Location /perlbin SetHandler perl-script Perlhandler Apache::Registry Options +ExecCGI allow from all PerlSendHeader On /Location Machine config -- The cgi script fails on this box: FreeBSD 4.5-RELEASE-p23 Apache/1.3.27 perl-5.8.0 mod_perl-1.26 The same cgi script with the same script config works fine on this one: FreeBSD 4.5-RELEASE-p23 Apache/1.3.20 perl-5.005_03 mod_perl-1.26 It looks as if the CGI script is not returning its stdout to the browser but I can't for the life of me see why. Any help would be very much appreciated. George Savvides Reply from Stas Bekman -- What has error_log to say about this? Do you have the file perms right? Lee Goddard wrote: -BEGIN PGP SIGNED MESSAGE- Hash: MD5 Hi George, I've not seen any of this thread other than what's below, but have you had all the headers output correctly? Try running this after setting $url, and see what you get: use LWP::UserAgent; $url = http://195.117.126.24;; $ua = LWP::UserAgent-new; $req = new HTTP::Request('GET', $url); # Format URL request $res = $ua-request($req); if (not $res-is_success()) { die ...failed:\n . $res-error_as_HTML } warn $res-headers_as_string; warn $res-content; #open OUT, /test.html; #print OUT $res-content; #close OUT; exit; Lee On Sunday, February 2, 2003 at 7:42:12 PM, you wrote: GS Hi Stas, GS Thanks for your reply. GS The file perms are correct and nothing is printed to the logs. GS The scripts do run. If you write a script with a redirect in it GS for instance
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 Leemailto:[EMAIL PROTECTED] $$=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'
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 BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] 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'
Hi Stas, Thanks for your reply. The file perms are correct and nothing is printed to the logs. The scripts do run. If you write a script with a redirect in it for instance, the redirect is made. They just don't seem to print anything to stdout. Regards, George Savvides. Stas Bekman wrote: What has error_log to say about this? Do you have the file perms right? __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
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, I've not seen any of this thread other than what's below, but have you had all the headers output correctly? Try running this after setting $url, and see what you get: use LWP::UserAgent; $url = http://195.117.126.24;; $ua = LWP::UserAgent-new; $req = new HTTP::Request('GET', $url); # Format URL request $res = $ua-request($req); if (not $res-is_success()) { die ...failed:\n . $res-error_as_HTML } warn $res-headers_as_string; warn $res-content; #open OUT, /test.html; #print OUT $res-content; #close OUT; exit; Lee On Sunday, February 2, 2003 at 7:42:12 PM, you wrote: GS Hi Stas, GS Thanks for your reply. GS The file perms are correct and nothing is printed to the logs. GS The scripts do run. If you write a script with a redirect in it GS for instance, the redirect is made. They just don't seem to GS print anything to stdout. GS Regards, George Savvides. GS Stas Bekman wrote: What has error_log to say about this? Do you have the file perms right? - -- Cheers Leemailto:[EMAIL PROTECTED] $$=qw$808273788400074285838400657879847269820080698276007265677569820727$; $$=~s$(\d\d)$\$_.=chr(\$1+32)$ge;eval; -BEGIN PGP SIGNATURE- Version: 2.6 iQCVAwUAPj1zYqdrfekeF/QBAQEDxgQAoYOSvKGOBHUXgwRcRHdatlAo71tpR4NQ 55fgPbL0e20JiKQ+0X8xbbT6Lixh1ytkIfJZIr3J+7iiIYagkGkrMukFw9IrfMgF pxu5zY589u1U8BrSzlQIUtMuvmtc40JXZMh5jc/zuasVw0WaeHRVAVsi6wa7qCDE 4MDgvzcuz/g= =k9JH -END PGP SIGNATURE-
cgi and mod_perl-1.26, Apache-1.27, perl-5.8.0, FreeBSD fail with 'The document contained no data'
Hi all, I am having problems running cgi scripts under mod_perl. I realise that this question has been asked before but I have not been able to find a reference to this particular behaviour in the manuals or newsgroups. Problem summary --- Scripts running under mod_perl fail. Netscape returns the popup 'The document contained no data' Nothing is printed in the browser window. Scripts that use the mod_perl api work OK. Example scripts --- The cgi script below fails. #!/usr/bin/perl -w print Content-type: text/plain\n\n; print Hello World\n; The mod_perl api script below works. my $r = Apache-request; $r-content_type(text/plain); $r-send_http_header; $r-print(Hello World); Script configuration Alias /perlbin ${TOP}/perlbin PerlModule Apache::Registry Location /perlbin SetHandler perl-script Perlhandler Apache::Registry Options +ExecCGI allow from all PerlSendHeader On /Location Machine config -- The cgi script fails on this box: FreeBSD 4.5-RELEASE-p23 Apache/1.3.27 perl-5.8.0 mod_perl-1.26 The same cgi script with the same script config works fine on this one: FreeBSD 4.5-RELEASE-p23 Apache/1.3.20 perl-5.005_03 mod_perl-1.26 It looks as if the CGI script is not returning its stdout to the browser but I can't for the life of me see why. Any help would be very much appreciated. George Savvides
Re: cgi and mod_perl-1.26, Apache-1.27, perl-5.8.0, FreeBSD failwith 'The document contained no data'
George Savvides wrote: Hi all, I am having problems running cgi scripts under mod_perl. I realise that this question has been asked before but I have not been able to find a reference to this particular behaviour in the manuals or newsgroups. Problem summary --- Scripts running under mod_perl fail. Netscape returns the popup 'The document contained no data' Nothing is printed in the browser window. Scripts that use the mod_perl api work OK. Example scripts --- The cgi script below fails. #!/usr/bin/perl -w print Content-type: text/plain\n\n; print Hello World\n; The mod_perl api script below works. my $r = Apache-request; $r-content_type(text/plain); $r-send_http_header; $r-print(Hello World); Script configuration Alias /perlbin ${TOP}/perlbin PerlModule Apache::Registry Location /perlbin SetHandler perl-script Perlhandler Apache::Registry Options +ExecCGI allow from all PerlSendHeader On /Location Machine config -- The cgi script fails on this box: FreeBSD 4.5-RELEASE-p23 Apache/1.3.27 perl-5.8.0 mod_perl-1.26 The same cgi script with the same script config works fine on this one: FreeBSD 4.5-RELEASE-p23 Apache/1.3.20 perl-5.005_03 mod_perl-1.26 It looks as if the CGI script is not returning its stdout to the browser but I can't for the life of me see why. Any help would be very much appreciated. What has error_log to say about this? Do you have the file perms right? __ Stas BekmanJAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide --- http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
Document Contained No Data
I am trying to convert a cgi script to a mod_perl script, however when I try to run the script I can a "Document contained no data error". I was wondering if there are some standard causes for this kind of error. Thanks in advance for any help. Joe Grastara Project Assistant Digital Media Center The Skirball Institute Of Biomolecular Medicine New York University Medical Center 540 First Ave., New York City, NY 10016 USA [EMAIL PROTECTED] http://www.med.nyu.edu/graphics
Re: Document Contained No Data
I am trying to convert a cgi script to a mod_perl script, however when I try to run the script I can a "Document contained no data error". I was wondering if there are some standard causes for this kind of error. http://perl.apache.org/guide/debug.html#Curing_The_Internal_Server_Erro Thanks in advance for any help. Joe Grastara Project Assistant Digital Media Center The Skirball Institute Of Biomolecular Medicine New York University Medical Center 540 First Ave., New York City, NY 10016 USA [EMAIL PROTECTED] http://www.med.nyu.edu/graphics _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://apachetoday.com http://logilune.com/ http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
Re: Document Contained No Data
The most likely cause of this error is that your script is only sending the http headers and not any content. That said, there are several other things that could go wrong along the way. For example, if your script's output ... most likely $r-print("here is some stuff") ... is a single line of text or a scalar that contains a single line of text, you will need to append a single new-line character to force your client to display the output. Also, your script might contain a logic error or an unscoped variable that makes the content you are trying to generate undefinied. As always check the error log for clues. If you are sure that content is being sent to the client there might be something more sinister at work, and you might want to post the relevant code and error log to the group. Joe Grastara once wrote: I am trying to convert a cgi script to a mod_perl script, however when I try to run the script I can a "Document contained no data error". I was wondering if there are some standard causes for this kind of error. Thanks in advance for any help. Joe Grastara Project Assistant Digital Media Center The Skirball Institute Of Biomolecular Medicine New York University Medical Center 540 First Ave., New York City, NY 10016 USA [EMAIL PROTECTED] http://www.med.nyu.edu/graphics #---# # Brett Paden # # http://www.trimeros.com # # [EMAIL PROTECTED]# #---#
Re: document contained no data
One other thing... Make sure your DB connections are timing out. Blue wrote: On Wed, 21 Jun 2000, darren chamberlain wrote: The problem seems to arise when your handler returns something (a status code) but hasn't send any data. Turning off buffering ($|) will only help if you actually send something. Try telnetting to port 80 on the web server and issue some HTTP commands directly, and see what the response is; that might give you some insight. I am always careful to not call die or return until I have sent the header, since that can cause the situation you are seeing. ah, good call, darren. the other reason i've seen this happen is plain ol' failure of the script to execute, for whatever reason. tailing the error log or running the script manually is a good way to check for that. when this question first came up, i checked all the FAQS i could find to see if there was somewhere i could point the poster. does anyone know of a comprehensive addressing of perl/mod_perl cgi errors on the net? danke, -- Blue Lang Unix Systems Admin QSP, Inc., 3200 Atlantic Ave, Ste 100, Raleigh, NC, 27604 Home: 919 835 1540 Work: 919 875 6994 Fax: 919 872 4015 -- __ Mr. Erich L. Markert [EMAIL PROTECTED] Computer Learning Center TEL (914)422-4328 Pace University 1 Martine Ave White Plains, New York 10606-1932 Those who do not understand Unix are condemned to reinvent it, poorly. -- Henry Spencer
Re: document contained no data
I posted the message again because it didn't work when i put $| = 1; or $r-rflush() at top or around print statement as some people suggested. It is very confused. it should work without putting those things. The thing affects performance. What i need to do, your any answers would be very much appreciated. Steven Steven Zhu wrote: Hi, All: We have a coffee site with apache_1.3.9, modperl_1.2.1 and mysql database. It works fine in most time. But sometimes it is strange. For instance, the same script works fine sometimes, but sometimes it popups a window with message "The document contained no data Try again later, or contact the server's administrator". It seems that the print statement does not work fine. Any idea. Thank in advance for your quick reply. Steven.