NAME
Net::ICAP::Request - ICAP Request Class
VERSION
$Id: lib/Net/ICAP/Request.pm, v0.03 $
SYNOPSIS
use Net::ICAP::Request;
use Net::ICAP::Common qw(:req);
$msg = new Net::ICAP::Request;
$rv = $msg->parse($fh);
$method = $msg->method;
$url = $msg->url;
$auth = $msg->authority;
$service = $msg->service;
$query = $msg->query;
$query_arg = $msg->query('lang');
$msg = Net::ICAP::Request->new(
method => ICAP_REQMOD,
url => $url,
headers => {
Host => 'localhost',
},
);
$rv = $msg->method(ICAP_RESPMOD);
$rv = $msg->url($url);
$rv = $msg->generate($fh);
DESCRIPTION
This module provides an ICAP Request class for parsing and generating ICAP requests. Additional methods available to this class are provided (and documented) in Net::ICAP::Message.
SUBROUTINES/METHODS
parse
See Net::ICAP::Message documentation.
generate
See Net::ICAP::Message documentation. This method will automatically update the Host header field based on the URL.
method
$rv = $msg->method($method);
$method = $msg->method;
This method gets or sets the request method. Only valid methods are accepted and must be one of ICAP_REQMOD, ICAP_RESPMOD, or ICAP_OPTIONS. No provision exists at this moment to accept custom methods.
url
$rv = $msg->url($url);
$url = $msg->url;
This method gets or sets the URL the request is going to. No validation is done on the passed value.
authority
$auth = $msg->authority;
This returns the hostname/port section of the URL, assuming one was set and is parseable by URI.
service
$service = $msg->service;
This returns the service (or path component of a URI) of the URL, assuming one was set and is parseable by URI.
query
$query = $msg->query;
$query_arg = $msg->query('lang');
This returns either the entire query string or the value of the specified query argument as defined in the URL. This uses query_form of URI which assumes query components use application/x-www-form-urlencoded format.
sanityCheck
This method performs some basic sanity checks that the internal state has parsed, or can generate, a valid ICAP message. This includes checking for the presence of mandatory headers, but no validation is done on the accompanying values.
This method is used internally by both the parse and generate methods.
DEPENDENCIES
BUGS AND LIMITATIONS
AUTHOR
Arthur Corliss (corliss@digitalmages.com)
LICENSE AND COPYRIGHT
This software is licensed under the same terms as Perl, itself. Please see http://dev.perl.org/licenses/ for more information.
(c) 2012, Arthur Corliss (corliss@digitalmages.com)