• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 943
  • Last Modified:

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




0
Airgazm
Asked:
Airgazm
  • 3
  • 2
1 Solution
 
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
 
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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
 
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
 
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now