problem using iframe in perl script

Hi,

I get this error,

----------------------------------------
502 Bad Gateway
The CGI was not CGI/1.1 compliant
----------------------------------------
when I use my cgi script.

The script basiclly consists of code plus some HTML output as follows
-------------------------------------------------------------------------------------
cgi code

print <<ENDHTML;
<html><head><title>Agreement</title></head>
<body>
some html text here
<iframe src="agreement.html" name="subscriber_agreement"></iframe>
some more html text here
</body></html>
ENDHTML
---------------------------------------------------------------------------------------

The cgi script loads just fine and dandy, but inside the Iframe, I get the above error.  
The code that is in the agreement.html is simple text nothing fancy, which loads just fine in it's own window.

I'm using a Linux box with the Boa Web Server.  

I'm really baffeled with this one, it's as if you cannot use and iframe in a cgi document.

Thanks for any help.
-air




AirgazmAsked:
Who is Participating?
 
LuxanaCommented:
or if you want do it your way :

#!/usr/bin/perl
use CGI;
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);

print "Content-type:text/html\n\n";
print <<ENDHTML
<html><head><title>title</title></head>
<body>
test
<iframe src='../agrim.html' name='agreement'></iframe>
</body>
</html>
ENDHTML

------

do not use ";" in line with print <<ENDHTML
0
 
rugdogCommented:
did you print the HTTP header at the beginning?, since not all your code is posted. But you should have a line like the following before sending the HTML code:

print "content-type: text/html\n\n";

0
 
LuxanaCommented:
Strict CGI output compliance can be enabled and disabled using the [CgiStrictOutput] configuration directive. With it disabled the server will accept any output from the script, if not CGI or NPH compliant then it automatically generates plain-text header. When enabled, if not a CGI or NPH header the server returns a "502 Bad Gateway" error. For debugging scripts generating this error introduce a plain-text debug mode and header, or use the WATCH facility's CGI item
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
AirgazmAuthor Commented:
yeah, all that's there as far as header.

I just got it to work by changing the agreement.html file into a .pl file and adding the necessarry cgi stuff to the .pl file, now it shows in the I frame just fine.

So, now I know it works as a .pl file but not as a .html file.

keep in mind, I have my www root directory set to /cgi-bin/

I ran some new test code that fails,
-------------------------------------------
test.pl
-------------------------------------------
#!/usr/bin/perl
use CGI;
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);

print "Content-type:text/html\n\n";
print <<ENDHTML;
<html><head><title>title</title></head>
<body>
test
<iframe src='agreement.html' name='agreement'></iframe>
</body>
</html>
ENDHTML
--------------------------------------------------------------------
agreement.html
---------------------------------------------------------------------
<html>
<head><title>Agreement</title></head>
<body>
test
</body></html>
----------------------------------------------------------------------

Thanks
-air

0
 
LuxanaCommented:
#!/usr/bin/perl
use CGI;
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);

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

print qq`

<html><head><title>title</title></head>
<body>
test
<iframe src='../agreement.html' name='agreement'></iframe>
</body>
</html>
`;


---------------
this is working for me...where agreement.html is in /var/www and test.pl is /usr/lib/cgi-bin


0
 
AirgazmAuthor Commented:
Well it seems it was because I was running the Iframe .html page out of the cgi-bin directory.

I put the .html file for the iframe into /var/www and everything worked just fine.

Thanks for the help
-air

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.