Blame SOURCES/lftp-4.4.8-mirror302.patch

18a597
diff -Naurp lftp-4.4.8.orig/src/FileAccess.h lftp-4.4.8/src/FileAccess.h
18a597
--- lftp-4.4.8.orig/src/FileAccess.h	2013-05-27 14:05:24.000000000 +0200
18a597
+++ lftp-4.4.8/src/FileAccess.h	2015-05-13 15:02:31.556462128 +0200
18a597
@@ -26,6 +26,7 @@
18a597
 #include "SMTask.h"
18a597
 #include "trio.h"
18a597
 #include "xstring.h"
18a597
+#include "misc.h"
18a597
 #include "ResMgr.h"
18a597
 #include "FileSet.h"
18a597
 #include "ArgV.h"
18a597
@@ -86,6 +87,7 @@ public:
18a597
       void Set(const char *new_path,bool new_is_file=false,const char *new_url=0,int device_prefix_len=0);
18a597
       void SetURL(const char *u) { url.set(u); }
18a597
       void Change(const char *new_path,bool new_is_file=false,const char *new_path_enc=0,int device_prefix_len=0);
18a597
+      const xstring& GetDirectory() const { return is_file?dirname(path):path; }
18a597
       void ExpandTilde(const Path &home;;
18a597
       static void Optimize(xstring& p,int dev_prefix=0);
18a597
       void Optimize() { Optimize(path,device_prefix_len); }
18a597
diff -Naurp lftp-4.4.8.orig/src/MirrorJob.cc lftp-4.4.8/src/MirrorJob.cc
18a597
--- lftp-4.4.8.orig/src/MirrorJob.cc	2013-03-19 13:57:12.000000000 +0100
18a597
+++ lftp-4.4.8/src/MirrorJob.cc	2015-05-13 15:10:58.419627179 +0200
18a597
@@ -561,22 +561,25 @@ void MirrorJob::HandleChdir(FileAccessRe
18a597
 	 // cd to another url.
18a597
 	 const char *loc_c=session->GetNewLocation();
18a597
 	 int max_redirections=ResMgr::Query("xfer:max-redirections",0);
18a597
-	 if(loc_c && max_redirections>0 && last_char(loc_c)=='/')
18a597
+	 if(loc_c && max_redirections>0)
18a597
 	 {
18a597
 	    if(++redirections>max_redirections)
18a597
 	       goto cd_err_normal;
18a597
 	    eprintf(_("%s: received redirection to `%s'\n"),"mirror",loc_c);
18a597
 
18a597
 	    char *loc=alloca_strdup(loc_c);
18a597
-	    session->Close(); // loc_c is no longer valid.
18a597
-
18a597
 	    ParsedURL u(loc,true);
18a597
 
18a597
 	    if(!u.proto)
18a597
 	    {
18a597
-	       session->Chdir(url::decode(loc));
18a597
+	       bool is_file=(last_char(loc)!='/');
18a597
+	       FileAccess::Path new_cwd(session->GetNewCwd());
18a597
+	       new_cwd.Change(0,is_file,loc);
18a597
+	       session->PathVerify(new_cwd);
18a597
+	       session->Roll();
18a597
 	       return;
18a597
 	    }
18a597
+	    session->Close(); // loc_c is no longer valid.
18a597
 	    session=FA::New(&u);
18a597
 	    session->Chdir(u.path);
18a597
 	    return;
18a597
@@ -680,7 +683,7 @@ int   MirrorJob::Do()
18a597
       if(source_session->IsOpen())
18a597
 	 return m;
18a597
 
18a597
-      source_dir.set(source_session->GetCwd());
18a597
+      source_dir.set(source_session->GetCwd().GetDirectory());
18a597
 
18a597
    pre_MAKE_TARGET_DIR:
18a597
    {
18a597
@@ -763,7 +766,7 @@ int   MirrorJob::Do()
18a597
 	 return m;
18a597
       create_target_dir=false;
18a597
 
18a597
-      target_dir.set(target_session->GetCwd());
18a597
+      target_dir.set(target_session->GetCwd().GetDirectory());
18a597
 
18a597
    pre_GETTING_LIST_INFO:
18a597
       set_state(GETTING_LIST_INFO);