On Mon, Jun 18, 2012 at 11:47:10AM -0700, Christian Harms wrote: > If found the difference. The WebDAV server cant handle the > allprop-request-body. Try the PROPFIND without a request-body:
Please try this patch. -- Alexander.
diff --git a/src/FileSet.cc b/src/FileSet.cc index 3d42dde..8b932d0 100644 --- a/src/FileSet.cc +++ b/src/FileSet.cc @@ -935,7 +935,7 @@ void FileInfo::MakeLongName() int w=20-strlen(usergroup); if(w<1) w=1; - char size_str[20]; + char size_str[21]; if(defined&SIZE) snprintf(size_str,sizeof(size_str),"%*lld",w,(long long)size); else diff --git a/src/Http.cc b/src/Http.cc index a8c4d2d..447effe 100644 --- a/src/Http.cc +++ b/src/Http.cc @@ -471,6 +471,9 @@ void Http::SendRequest(const char *connection,const char *f) "<propfind xmlns=\"DAV:\">" "<allprop/>" "</propfind>\r\n"; + if(!QueryBool("use-allprop",hostname)) + allprop=""; + int allprop_len=strlen(allprop); xstring pfile; if(proxy && !https) @@ -604,7 +607,8 @@ void Http::SendRequest(const char *connection,const char *f) SendMethod("PROPFIND",efile); Send("Depth: 0\r\n"); // no directory listing required Send("Content-Type: text/xml\r\n"); - Send("Content-Length: %d\r\n",(int)strlen(allprop)); + if(allprop_len>0) + Send("Content-Length: %d\r\n",allprop_len); } else SendMethod("HEAD",efile); @@ -627,7 +631,8 @@ void Http::SendRequest(const char *connection,const char *f) SendMethod("PROPFIND",efile); Send("Depth: 1\r\n"); // directory listing required Send("Content-Type: text/xml\r\n"); - Send("Content-Length: %d\r\n",(int)strlen(allprop)); + if(allprop_len>0) + Send("Content-Length: %d\r\n",allprop_len); pos=0; } break; diff --git a/src/HttpDirXML.cc b/src/HttpDirXML.cc index c20a27f..59bb9dd 100644 --- a/src/HttpDirXML.cc +++ b/src/HttpDirXML.cc @@ -33,11 +33,15 @@ struct xml_context xarray_s<xstring_c> stack; Ref<FileSet> fs; Ref<FileInfo> fi; - xstring_c base_dir; + xstring base_dir; void push(const char *); void pop(); - void set_base_dir(const char *d) { base_dir.set(d); } + void set_base_dir(const char *d) { + base_dir.set(d); + if(base_dir.length()>1) + base_dir.chomp('/'); + } const char *top(int i=0) { return stack.count()>i ? stack[stack.count()-i-1].get() : 0; } }; @@ -62,6 +66,7 @@ static void start_handle(void *data, const char *el, const char **attr) else if(!strcmp(ctx->top(), "DAV:collection")) { ctx->fi->SetType(ctx->fi->DIRECTORY); + ctx->fi->SetMode(0755); } } static void end_handle(void *data, const char *el) @@ -95,7 +100,8 @@ static void chardata_handle(void *data, const char *chardata, int len) int s_len=strlen(s); if(s_len>0 && s[s_len-1]=='/') { - s[s_len-1]=0; + if(s_len>1) + s[--s_len]=0; ctx->fi->SetType(ctx->fi->DIRECTORY); ctx->fi->SetMode(0755); } @@ -106,12 +112,7 @@ static void chardata_handle(void *data, const char *chardata, int len) } if(s[0]=='/' && s[1]=='~') s++; - const char *name; - if(ctx->base_dir && !strcmp(s,ctx->base_dir)) - name="."; - else - name=basename_ptr(s); - ctx->fi->SetName(name); + ctx->fi->SetName(ctx->base_dir.eq(s) ? "." : basename_ptr(s)); } else if(!strcmp(tag,"DAV:getcontentlength")) { diff --git a/src/resource.cc b/src/resource.cc index 959b8e7..06d1d9c 100644 --- a/src/resource.cc +++ b/src/resource.cc @@ -253,6 +253,7 @@ static ResType lftp_vars[] = { {"hftp:use-head", "yes", ResMgr::BoolValidate,0}, {"hftp:use-mkcol", "no", ResMgr::BoolValidate,0}, {"hftp:use-propfind", "no", ResMgr::BoolValidate,0}, + {"hftp:use-allprop", "no", ResMgr::BoolValidate,0}, {"hftp:use-type", "yes", ResMgr::BoolValidate,0}, {"http:accept", "*/*", 0,0}, {"http:accept-language", "", 0,0}, @@ -263,6 +264,7 @@ static ResType lftp_vars[] = { {"http:proxy", "", HttpProxyValidate,0}, {"http:use-mkcol", "yes", ResMgr::BoolValidate,0}, {"http:use-propfind", "no", ResMgr::BoolValidate,0}, + {"http:use-allprop", "no", ResMgr::BoolValidate,0}, {"http:user-agent", PACKAGE"/"VERSION,0,0}, {"http:cookie", "", 0,0}, {"http:set-cookies", "no", 0,0},
_______________________________________________ lftp-devel mailing list lftp-devel@uniyar.ac.ru http://univ.uniyar.ac.ru/mailman/listinfo/lftp-devel