in reply to Re: Malformed Header Error in thread Malformed Header Error
Thanks for responding - but, having tested, that is not the solution.
I was (am?) under the impression that the Document Type Declaration
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML .01//EN" "http://www.w3.org/TR/html4/loose.dtd"> superseded the header
Content-type: text/html.
No ? Note, I generally use the "Strict DTD" but left in "loose" in this test in order to rule out that possibility.
Re^3: Malformed Header Error
by borisz (Canon) on Jul 19, 2004 at 18:37 UTC
|
No, you need a content-type header. the header need to send out, before the content.
#!/usr/bin/perl
use CGI qw(:standard);
use strict;
sub printpage();
print header( -type => 'text/html');
printpage();
exit;
| [reply] [d/l] |
|
Boris, Joost,
thanks for the help and patience. I had overlooked this in the HTML 4.01 spec. I guess the servers/user agents I've been using have been too forgiving !
Regards,
mP.
| [reply] |
Re^3: Malformed Header Error
by Joost (Canon) on Jul 19, 2004 at 17:33 UTC
|
No.DOCTYPE declarations are ADDITIONAL to the content-type. If you set content-type to "text/plain" for instance, the browser should ignore any markup in the file and just show it as plain text with funny tags in it.
You need a valid content-type header. Sometimes this is automatically provided by the webserver, but most of the time, it isn't.
Also, you might have uploaded your perl script as binary with different line-endings than the line-endings on the target machine, or your script is not executable by the webserver user (do chmod 755 filename).
| [reply] |
|
Ouch - this is embarrassing ...
I have recently started using LeechFTP which has no options on what the line-endings are.
To check the line-endings (also initially suggested by ccn) I did the upload via the command prompt and that has resolved the problem.
Thank you all very much for your time and expertise.
| [reply] |
|