You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Goehring, Chuck Mr., RCI - San Diego" <cg...@resourceconsultants.com> on 2003/04/05 04:26:10 UTC

[mp2] Content-Type not being set as expected

mp2 Guys,

I am getting xml (seemingly) instead of html 3.2 out of Apache2/ModPerl::Registry/CGI.pm. I'm setting content type in my code like this:
  use CGI qw/:standard :html3/;
  ...
  print header(-type=>'text/html'); 

Has some default changed or a switch I need to set.  Netscape 7.02 is barfing on this style of code.  MSIE 5.5 and NN 4.79 work fine with it.

I'm getting this:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
	PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">

I'm expecting this:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML><HEAD>
...
Conf file:
  <Location /perl>
     SetHandler perl-script
     PerlResponseHandler ModPerl::Registry
     Options +ExecCGI
     PerlOptions +ParseHeaders
  </Location>


Thanks in advance
Chuck

Re: [mp2] Content-Type not being set as expected

Posted by Stas Bekman <st...@stason.org>.
Goehring, Chuck Mr., RCI - San Diego wrote:
> mp2 Guys,
> 
> I am getting xml (seemingly) instead of html 3.2 out of Apache2/ModPerl::Registry/CGI.pm. I'm setting content type in my code like this:
>   use CGI qw/:standard :html3/;
>   ...
>   print header(-type=>'text/html'); 
> 
> Has some default changed or a switch I need to set.  Netscape 7.02 is barfing on this style of code.  MSIE 5.5 and NN 4.79 work fine with it.

a mp2 test t/response/TestModules/cgi.pm does:
     print $cgi->header('-type' => 'text/test-output'...

and it seems to work just fine, even if I change it to a non-OO method. Are 
you using the latest version of CGI.pm? If so, it should be trivial to find 
the problem, since CGI.pm is a pure perl module.

I've also added a new test under ModPerl::Registry, please get the latest cvs 
and see if 'make test' passes for you (including the ModPerl::Registry test 
suite).

The new test is made of these two files:
ModPerl-Registry/t/cgi-bin/cgi.pl
ModPerl-Registry/t/cgi.t

> I'm getting this:
> <?xml version="1.0" encoding="iso-8859-1"?>
> <!DOCTYPE html
> 	PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> 	 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
> 
> I'm expecting this:
> <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
> <HTML><HEAD>
> ...
> Conf file:
>   <Location /perl>
>      SetHandler perl-script
>      PerlResponseHandler ModPerl::Registry
>      Options +ExecCGI
>      PerlOptions +ParseHeaders
>   </Location>

The configuration file looks good.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com