[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

problem using iframe in perl script

Posted on 2004-10-29
6
Medium Priority
?
919 Views
Last Modified: 2011-10-03
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
Comment
Question by:Airgazm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 7

Expert Comment

by:rugdog
ID: 12449273
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
 
LVL 10

Expert Comment

by:Luxana
ID: 12449309
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
 

Author Comment

by:Airgazm
ID: 12449371
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.

 
LVL 10

Expert Comment

by:Luxana
ID: 12449514
#!/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
 
LVL 10

Accepted Solution

by:
Luxana earned 1500 total points
ID: 12449563
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
 

Author Comment

by:Airgazm
ID: 12449675
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question