I'm using HTTP::Server::Simple::CGI
for a light-weight HTTP server. That gives me a CGI object in a callback function when a HTTP request is accepted.
How can I access the incoming HTTP head开发者_JAVA技巧ers, especially non-standard headers? The environment variables are only the standard ones.
cgi->param
gives me only the form parameters.
Thanks! chris
It says in the documentation:
You can, if you really want, define parse_headers() and parse them raw yourself.
Define the headers
method to receive the headers.
sub headers
{
my $self = shift;
my $headers = shift;
my @h = @{$headers};
while (0 + @h)
{
my $k = shift @h;
my $v = shift @h;
print STDERR "header >> $k: $v\n";
}
}
精彩评论