#!/usr/bin/perl

# content_type_check.cgi
#
# This script generates a page with the given content type header, using the given markup language.
#
# usage:
# content_type_check.cgi?markup=[xhtml|html]&content_type=[%MimeType]&back=[%URL]
#
#
#########################################
use CGI;
$co = new CGI;
$markup = $co->param('markup');
$content = $co->param('contenttype');
$content =~ s/\s/+/g;
$back = $co->param('back');

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

print "Content-type:$content\n\n";
if ($markup == 'xhtml' || $markup == 'XHTML'){
	# print xml header and xhtml basic doctype
	print <<xhtml_header;
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml"> 
xhtml_header

}elsif($markup == 'xhtml-mp' || $markup == 'XHTML-MP'){
	# print xml header and xhtml mobile profile doctype
	print <<xhtml_header;
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml"> 
xhtml_header

}else{
	print "<html>\n";
}
print "<head>\n<title>Content Check</title>\n</head>\n<body>\n\n<h3>Content Check</h3>\n";
print "<p>This page was served with the Content Type Header: $content</p>\n";
print "<p>If this page loads and the content header is not displayed as text in the first line of the file, the test passed.</p>\n";
print "<p><a href='http://$back'>Back</a></p>\n";
print "</body>\n</html>\n";


