in reply to Re^2: sending a large file via http
in thread sending a large file via http

So does this mean that the content-length header value is no longer used?
I can't tell from the LWP docs if it handles that for you, but you can still set it yourself, for example with my $length = -s $filename; and then adding the appropriate header.

Regarding your code, I read the docs slightly differently:

my $request = HTTP::Request->new('POST', $url, $headers); $request->protocol('HTTP/1.1'); my $browser = LWP::UserAgent->new(); my $response = $browser->request($request, \&sendthis);
That is, you pass the callback to the LWP->request method, not the HTTP::Request constructor.

Replies are listed 'Best First'.
Re^4: sending a large file via http
by mifflin (Curate) on Jun 18, 2007 at 23:42 UTC
    Thanks for the response.
    I made the changes you suggested above.
    Now if I could just get the client to give me a url so I can test....
Re^4: sending a large file via http
by tty04 (Initiate) on Nov 09, 2007 at 23:28 UTC
    Check out LWP/Protocol/http.pm
      When request is called here, your coderef is in $arg
    
    sub request {
      my($self, $request, $proxy, $arg, $size, $timeout) = @_;
     ...
        my $content_ref = $request->content_ref;
        $content_ref = $$content_ref if ref($$content_ref);
    ....
            if (ref($content_ref) eq 'CODE') {
                my $buf = &$content_ref();
    ...
    
    http.pm doesn't look at $arg as a code ref.
    Instead it looks at $content_ref.
    But if $content_ref was a code ref, then you'll get a run time error.
    
    It'll never work !  This feature is totally broken.