No need for the intermediate copy. bigpresh/return_request_body_for_all_types
David Precious [Wed, 9 Mar 2016 10:31:42 +0000 (10:31 +0000)]
I had thought I needed to copy it first so the changes that the following code
make to the buffer won't be made to the raw body copy, but I'm not passing it by
reference to io_from_any() so it's already a copy, no need for two!

lib/HTTP/Body/UrlEncoded.pm

index 3f45965..2a012ac 100644 (file)
@@ -41,8 +41,7 @@ sub spin {
 
     # Store a copy of the raw request that the body() method can return
     # see RT #111876 
-    my $body_content = $self->{buffer};
-    $self->body(IO::Handle::Util::io_from_any($body_content));
+    $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