Re: lftp 3.1 : problem with webdav MOVE
Clement Hermann <[email protected]>
| Newsgroups | gmane.network.lftp.devel |
|---|---|
| Message-ID | <[email protected]> |
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, -- 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/
lftp-3.1.0-H_CREATED.diff
(text/x-patch, 736 B)
--- ../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