Changeset 43

Show
Ignore:
Timestamp:
03/05/09 16:05:18 (5 years ago)
Author:
clinton
Message:

Add ability to get any request header

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/Mungo/Request.pm

    r37 r43  
    3232     my $server_hostname = $Request->ServerVariables('HTTP_HOST'); 
    3333     my $client_ip = $Request->ServerVariables('REMOTE_IP'); # If proxied, uses HTTP_X_FORWARDED_FOR. 
     34 
     35     my $header = $Request->Header('HeaderName'); 
     36 
    3437  %> 
    3538 
     
    281284} 
    282285 
     286=head2 $value = $Request->Header('User-Agent'); 
     287 
     288Returns raw header information from the request header. 
     289 
     290=cut 
     291 
     292sub Header { 
     293    my $self = shift; 
     294    my $hname = shift; 
     295    my $r = $self->{'Mungo'}->{'Apache::Request'}; 
     296    return $r->can('headers_in') 
     297      ? $r->headers_in->get($hname) 
     298        : $r->header_in($hname); 
     299} 
     300 
    283301sub AUTOLOAD { 
    284302  my $self = shift;