|
NAMEHTTP::Headers::ActionPack - HTTP Action, Adventure and ExcitementVERSIONversion 0.09SYNOPSISuse HTTP::Headers::ActionPack; my $pack = HTTP::Headers::ActionPack->new; my $media_type = $pack->create_header( 'Content-Type' => 'application/xml;charset=UTF-8' ); my $link = $pack->create( 'LinkHeader' => [ '</test/tree>', rel => "up" ] ); # auto-magic header inflation # for multiple types $pack->inflate( $http_headers_instance ); $pack->inflate( $http_request_instance ); $pack->inflate( $plack_request_instance ); DESCRIPTIONThis is a module to handle the inflation and deflation of complex HTTP header types. In many cases header values are simple strings, but in some cases they are complex values with a lot of information encoded in them. The goal of this module is to make the parsing and analysis of these headers as easy as calling "inflate" on a compatible object (see below for a list).This top-level class is basically a Factory for creating instances of the other classes in this module. It contains a number of convenience methods to help make common cases easy to write. DEFAULT MAPPINGSThis class provides a set of default mappings between HTTP headers and the classes which can inflate them. Here is the list of default mappings this class provides.Link HTTP::Headers::ActionPack::LinkList Content-Type HTTP::Headers::ActionPack::MediaType Accept HTTP::Headers::ActionPack::MediaTypeList Accept-Charset HTTP::Headers::ActionPack::PriorityList Accept-Encoding HTTP::Headers::ActionPack::PriorityList Accept-Language HTTP::Headers::ActionPack::PriorityList Date HTTP::Headers::ActionPack::DateHeader Client-Date HTTP::Headers::ActionPack::DateHeader Expires HTTP::Headers::ActionPack::DateHeader Last-Modified HTTP::Headers::ActionPack::DateHeader If-Unmodified-Since HTTP::Headers::ActionPack::DateHeader If-Modified-Since HTTP::Headers::ActionPack::DateHeader WWW-Authenticate HTTP::Headers::ActionPack::WWWAuthenticate Authentication-Info HTTP::Headers::ActionPack::AuthenticationInfo Authorization HTTP::Headers::ActionPack::Authorization NOTE: The 'Client-Date' header is often added by LWP on HTTP::Response objects. METHODS
CAVEATSPlack CompatibilityWe have a test in the suite that checks to make sure that any inflated header objects will pass between HTTP::Request and HTTP::Response objects as well as Plack::Request and Plack::Response objects.A simple survey of most of the Plack::Handler subclasses shows that most of them will end up properly stringifying these header objects before sending them out. The notable exceptions were the Apache handlers. At the time of this writing, the solution for this would be for you to either stringify these objects prior to returning your Plack::Response, or to write a simple middleware component that would do that for you. In future versions we might provide just such a middleware (it would likely inflate the header objects on the request side as well). StringificationAs mentioned above, all the header objects overload the stringification operator, so normal usage of them should just do what you would expect (stringify in a sensible way). However this is not certain and so care should be taken when passing object headers onto another library that is expecting strings.AUTHORStevan Little <stevan.little@iinteractive.com>CONTRIBUTORS
COPYRIGHT AND LICENSEThis software is copyright (c) 2012 by Infinity Interactive, Inc..This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Visit the GSP FreeBSD Man Page Interface. |