Fix mirror when there are multiple 302 redirections

Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
Tomas Hozza 2015-01-13 12:04:02 +01:00
parent e9670a227f
commit 690e4622db
3 changed files with 68 additions and 1 deletions

View File

@ -0,0 +1,25 @@
From ab5d5446bfee9190f9130f6dd8e40270fa9dc99e Mon Sep 17 00:00:00 2001
From: "Alexander V. Lukyanov" <lavv17f@gmail.com>
Date: Tue, 13 Jan 2015 09:12:45 +0300
Subject: [PATCH] (Path::GetDirectory) new method to get directory when is_file
is true.
---
src/FileAccess.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/FileAccess.h b/src/FileAccess.h
index 90c9b0f..821f1d7 100644
--- a/src/FileAccess.h
+++ b/src/FileAccess.h
@@ -90,6 +90,7 @@ public:
void Set(const char *new_path,bool new_is_file=false,const char *new_url=0,int device_prefix_len=0);
void SetURL(const char *u) { url.set(u); }
void Change(const char *new_path,bool new_is_file=false,const char *new_path_enc=0,int device_prefix_len=0);
+ const xstring& GetDirectory() const { return is_file?dirname(path):path; }
void ExpandTilde(const Path &home);
static void Optimize(xstring& p,int dev_prefix=0);
void Optimize() { Optimize(path,device_prefix_len); }
--
2.1.0

View File

@ -0,0 +1,35 @@
From b06344f2da1dfc68b1aa06e8186af174776f363b Mon Sep 17 00:00:00 2001
From: "Alexander V. Lukyanov" <lavv17f@gmail.com>
Date: Tue, 13 Jan 2015 09:13:36 +0300
Subject: [PATCH] mirror: use directory path when the index is a file (after
redirect).
---
src/MirrorJob.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/MirrorJob.cc b/src/MirrorJob.cc
index 54b1465..7f89e11 100644
--- a/src/MirrorJob.cc
+++ b/src/MirrorJob.cc
@@ -773,7 +773,7 @@ int MirrorJob::Do()
if(source_session->IsOpen())
return m;
- source_dir.set(source_session->GetCwd());
+ source_dir.set(source_session->GetCwd().GetDirectory());
pre_MAKE_TARGET_DIR:
{
@@ -856,7 +856,7 @@ int MirrorJob::Do()
return m;
create_target_dir=false;
- target_dir.set(target_session->GetCwd());
+ target_dir.set(target_session->GetCwd().GetDirectory());
pre_GETTING_LIST_INFO:
set_state(GETTING_LIST_INFO);
--
2.1.0

View File

@ -1,7 +1,7 @@
Summary: A sophisticated file transfer program
Name: lftp
Version: 4.6.1
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv3+
Group: Applications/Internet
Source0: ftp://ftp.yar.ru/pub/source/%{name}/%{name}-%{version}.tar.xz
@ -11,6 +11,8 @@ BuildRequires: ncurses-devel, gnutls-devel, pkgconfig, readline-devel, gettext
BuildRequires: zlib-devel
Patch1: lftp-4.0.9-date_fmt.patch
Patch2: lftp-4.0.9-mirror302-1.patch
Patch3: lftp-4.0.9-mirror302-2.patch
%description
LFTP is a sophisticated ftp/http file transfer program. Like bash, it has job
@ -31,6 +33,8 @@ Utility scripts for use with lftp.
%setup -q
%patch1 -p1 -b .date_fmt
%patch2 -p1 -b .mirror302-1
%patch3 -p1 -b .mirror302-2
#sed -i.rpath -e '/lftp_cv_openssl/s|-R.*lib||' configure
sed -i.norpath -e \
@ -93,6 +97,9 @@ rm -rf $RPM_BUILD_ROOT
%changelog
* Tue Jan 13 2015 Tomas Hozza <thozza@redhat.com> - 4.6.1-2
- Fix mirror when there are multiple 302 redirections
* Mon Jan 05 2015 Tomas Hozza <thozza@redhat.com> - 4.6.1-1
- updated to latest upstream 4.6.1