1

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 headers, especially non-standard headers? The environment variables are only the standard ones.

cgi->param gives me only the form parameters.

Thanks! chris

1
  • chris, I substituted attributes for headers in your question. If that's not what you meant, roll back my change. Commented Jun 22, 2010 at 13:11

2 Answers 2

2

It says in the documentation:

You can, if you really want, define parse_headers() and parse them raw yourself.

Sign up to request clarification or add additional context in comments.

1 Comment

thanks! you put me on the right way! function headers will give me the arguments without parsing for myself. regards, chris
0

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";
    }
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.