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

Hi guys!
anyone know how can I get the header setn back to me from the browser?
I'm using CGI (not object oriented mode) and I want to know what header the browser sends me (charset especially).
any help?

Hotshot

Replies are listed 'Best First'.
Re: getting header sent from the browser
by valdez (Monsignor) on Nov 13, 2002 at 11:33 UTC

    HTTP_ACCEPT* keys in your %ENV should contain what you are looking for:

    #!/usr/bin/perl print "Content-type: text/plain\r\n\r\n"; while (($key, $value) = each %ENV) { print "$key\t$value\n"; }

    Ciao, Valerio

Re: getting header sent from the browser
by fruiture (Curate) on Nov 13, 2002 at 11:32 UTC

    Well, in CGI environment you only get what CGI is specified to give you.

    btw.: you do not get anything "sent back" to you from the Browser. The Browser only requests, it never responds.

    --
    http://fruiture.de
Re: getting header sent from the browser
by rasta (Hermit) on Nov 13, 2002 at 11:32 UTC
Re: getting header sent from the browser
by guha (Priest) on Nov 13, 2002 at 11:37 UTC
    You could find some interesting info if you check what the *magic* hash, %ENV, contains.
Re: getting header sent from the browser
by zentara (Cardinal) on Nov 13, 2002 at 15:23 UTC

    The cgic libaray from www.boutell.com comes with a little "capture" utility, which captures your transaction. If you are testing on a local machine, you can do "ngrep -d lo" to dump your loopback device, and will show exactly what was sent and received. There are some utilities available on freshmeat.net for diagnosing http connections,