Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Malformed Header Error

by macPerl (Beadle)
on Jul 19, 2004 at 17:09 UTC ( [id://375617]=note: print w/replies, xml ) Need Help??


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.

Replies are listed 'Best First'.
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;
    Boris
      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.
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).

      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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://375617]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-04-25 22:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found