On Tue, Nov 20, 2001 at 12:46:14PM -0500, war wrote:
> I want to set a proxy for a particular session.
> -c does not work either.
>
> [war@war war]$ lftp leon -e 'set ftp:proxy "192.168.168.253:3128"'
> cd ok, cwd=/home/war
> lftp [EMAIL PROTECTED]:~> ls
> lftp: ftpclass.cc:1351: int Ftp::Do(): Assertion `peer!=0' failed.
> Aborted
Attached patch should fix this. But you will have to set proxy before
connecting to a host. You can add this to your ~/.lftp/rc:
set ftp:proxy/ftp.leon.... http://192.168.168.253:3128
Substitute actual host name from your bookmark. Then this proxy will
be automatically used when you open the bookmark.
--
Alexander.
Index: ChangeLog
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/ChangeLog,v
retrieving revision 1.516
diff -u -r1.516 ChangeLog
--- ChangeLog 2001/11/20 15:11:58 1.516
+++ ChangeLog 2001/11/21 09:55:28
@@ -1,3 +1,9 @@
+2001-11-21 Alexander V. Lukyanov <[EMAIL PROTECTED]>
+
+ * ftpclass.cc, ftpclass.h: don't assume peer!=0, copy control socket
+ name to member peer_sa.
+ * NetAccess.cc: remove obsolete commented out asserts.
+
2001-11-20 Alexander V. Lukyanov <[EMAIL PROTECTED]>
* DirColors.cc, DirColors.h: move resource definition to make it
Index: NetAccess.cc
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/NetAccess.cc,v
retrieving revision 1.45
diff -u -r1.45 NetAccess.cc
--- NetAccess.cc 2001/11/14 11:25:12 1.45
+++ NetAccess.cc 2001/11/21 09:37:19
@@ -510,9 +510,6 @@
}
retries++;
-// assert(peer!=0);
-// assert(peer_curr<peer_num);
-
return true;
}
Index: ftpclass.cc
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/ftpclass.cc,v
retrieving revision 1.216
diff -u -r1.216 ftpclass.cc
--- ftpclass.cc 2001/11/15 12:52:53 1.216
+++ ftpclass.cc 2001/11/21 09:48:26
@@ -88,7 +88,6 @@
#define FTPS_DATA_PORT 989
#define super NetAccess
-#define peer_sa (peer[peer_curr])
#define is5XX(code) ((code)>=500 && (code)<600)
#define is4XX(code) ((code)>=400 && (code)<500)
@@ -1036,17 +1035,6 @@
takeover_time=now;
}
- // connected session (o) must have resolved address
- if(!peer)
- {
- // copy resolved address so that it would be possible to create
- // data connection.
- xfree(peer);
- peer=(sockaddr_u*)xmemdup(o->peer,o->peer_num*sizeof(*o->peer));
- peer_num=o->peer_num;
- peer_curr=o->peer_curr;
- }
-
if(level==0 && xstrcmp(real_cwd,o->real_cwd))
continue;
@@ -1141,11 +1129,13 @@
if(!NextTry())
return MOVED;
+ peer_sa=peer[peer_curr];
control_sock=socket(peer_sa.sa.sa_family,SOCK_STREAM,IPPROTO_TCP);
if(control_sock==-1)
{
if(peer_curr+1<peer_num)
{
+ try_time=0;
peer_curr++;
retries--;
return MOVED;
@@ -1210,6 +1200,9 @@
if(!(res&POLLOUT))
goto usual_return;
+ addr_len=sizeof(peer_sa);
+ getsockname(control_sock,&peer_sa.sa,&addr_len);
+
#ifdef USE_SSL
if(proxy?!strncmp(proxy,"ftps://",7):ftps)
{
@@ -1353,9 +1346,6 @@
}
takeover_time=NO_DATE;
- assert(peer!=0);
- assert(peer_curr<peer_num);
-
if(home==0 && !RespQueueIsEmpty())
goto usual_return;
@@ -3201,6 +3191,7 @@
assert(aborted_data_sock==-1);
aborted_data_sock=o->aborted_data_sock;
o->aborted_data_sock=-1;
+ peer_sa=o->peer_sa;
if(peer_curr>=peer_num)
peer_curr=0;
type=o->type;
Index: ftpclass.h
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/ftpclass.h,v
retrieving revision 1.81
diff -u -r1.81 ftpclass.h
--- ftpclass.h 2001/11/15 12:15:50 1.81
+++ ftpclass.h 2001/11/21 09:15:32
@@ -156,6 +156,7 @@
int control_sock;
int data_sock;
int aborted_data_sock;
+ sockaddr_u peer_sa;
bool quit_sent;
bool fixed_pasv; // had to fix PASV address.