Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Perl CGI returning plain text HTML code

Reply
Thread Tools

Perl CGI returning plain text HTML code

 
 
ich_bin_Ingenieur
Guest
Posts: n/a
 
      03-23-2007
So it's like this...

I wrote a PERL script that receives GET data and returns a webpage,
and this script works fine when used with Internet Explorer on a PC...

But when running this script on Mozilla, Opera, or Safari on a MAC, it
returns the a plain text file in the browser window of the HTML code,
rather than displaying the HTML page.

I'm not sure what's causing it to act like this. I've tested numerous
PHP CGI's in the same browsers and they all work correctly.

The script has been CHMODed to 755, it has a .cgi extention, and it
returns an HTML page with the meta header <meta http-equiv="Content-
Type" content="text/html; charset=iso-8859-1">. I've tried changing
the permission, changing the extention, and I'm trying to see if I can
Google this problem, but no luck yet.

The first part of the webpage is returned using a "print <<ENDHTML;"
block, and the rest of the page is returned through print
statements.

Has anyone heard about this behavior? Does anyone know what the
problem might be?

 
Reply With Quote
 
 
 
 
Jürgen Exner
Guest
Posts: n/a
 
      03-23-2007
ich_bin_Ingenieur wrote:
> So it's like this...

[Subject: Perl CGI returning plain text HTML code]

Well, yeah, that is what any CGI program is supposed to do (assuming you
want to return HTML).


> I wrote a PERL script that receives GET data and returns a webpage,
> and this script works fine when used with Internet Explorer on a PC...
>
> But when running this script on Mozilla, Opera, or Safari on a MAC, it
> returns the a plain text file in the browser window of the HTML code,
> rather than displaying the HTML page.


Why do you think, this has anything, anything at all to do with Perl?

jue


 
Reply With Quote
 
 
 
 
Brian Wakem
Guest
Posts: n/a
 
      03-23-2007
ich_bin_Ingenieur wrote:

> So it's like this...
>
> I wrote a PERL script that receives GET data and returns a webpage,
> and this script works fine when used with Internet Explorer on a PC...
>
> But when running this script on Mozilla, Opera, or Safari on a MAC, it
> returns the a plain text file in the browser window of the HTML code,
> rather than displaying the HTML page.



You are not printing the correct header.

IE incorrectly tries to determine file type from the contents even after
you've printed a text/plain header. IE is broken and so is your script.

If you can't work it out then post the part of your script that prints the
header.


--
Brian Wakem
Email: http://homepage.ntlworld.com/b.wakem/myemail.png
 
Reply With Quote
 
Jens Thoms Toerring
Guest
Posts: n/a
 
      03-23-2007
ich_bin_Ingenieur <> wrote:
> I wrote a PERL script that receives GET data and returns a webpage,
> and this script works fine when used with Internet Explorer on a PC...


> But when running this script on Mozilla, Opera, or Safari on a MAC, it
> returns the a plain text file in the browser window of the HTML code,
> rather than displaying the HTML page.


> I'm not sure what's causing it to act like this. I've tested numerous
> PHP CGI's in the same browsers and they all work correctly.


Sorry, but CGI scripts aren't "run" by a browser - the browser just
renders what a _web server_ sends it and the _web server_ invokes
the CGI script, reading its output and passing that on to the client,
i.e. the browser.

> The script has been CHMODed to 755, it has a .cgi extention, and it
> returns an HTML page with the meta header <meta http-equiv="Content-
> Type" content="text/html; charset=iso-8859-1">. I've tried changing
> the permission, changing the extention, and I'm trying to see if I can
> Google this problem, but no luck yet.


Hard to say without any real information, but my best guess at the
moment is that the output of your script isn't HTML (a <meta...>
line alone somewhere in the text isn't enough) and the Internet
Exploder treats it for some strange reason as HTML anyway while
the more standard conforming browsers don't. Can one have a look
at the output of your script and/or what exactly arrives at the
browser?
Regards, Jens
--
\ Jens Thoms Toerring ___
\__________________________ http://toerring.de
 
Reply With Quote
 
krakle@visto.com
Guest
Posts: n/a
 
      03-27-2007
On Mar 23, 2:19 am, Brian Wakem <n...@email.com> wrote:
> ich_bin_Ingenieur wrote:
> > So it's like this...

>
> > I wrote a PERL script that receives GET data and returns a webpage,
> > and this script works fine when used with Internet Explorer on a PC...

>
> > But when running this script on Mozilla, Opera, or Safari on a MAC, it
> > returns the a plain text file in the browser window of the HTML code,
> > rather than displaying the HTML page.

>
> You are not printing the correct header.
>
> IE incorrectly tries to determine file type from the contents even after
> you've printed a text/plain header. IE is broken and so is your script.


Actually... Even if the correct PLAINTEXT header is printed IE will
still attempt to read any HTML in that file.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Web Service returning wrong content type of text/plain robert112 ASP .Net 1 01-21-2010 10:40 AM
when I add HTML to innerHTML, FireFox renders it as HTML, but IE shows it as plain text Jake Barnes Javascript 9 02-21-2006 10:37 AM
web form returning text/plain ? greg ASP .Net 2 08-27-2004 07:20 AM
Re: CGI script is in plain text BMA TRADING Python 1 07-04-2003 03:37 PM
CGI script is in plain text A Python 0 07-03-2003 08:39 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57