Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: http::dav keep_alive not enabled

by Khen1950fx (Canon)
on Jan 06, 2011 at 13:44 UTC ( [id://880822]=note: print w/replies, xml ) Need Help??


in reply to http::dav keep_alive not enabled

Thanks for adding your code. Now we can get down to business. I looked at your code, and it seemed to me that you had too much going on. I didn't see any reason for Getopt::Long; LWP::Debug has been deprecated, and I took out SOAP::Lite. This is how I would approach it:
#!/usr/bin/perl use strict; use warnings; use HTTP::DAV; my $source = "/home/jadli_r/sharepoint_test/test.txt"; my $destination = "https://fddld.com/sites/A055/files/"; my $username = "uname"; my $password = "passwd"; my $ua = HTTP::DAV::UserAgent->new( keep_alive => 1 ); my $dav = new HTTP::DAV( -useragent => $ua ); $dav->credentials( -user => $username, -pass => $password, -url => $destination, -realm => "DAV realm", ); $dav->open( -url => $destination ) or die("Couldn't open $destination: " .$dav->message . "\n"); $dav->lock( -url => $destination, -timeout => "infinity" ) or die "Put requires infinity\n"; if ( $dav->put( -local => $source, -url => $destination ) ) { print "Successfully uploaded $source to $destination\n"; } else { print "Put failed: " . $dav->message . "\n"; }
Note that I'm not sure that you'll need keep_alive with an infinite lock.

Replies are listed 'Best First'.
Re^2: http::dav keep_alive not enabled
by cnytus (Initiate) on Jan 06, 2011 at 14:02 UTC
    Hi,
    you are right, the code was a mess since i was trying everything at once :).
    initialising the dav with useragent fixed the problem.
    my @ua_args = (keep_alive => 1); my $ua = HTTP::DAV::UserAgent -> new (@ua_args); my $dav = HTTP::DAV->new(-useragent => $ua) ;
    thanks a lot for the replies. Cheers, C

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://880822]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-04-24 20:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found