Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding the optional ability to set the size of each file read when DYNAM... #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/HTTP/Request/Common.pm
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package HTTP::Request::Common;

use strict;
use vars qw(@EXPORT @EXPORT_OK $VERSION $DYNAMIC_FILE_UPLOAD);
use vars qw(@EXPORT @EXPORT_OK $VERSION $DYNAMIC_FILE_UPLOAD $DYNAMIC_FILE_UPLOAD_READ_SIZE);

$DYNAMIC_FILE_UPLOAD ||= 0; # make it defined (don't know why)
$DYNAMIC_FILE_UPLOAD_READ_SIZE ||= 2048;

require Exporter;
*import = \&Exporter::import;
@EXPORT =qw(GET HEAD PUT POST);
@EXPORT_OK = qw($DYNAMIC_FILE_UPLOAD DELETE);
@EXPORT_OK = qw($DYNAMIC_FILE_UPLOAD DELETE $DYNAMIC_FILE_UPLOAD_READ_SIZE);

require HTTP::Request;
use Carp();
Expand Down Expand Up @@ -255,7 +256,7 @@ sub form_data # RFC1867
binmode($fh);
}
my $buflength = length $buf;
my $n = read($fh, $buf, 2048, $buflength);
my $n = read($fh, $buf, $DYNAMIC_FILE_UPLOAD_READ_SIZE, $buflength);
if ($n) {
$buflength += $n;
unshift(@parts, ["", $fh]);
Expand Down