Re: lftp 3.1 : problem with webdav MOVE
Clement Hermann <[email protected]>
| Newsgroups | gmane.network.lftp.devel |
|---|---|
| Message-ID | <[email protected]> |
forgot to paste the result : lftp [email protected]:/extended/upload/test> mv dir/testfile testfile ---> MOVE /extended/upload/test/dir/testfile HTTP/1.1 ---> Host: webdav.example.com ---> User-Agent: lftp/3.1.0 ---> Accept: */* ---> Destination: https://[email protected]/extended/upload/test/testfile ---> Authorization: Basic bGludXhtb3ZpZXotZXh0ZW5kZWQ6ZS1qYWhzdXh4IQ== ---> Connection: keep-alive ---> <--- HTTP/1.1 201 Created <--- Date: Sun, 06 Mar 2005 23:54:36 GMT <--- Server: Apache/1.3.33 (Debian GNU/Linux) PHP/4.3.10-7 mod_ssl/2.8.22 OpenSSL/0.9.7d mod_perl/1.29 DAV/1.0.3 <--- Keep-Alive: timeout=15, max=96 <--- Connection: Keep-Alive <--- Transfer-Encoding: chunked <--- Content-Type: text/html; charset=iso-8859-1 <--- file renamed lftp [email protected]:/extended/upload/test> Clement Hermann wrote: > Hi again, > >> Alexander V. Lukyanov wrote: >> >>> Does this patch fix the problem? >>> >>> >> Sort of. This particular problem is fixed, but two other problems show >> up : >> >> 1) The Destination: header must be the complete path to new >> destination. Giving a collection (directory) as argument will >> overwrite the collection. >> >> so, if I want to move testfile in directory "/test", Destination: must >> be as follow : >> >> Destination: http://user@host/test/testfile >> >> So we must first test if the destination is a directory, and appending >> the filename to the directory URI eventually. At least, this must be >> done to provide a consistent interface accross protocols. This is a >> webdav limitation but the clients I have tested do it that way. We >> could imagine a "rename" command wich do overwrite the destination if >> it's a directory, but I don't see it as a must-have. > > > Concerning this, I might be able to provide a patch, but I need some > advice: how should we test that the destination is a directory, for > maximum consistency ? By creating a boolean function (say, IsDirectory) > and modifying the RENAME case in Http::Send ? > >> 2) when moving a file, lftp wait forever after receiving the response >> from server (unless it is an error). The command must be interrupted >> with ctrl+c : >> [snip] > > > attached is a patch that fixes this issue. Hope I didn't messed up, I'm > a beginner both with lftp and C++ ;) > > Best regards, > > > ------------------------------------------------------------------------ > > --- ../lftp-3.1.0.patched/src/Http.cc 2005-03-07 00:33:42.000000000 +0100 > +++ src/Http.cc 2005-03-07 00:30:21.000000000 +0100 > @@ -60,6 +60,7 @@ > #define H_PARTIAL(x) ((x) == 206) > #define H_REDIRECTED(x) (((x) == 301) || ((x) == 302)) > #define H_EMPTY(x) (((x) == 204) || ((x) == 205)) > +#define H_CREATED(x) ((x) == 201) > #define H_CONTINUE(x) ((x) == 100 || (x) == 102) > #define H_REQUESTED_RANGE_NOT_SATISFIABLE(x) ((x) == 416) > > @@ -1365,6 +1366,13 @@ > if(H_EMPTY(status_code) && body_size<0) > body_size=0; > > + // 201 Created > + if(H_CREATED(status_code)) > + { > + state=DONE; > + return MOVED; > + } > + > if(H_REDIRECTED(status_code)) > { > // check if it is redirection to the same server -- Clément 'nodens' Hermann - "L'air pur ? c'est pas en RL, ça ? c'est pas hors charte ?" Jean in L'Histoire des Pingouins, http://tnemeth.free.fr/fmbl/linuxsf/