Please try the attached patch. Sorry for mail filtering. It is done to fight spam. To avoid the filter, register your mail server in reverse DNS with a good name. In the mean time, I have added your IP address to white list.
-- Alexander. | http://www.yars.free.net/~lav/
Index: GetJob.cc =================================================================== RCS file: /home/lav/cvsroot/lftp/src/GetJob.cc,v retrieving revision 1.23 diff -u -p -r1.23 GetJob.cc --- GetJob.cc 29 Apr 2005 05:42:39 -0000 1.23 +++ GetJob.cc 28 Jun 2006 06:17:54 -0000 @@ -56,27 +56,13 @@ int GetJob::Do() return m; } -FileCopyPeer *GetJob::NoProtoSrc(const char *src,bool from_local) +FileCopyPeer *GetJob::NoProtoSrcLocal(const char *src) { - if(from_local) - { - const char *f=(cwd && src[0]!='/') ? dir_file(cwd,src) : src; - return FileCopyPeerFDStream::NewGet(f); - } - - FileCopyPeerFA *s=new FileCopyPeerFA(session,src,FA::RETRIEVE); - s->DontReuseSession(); - return s; + const char *f=(cwd && src[0]!='/') ? dir_file(cwd,src) : src; + return FileCopyPeerFDStream::NewGet(f); } -FileCopyPeer *GetJob::NoProtoDst(const char *dst,bool to_local) +FileCopyPeer *GetJob::NoProtoDstLocal(const char *dst) { - if(!to_local) - { - FileCopyPeerFA *s=new FileCopyPeerFA(session,dst,FA::STORE); - s->DontReuseSession(); - return s; - } - int flags=O_WRONLY|O_CREAT|(cont?0:O_TRUNC); dst=expand_home_relative(dst); const char *f=(cwd && dst[0]!='/') ? dir_file(cwd,dst) : dst; @@ -114,18 +100,25 @@ FileCopyPeer *GetJob::NoProtoDst(const c p->DontDeleteStream(); return p; } +FileCopyPeer *GetJob::NoProtoPeer(FileAccess *session,const char *src,FA::open_mode mode) +{ + FileCopyPeerFA *peer=new FileCopyPeerFA(session,src,mode); + if(this->session==session) + peer->DontReuseSession(); + return peer; +} -FileCopyPeer *GetJob::CreateCopyPeer(const char *path,FA::open_mode mode) +FileCopyPeer *GetJob::CreateCopyPeer(FileAccess *session,const char *path,FA::open_mode mode) { ParsedURL url(path); if(!url.proto) return (mode==FA::STORE) - ? NoProtoDst(path,!reverse) - : NoProtoSrc(path,reverse); + ? (reverse ? NoProtoPeer(session,path,mode) : NoProtoDstLocal(path)) + : (reverse ? NoProtoSrcLocal(path) : NoProtoPeer(session,path,mode)); else if(!strcasecmp(url.proto,"file")) return (mode==FA::STORE) - ? NoProtoDst(url.path,true) - : NoProtoSrc(url.path,true); + ? NoProtoDstLocal(url.path) + : NoProtoSrcLocal(url.path); return new FileCopyPeerFA(&url,mode); } @@ -155,10 +148,10 @@ try_next: return; } - FileCopyPeer *dst_peer=CreateCopyPeer(dst,FA::STORE); + FileCopyPeer *dst_peer=CreateCopyPeer(session,dst,FA::STORE); if(!dst_peer) goto try_next; - FileCopyPeer *src_peer=CreateCopyPeer(src,FA::RETRIEVE); + FileCopyPeer *src_peer=CreateCopyPeer(session,src,FA::RETRIEVE); FileCopy *c=FileCopy::New(src_peer,dst_peer,cont); Index: GetJob.h =================================================================== RCS file: /home/lav/cvsroot/lftp/src/GetJob.h,v retrieving revision 1.10 diff -u -p -r1.10 GetJob.h --- GetJob.h 17 Feb 2004 10:45:57 -0000 1.10 +++ GetJob.h 28 Jun 2006 06:19:56 -0000 @@ -27,7 +27,12 @@ class GetJob : public CopyJobEnv { + FileCopyPeer *NoProtoSrcLocal(const char *src); + FileCopyPeer *NoProtoDstLocal(const char *dst); + FileCopyPeer *NoProtoPeer(FileAccess *session,const char *file,FA::open_mode mode); + protected: + FileCopyPeer *CreateCopyPeer(FileAccess *session,const char *path,FA::open_mode mode); void NextFile(); bool delete_files; @@ -39,10 +44,6 @@ protected: void RemoveBackupFile(); - FileCopyPeer *NoProtoSrc(const char *src,bool from_local); - FileCopyPeer *NoProtoDst(const char *dst,bool to_local); - FileCopyPeer *CreateCopyPeer(const char *path,FA::open_mode mode); - public: GetJob(FileAccess *s,ArgV *a,bool c=false); ~GetJob(); Index: pgetJob.cc =================================================================== RCS file: /home/lav/cvsroot/lftp/src/pgetJob.cc,v retrieving revision 1.34 diff -u -p -r1.34 pgetJob.cc --- pgetJob.cc 25 Feb 2004 13:17:06 -0000 1.34 +++ pgetJob.cc 28 Jun 2006 06:21:14 -0000 @@ -74,7 +74,6 @@ int pgetJob::Do() if(chunks==0) { - if(size==NO_SIZE_YET) return m; @@ -100,18 +99,7 @@ int pgetJob::Do() off_t curr_offs=size; for(int i=num_of_chunks; i-->0; ) { - const char *name=cp->GetName(); - FileAccess *s=0; - ParsedURL u(name,true); - if(u.proto && u.path) - { - s=FA::New(&u); - if(s) - name=u.path; - } - if(!s) - s=session->Clone(); - chunks[i]=NewChunk(s,name,local,curr_offs-chunk_size,curr_offs); + chunks[i]=NewChunk(cp->GetName(),local,curr_offs-chunk_size,curr_offs); chunks[i]->SetParentFg(this,false); chunks[i]->cmdline=(char*)xmalloc(7+2*20+1); sprintf(chunks[i]->cmdline,"\\chunk %lld-%lld", @@ -286,17 +274,16 @@ void pgetJob::NextFile() total_eta=-1; } -pgetJob::ChunkXfer *pgetJob::NewChunk(FileAccess *session,const char *remote, - FDStream *local,off_t start,off_t limit) +pgetJob::ChunkXfer *pgetJob::NewChunk(const char *remote,FDStream *local,off_t start,off_t limit) { FileCopyPeerFDStream *dst_peer=new FileCopyPeerFDStream(local,FileCopyPeer::PUT); - FileCopyPeer *src_peer=new FileCopyPeerFA(session,remote,FA::RETRIEVE); - dst_peer->DontDeleteStream(); dst_peer->NeedSeek(); // seek before writing dst_peer->SetBase(0); + FileCopyPeer *src_peer=CreateCopyPeer(session->Clone(),remote,FA::RETRIEVE); + FileCopy *c=FileCopy::New(src_peer,dst_peer,false); c->SetRange(start,limit); c->SetSize(cp->GetSize()); Index: pgetJob.h =================================================================== RCS file: /home/lav/cvsroot/lftp/src/pgetJob.h,v retrieving revision 1.9 diff -u -p -r1.9 pgetJob.h --- pgetJob.h 17 Feb 2004 10:45:59 -0000 1.9 +++ pgetJob.h 28 Jun 2006 05:44:41 -0000 @@ -48,8 +48,7 @@ class pgetJob : public GetJob bool chunks_done:1; void free_chunks(); - ChunkXfer *NewChunk(FileAccess *session,const char *remote, - FDStream *local,off_t start,off_t limit); + ChunkXfer *NewChunk(const char *remote,FDStream *local,off_t start,off_t limit); long total_eta;