GX::HTTP::Request::Headers

Module Version: 0.2000_01

NAME

GX::HTTP::Request::Headers - HTTP request headers class

SYNOPSIS

# Load the class
use GX::HTTP::Request::Headers;

# Create a new headers object
$headers = GX::HTTP::Request::Headers->new;

# Set the value of a header field
$headers->set( 'Content-Type' => 'text/plain' );

# Get the value of a header field
$content_type = $headers->get( 'Content-Type' );

# Print the headers
print $headers->as_string;

DESCRIPTION

This module provides the GX::HTTP::Request::Headers class which extends the GX::HTTP::Headers class.

METHODS

Constructor

new

Returns a new GX::HTTP::Request::Headers object.

$headers = GX::HTTP::Request::Headers->new;
Returns:
Exceptions:

Also see parse().

Basic Public API

as_string

See GX::HTTP::Headers.

field_names

See GX::HTTP::Headers.

parse

Parses the given message header and adds the resulting header field / value pairs to the container.

$headers->parse( $string );
Arguments:
  • $string ( string )

This method can also be used as a constructor.

$headers = GX::HTTP::Request::Headers->parse( $string );
Arguments:
  • $string ( string )
Returns:
Exceptions:

sorted_field_names

See GX::HTTP::Headers.

Public Field Accessors

content_disposition

See GX::HTTP::Headers.

content_encoding

See GX::HTTP::Headers.

content_language

See GX::HTTP::Headers.

content_length

See GX::HTTP::Headers.

content_type

See GX::HTTP::Headers.

cookie

Returns / sets the value of the "Cookie" header field.

$value = $headers->cookie;
$value = $headers->cookie( $value );
Arguments:
  • $value ( string | undef ) [ optional ]
Returns:
  • $value ( string | undef )

See RFC 2109, section 4.3.4.

expires

See GX::HTTP::Headers.

host

Returns / sets the value of the "Host" header field.

$value = $headers->host;
$value = $headers->host( $value );
Arguments:
  • $value ( string | undef ) [ optional ]
Returns:
  • $value ( string | undef )

See RFC 2616, section 14.23.

if_modified_since

Returns / sets the value of the "If-Modified-Since" header field.

$value = $headers->if_modified_since;
$value = $headers->if_modified_since( $value );
Arguments:
  • $value ( string | undef ) [ optional ]
Returns:
  • $value ( string | undef )

See RFC 2616, section 14.25.

if_unmodified_since

Returns / sets the value of the "If-Unmodified-Since" header field.

$value = $headers->if_unmodified_since;
$value = $headers->if_unmodified_since( $value );
Arguments:
  • $value ( string | undef ) [ optional ]
Returns:
  • $value ( string | undef )

See RFC 2616, section 14.28.

last_modified

See GX::HTTP::Headers.

referer

Returns / sets the value of the "Referer" header field.

$value = $headers->referer;
$value = $headers->referer( $value );
Arguments:
  • $value ( string | undef ) [ optional ]
Returns:
  • $value ( string | undef )

See RFC 2616, section 14.36.

user_agent

Returns / sets the value of the "User-Agent" header field.

$value = $headers->user_agent;
$value = $headers->user_agent( $value );
Arguments:
  • $value ( string | undef ) [ optional ]
Returns:
  • $value ( string | undef )

See RFC 2616, section 14.43.

AUTHOR

Jörg A. Uzarek <uzarek@runlevelnull.de>

COPYRIGHT AND LICENSE

Copyright © 2009-2011 Jörg A. Uzarek.

This module is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License Version 3 as published by the Free Software Foundation.