swarddb has asked for the wisdom of the Perl Monks concerning the following question:

Content-Type: text/html How do i kill this from the top of my frame? I can't find what is calling this or how to hide it.

Replies are listed 'Best First'.
Re: Content-Type: text/html
by cLive ;-) (Prior) on Jul 03, 2001 at 04:18 UTC
    You post no code, but here's a guess:

    If using CGI, check only one header is being printed.

    If printing header manually, check blank line appears after it, ie print "Content-Type: text/html\n\n"; - if you got this wrong, your server may be trying to guess the content type since you didn't supply one as it expected, and ends up printing an extra header.

    cLive ;-)

    Please try to think about code to show us when asking these questions, otherwise we just make stabs like this :)

Re: Content-Type: text/html
by converter (Priest) on Jul 03, 2001 at 04:45 UTC

    If you're using CGI.pm, try using the :unique_headers option. This will prevent a CGI object printing more than one http header.

    Example:

    $ perl -e 'use CGI qw/ :unique_headers /; $q = CGI->new; print $q->header, $q->header'
    Content-Type: text/html; charset=ISO-8859-1
    
    $
    

    If this fixes the problem, you should probably still have a look through your code and figure out where the redundant header is being printed.

Re: Content-Type: text/html
by schumi (Hermit) on Jul 03, 2001 at 18:16 UTC
    Seems indeed that you have more than one header printed out, otherwise you would get an error rather than "Content-Type: text/html" printed out.

    It looks to me like you have this script called within another script, where there is already a header in there. You should check on that.

    --cs

    update: oakbox is right, as was ginseng: An empty line before any content is sent might be the cause. I didn't read ginseng's post properly there, sorry.

    --cs

      Actually, the blank line(s) before the "Content-Type: text/html" line is a possible cause here. Some non-standard HTML browsers (>MSIE<) will assume HTML content and just print out everything to the screen (including the misplaced content-type statement).
      Other browsers, like Netscape and Opera, display what they are supposed to display. That is, they break like they are supposed to :)

      Richard

Re: Content-Type: text/html
by ginseng (Pilgrim) on Jul 03, 2001 at 04:34 UTC

    I think this would also happen if there is a blank line (rather, any content at all) going to the client before the header is sent.