At the time I wrote the library the undelrying HTTP module had no way of
doing partial/chunked HTTP PUT requests. Now it does. For instance from the
HTTP::Message module:
*$mess->content_ref* *$mess->content_ref( \$bytes )*
The content_ref()<
http://docs.activestate.com/activeperl/5.10/lib/HTTP/Message.html#content_ref>method
will return a reference to content buffer string. It can be more
efficient to access the content this way if the content is huge, and it can
even be used for direct manipulation of the content, for instance:
${$res->content_ref} =~ s/\bfoo\b/bar/g;
This example would modify the content buffer in-place.
If an argument is passed it will setup the content to reference some
external source. The
content()<
http://docs.activestate.com/activeperl/5.10/lib/HTTP/Message.html#content>and
add_content()<
http://docs.activestate.com/activeperl/5.10/lib/HTTP/Message.html#add_content>methods
will automatically dereference scalar references passed this way.
For other references
content()<
http://docs.activestate.com/activeperl/5.10/lib/HTTP/Message.html#content>will
return the reference itself and
add_content()<
http://docs.activestate.com/activeperl/5.10/lib/HTTP/Message.html#add_content>will
refuse to do anything.
It would not be a big job to modify HTTP::DAV to use this module to call
back to some kind of File::Handle stream that you passed into it. This would
be implemeneted in the HTTP::DAV::Comms class and would need to be leveraged
in the PUT request of HTTP::DAV.
Patrick.
2008/11/21 deneb@gmx.net via RT <bug-HTTP-DAV@rt.cpan.org>
Show quoted text> Fri Nov 21 09:29:34 2008: Request 41121 was acted upon.
> Transaction: Ticket created by deneb@gmx.net
> Queue: HTTP-DAV
> Subject: Out of Memory with proxy and ssl
> Broken in: (no value)
> Severity: Critical
> Owner: Nobody
> Requestors: deneb@gmx.net
> Status: new
> Ticket <URL:
http://rt.cpan.org/Ticket/Display.html?id=41121 >
>
>
> Hi,
>
> I need to upload files with a size of about
> ~500MB via webdav, proxy and ssl.
>
> I'd like to use HTTP::DAV for this,
> but I run into a out of memory error.
>
> $ ./webdav.pl
> Out of memory!
> $
>
> the process with top:
>
> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
> 13777 user 18 0 1931m 1.3g 2300 R 38 66.5 0:10.75 webdav.pl
>
> as peak I saw RES about 1.6g!
>
> Smaller files work, but use also a huge amount of memory!
>
> see Infos below, hope this helps to find the bug.
>
> regards
> Reto
>
> $ uname -a
> Linux hostname 2.6.18-92.1.18.el5 #1 SMP Wed Nov 5 09:00:13 EST 2008
> i686 i686 i386 GNU/Linux
> $
>
> $ head -1 /usr/lib/perl5/vendor_perl/5.8.8/HTTP/DAV.pm
> # $Id: DAV.pm,v 0.35 2008/11/03 10:05:00 cosimo Exp $
> $
>
> $ perl -v
> This is perl, v5.8.8 built for i386-linux-thread-multi
> $
>
> $ ls -la my-test.tar
> -rw-r--r-- 1 user everybody 500736000 Nov 21 14:12 my-test.tar
> $
>
>
> ***********************************************************************
> #!/usr/bin/perl
>
> use HTTP::DAV;
>
> $proxy_ip = "192.168.1.1";
> $proxy_port = "8080";
>
> # proxy support
> $ENV{HTTPS_PROXY} = "http://$proxy_ip:$proxy_port";
>
> my $d = HTTP::DAV->new();
> $url = "
https://example.org/path/to/";
> $d->credentials( -user=>"user",-pass =>"secret",-url =>$url );
>
> $d->open( -url=>"$url" )
> or die("Could not open $url: " .$d->message . "\n");
>
> $file = "./my-test.tar";
>
> # Upload multiple files to newdir.
> if ( $d->put( -local => "$file", -url => $url ) ) {
> print "successfully uploaded multiple files to $url\n";
> } else {
> print "put failed: " . $d->message . "\n";
> }
> ***********************************************************************
>