[Catalyst-commits] r7454 - trunk/HTTP-Body
andyg at dev.catalyst.perl.org
andyg at dev.catalyst.perl.org
Sat Feb 23 16:01:46 GMT 2008
Author: andyg
Date: 2008-02-23 16:01:45 +0000 (Sat, 23 Feb 2008)
New Revision: 7454
Modified:
trunk/HTTP-Body/MANIFEST.SKIP
trunk/HTTP-Body/README
Log:
HTTP::Body 1.00 release
Modified: trunk/HTTP-Body/MANIFEST.SKIP
===================================================================
--- trunk/HTTP-Body/MANIFEST.SKIP 2008-02-23 15:59:12 UTC (rev 7453)
+++ trunk/HTTP-Body/MANIFEST.SKIP 2008-02-23 16:01:45 UTC (rev 7454)
@@ -24,8 +24,10 @@
\#$
\b\.#
+# No tarballs!
+\.gz$
+
# dev scripts
-
scripts/benchmark.pl
scripts/stress.pl
t/data/benchmark/*
Modified: trunk/HTTP-Body/README
===================================================================
--- trunk/HTTP-Body/README 2008-02-23 15:59:12 UTC (rev 7453)
+++ trunk/HTTP-Body/README 2008-02-23 16:01:45 UTC (rev 7454)
@@ -3,14 +3,14 @@
SYNOPSIS
use HTTP::Body;
-
- sub handler : method {
+
+ sub handler : method {
my ( $class, $r ) = @_;
my $content_type = $r->headers_in->get('Content-Type');
my $content_length = $r->headers_in->get('Content-Length');
-
- my $body = HTTP::Body->new( $content_type, $content_length );
+
+ my $body = HTTP::Body->new( $content_type, $content_length );
my $length = $content_length;
while ( $length ) {
@@ -18,18 +18,29 @@
$r->read( my $buffer, ( $length < 8192 ) ? $length : 8192 );
$length -= length($buffer);
+
+ $body->add($buffer);
+ }
- $body->add($buffer);
- }
-
- my $uploads = $body->upload; # hashref
+ my $uploads = $body->upload; # hashref
my $params = $body->param; # hashref
my $body = $body->body; # IO::Handle
}
DESCRIPTION
- HTTP Body Parser.
+ HTTP::Body parses chunks of HTTP POST data and supports
+ application/octet-stream, application/x-www-form-urlencoded, and
+ multipart/form-data.
+ Chunked bodies are supported by not passing a length value to new().
+
+ It is currently used by Catalyst to parse POST bodies.
+
+NOTES
+ When parsing multipart bodies, temporary files are created to store any
+ uploaded files. You must delete these temporary files yourself after
+ processing them.
+
METHODS
new Constructor. Takes content type and content length as parameters,
returns a HTTP::Body object.
@@ -40,40 +51,46 @@
body
accessor for the body.
- buffer
- read only accessor for the buffer.
+ chunked
+ Returns 1 if the request is chunked.
content_length
- read only accessor for content length
+ Returns the content-length for the body data if known. Returns -1 if
+ the request is chunked.
content_type
- ready only accessor for the content type
+ Returns the content-type of the body data.
init
return self.
length
- read only accessor for body length.
+ Returns the total length of data we expect to read if known. In the
+ case of a chunked request, returns the amount of data read so far.
+ trailing_headers
+ If a chunked request body had trailing headers, trailing_headers
+ will return an HTTP::Headers object populated with those headers.
+
spin
Abstract method to spin the io handle.
state
- accessor for body state.
+ Returns the current state of the parser.
param
- accesor for http parameters.
+ Get/set body parameters.
upload
+ Get/set file uploads.
-BUGS
- Chunked requests are currently not supported.
-
AUTHOR
Christian Hansen, "ch at ngmedia.com"
Sebastian Riedel, "sri at cpan.org"
+ Andy Grundman, "andy at hybridized.org"
+
LICENSE
This library is free software. You can redistribute it and/or modify it
under the same terms as perl itself.
More information about the Catalyst-commits
mailing list