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.


In reply to Re^3: SOLVED: HTTP-POST with IO::Socket -- Header problem by Corion
in thread HTTP-POST with IO::Socket -- Header problem by Beavis

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.