The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

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

add

See "add" in GX::HTTP::Headers.

as_string

See "as_string" in GX::HTTP::Headers.

clear

See "clear" in GX::HTTP::Headers.

count

See "count" in GX::HTTP::Headers.

field_names

See "field_names" in GX::HTTP::Headers.

get

See "get" in 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:

remove

See "remove" in GX::HTTP::Headers.

set

See "set" in GX::HTTP::Headers.

sorted_field_names

See "sorted_field_names" in GX::HTTP::Headers.

Public Field Accessors

content_disposition

See "content_disposition" in GX::HTTP::Headers.

content_encoding

See "content_encoding" in GX::HTTP::Headers.

content_language

See "content_language" in GX::HTTP::Headers.

content_length

See "content_length" in GX::HTTP::Headers.

content_type

See "content_type" in GX::HTTP::Headers.

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.

date

See "date" in GX::HTTP::Headers.

expires

See "expires" in 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 "last_modified" in 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 (c) 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.