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