migas has asked for the wisdom of the Perl Monks concerning the following question:

Dear monks,

I'm not a religious type of guy but hey i tend to be perl-insh ;).

I'm trying to add Web Dav and SFTP into my cross-platform perl backup program (simplebackup - http://migas.kicks-ass.org/index.php?pag=en.myapps&subpag=simplebackup )

But i'm having problems in SFTP and HTTP::DAV...
any way this post is only related to HTTP::DAV problem.

I can upload/backup/put but i can't make downloads/restore/get to work.
Info:
Windows XP SP2
Using ActiveState Perl 5.8.8
http::dav 0.3.1
libxml perl 0.08
XML-DOM 1.44
XML-RegExp 0.03

My problem... basicly the program blows up with this error

get:http://localhost:8080/webdav/teste.rar -> C:\teste.rar

no element found at line 1, column 0, byte -1 at c:/Perl/lib/XML/Parser.pm line 187

Sample Code that i use.

Here is my sample code...
.... (code up including use strict;)
my $special_error_flag = 0; my $network_connection_p= new HTTP::DAV; # create the web dav object $network_connection_p-> DebugLevel(2); $network_connection_p-> credentials( -user=>"someuser",-pass => "somepass", -url =>"http://localhost:8080/webdav" ); $network_connection_p-> open( -url=>"http://localhost:8080/webdav") or $special_error_flag = 1; # attempt to open a connection into the web dav server if ( $special_error_flag == 1 ) { # check if we manage to connect print "failed connecting into web dav server } my $from_file = "http://localhost:8080/webdav/teste.rar"; my $to_file_tmp = "c:\\teste_file.rar"; # with relative paths this also fails #my $to_file_tmp = "teste_file.rar"; if ( !$network_connection-> get( -url=>"$from_file", -to=>"$to_file_tm +p" ) ) { print "download failed\n"; } else { print "download worked\n"; }

Any help would be greatefull !

Migas - Miguel

Replies are listed 'Best First'.
Re: Using HTTP::DAV
by Anonymous Monk on Sep 19, 2006 at 10:37 UTC
    The problem appears to be on the server end (not returning valid xml). This might help reveal more
    local $HTTP::DAV::DEBUG = 3;
      Hi,

      Thanks for your reply.
      I tried level 3 and come up with this...

      Setting auth details for localhost:8080, default to migas,migas new_resource: For http://localhost:8080/webdav/, creating new resource Using user/pass combo: migas migas. For webdav, http://localhost:8080/ +webdav/ migas6969 must see if this works... download from http-dav server from_file http://localhost:8080/webdav/teste.zip to_file_tmp teste.zip get: http://localhost:8080/webdav/teste.zip -> teste.zip new_resource: For http://localhost:8080/webdav/teste.zip, creating new + resource Using user/pass combo: migas migas. For webdav, http://localhost:8080/ +webdav/tes te.zip <br> no element found at line 1, column 0, byte -1 at c:/Perl/lib/XML/Parse +r.pm line 187

      I might be blind ;) but i fail to see anything relevent... By the way i'm testing it using NetServe Web Server v1.0.51 from Net-X Solutions Ltd
      I used it because it was fairly easy to set up (i want to test my program and not be a http / webdav admin) but i have come up with some NetServer bugs....

      I wonder does anyone know if NetServer has any web dav implementation bugs ? does anyone know any easy to set up windows webdav server ???

      Migas - Miguel Angelo
Re: Using HTTP::DAV
by Khen1950fx (Canon) on Sep 19, 2006 at 19:16 UTC
    Windows XP SP2 has some bugs. I think that your problem is one of authentication---credentials. As far as I know, Microsoft hasn't fixed the problem. You can check the Microsoft site to see if there is a solution. Here's a workaround:

    HTTP::DAV Workaround

Re: Using HTTP::DAV
by migas (Novice) on Sep 20, 2006 at 08:40 UTC
    Hi All Monks,

    Thanks for all feedback that come up !.
    I found the bug, it was indeed a bug on the web dav implementation of the NetServe Web Server v1.0.51 from Net-X Solutions (http://www.netxsolutions.co.uk/).

    I tried the exact same code on the "enemy" web server (Windows 2003 Internet Information Service) and it worked perfectly the first time around.

    So i can only say that the "enemy" has apparently done a good job in the web dav implementation (at least in Windows 2003).

    But i must try it out with other servers such has apache and so on.

    PS 1: Note to Khen1950fx, thanks for your aswer but i was actually trying to access a webdav server using a perl program (that is suppose to run under Windows and Unix) and not trying to acess a web dav server using Windows Explorer.

    PS 2: I hope i will be seeing you all giving my open source program a try (simplebackup http://migas.kicks-ass.org/index.php?pag=en.myapps&subpag=simplebackup), i hope it will backup to web dav servers and sftp servers in the future


    Stay Happy,
    Migas - Miguel