[libhttp-entity-parser-perl] 01/03: make read buf size configurable

gregor herrmann gregoa at debian.org
Sun Oct 23 00:23:43 UTC 2016


This is an automated email from the git hooks/post-receive script.

gregoa pushed a commit to tag 0.14
in repository libhttp-entity-parser-perl.

commit 1142fd15e92294236b36a5b95e90c75ceee64fe5
Author: Masahiro Nagano <kazeburo at gmail.com>
Date:   Tue Nov 17 10:22:50 2015 +0900

    make read buf size configurable
---
 META.json                 | 5 +++--
 eg/bench.pl               | 2 +-
 lib/HTTP/Entity/Parser.pm | 6 ++++--
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/META.json b/META.json
index f51d087..db5493a 100644
--- a/META.json
+++ b/META.json
@@ -4,7 +4,7 @@
       "Masahiro Nagano <kazeburo at gmail.com>"
    ],
    "dynamic_config" : 0,
-   "generated_by" : "Minilla/v2.4.1, CPAN::Meta::Converter version 2.141170",
+   "generated_by" : "Minilla/v2.4.1, CPAN::Meta::Converter version 2.150005",
    "license" : [
       "perl_5"
    ],
@@ -80,5 +80,6 @@
    "version" : "0.13",
    "x_contributors" : [
       "moznion <moznion at gmail.com>"
-   ]
+   ],
+   "x_serialization_backend" : "JSON::PP version 2.27203"
 }
diff --git a/eg/bench.pl b/eg/bench.pl
index 4f1b092..46fb68a 100644
--- a/eg/bench.pl
+++ b/eg/bench.pl
@@ -29,7 +29,7 @@ for my $content ($content1, $content2, $content3) {
         'http_body' => sub {
             open my $input, '<', \$content;
             my $body   = HTTP::Body->new( 'application/x-www-form-urlencoded', length($content) );
-            $input->read( my $buffer, 8192);
+            $input->read( my $buffer, 16384);
             $body->add($buffer);
             $body->param;
         }
diff --git a/lib/HTTP/Entity/Parser.pm b/lib/HTTP/Entity/Parser.pm
index ff81544..be049c5 100644
--- a/lib/HTTP/Entity/Parser.pm
+++ b/lib/HTTP/Entity/Parser.pm
@@ -8,6 +8,8 @@ use Module::Load;
 
 our $VERSION = "0.13";
 
+our $READ_BUF_SIZE = 16384;
+
 our %LOADED;
 our @DEFAULT_PARSER = qw/
     OctetStream
@@ -69,7 +71,7 @@ sub parse {
     if ( my $cl = $env->{CONTENT_LENGTH} ) {
         my $spin = 0;
         while ($cl > 0) {
-            $input->read(my $chunk, $cl < 8192 ? $cl : 8192);
+            $input->read(my $chunk, $cl < $READ_BUF_SIZE ? $cl : $READ_BUF_SIZE);
             my $read = length $chunk;
             $cl -= $read;
             $parser->add($chunk);
@@ -83,7 +85,7 @@ sub parse {
         my $chunk_buffer = '';
         my $length;
         DECHUNK: while(1) {
-            $input->read(my $chunk, 8192);
+            $input->read(my $chunk, $READ_BUF_SIZE);
             $chunk_buffer .= $chunk;
             while ( $chunk_buffer =~ s/^(([0-9a-fA-F]+).*\015\012)// ) {
                 my $trailer   = $1;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libhttp-entity-parser-perl.git



More information about the Pkg-perl-cvs-commits mailing list