in reply to Re^2: SOLVED: HTTP-POST with IO::Socket -- Header problem
in thread HTTP-POST with IO::Socket -- Header problem

I'm sorry that I didn't read your original post closely enough.

It would seem to me that a very simple approach to testing where the bottleneck lies would be in patching/replacing the subroutine HTTP::Request::Common::form_data to read the data in chunks larger than 2048 bytes. Unfortunately, ->form_data is very large and monolithic and there is no easy way to change it other than copying it into your source code and replacing it:

use HTTP::Request::Common; sub my_post_file { my $bufsize = 10_240_000; local *HTTP::Request::Common::form_data = sub { ... my $buflength = length $buf; my $n = read($fh, $buf, $bufsize, $buflength); if ($n) { $buflength += $n; unshift(@parts, ["", $fh]); } ... };

If this change alone brings "enough" speedup, it might be worth to submit a patch back upstream that makes the POST buffer size configurable.