No need for the intermediate copy.
[catagits/HTTP-Body.git] / lib / HTTP / Body / UrlEncoded.pm
index aacef3b..2a012ac 100644 (file)
@@ -3,6 +3,7 @@ package HTTP::Body::UrlEncoded;
 use strict;
 use base 'HTTP::Body';
 use bytes;
+use IO::Handle::Util;
 
 our $DECODE = qr/%([0-9a-fA-F]{2})/;
 
@@ -37,6 +38,10 @@ sub spin {
     my $self = shift;
 
     return unless $self->length == $self->content_length;
+
+    # Store a copy of the raw request that the body() method can return
+    # see RT #111876 
+    $self->body(IO::Handle::Util::io_from_any($self->{buffer}));
     
     # I tested parsing this using APR::Request, but perl is faster
     # Pure-Perl    2560/s