On Mon, Oct 15, 2001 at 07:46:04PM -0400, Glenn Maynard wrote:
> Tracked down a small set of problems with some FTP servers.
>
> First, some WarFTPD's handle ABOR incorrectly: they don't send a
> "transfer aborted/successful" followed by "ABOR successful", they just
> skip to "ABOR successful". This desyncs lftp; the abort changes the
> expect for "transfer aborted" to "ignore", "ABOR successul" ends up
> being eaten by that ignore, and ftpclass waits indefinitely for the
> "ABOR successful" that already came. ex:
Does attached workaround help it?
> The server *should* return another 2xx or 4xx response for the transfer
> (success or aborted) first; it doesn't. This needs a workaround, but
For braindamaged servers there is 'set use-abor no', BTW.
> This brings up another minor issue: use-quit. If I "quit" here and
> attempt to reconnect, it sends a QUIT, and still waits around (for that
> lost ABOR response), and never really quits unless I close twice. This
This is strange, because server should close control connection when
it receives QUIT. lftp would notice this. Maybe ABOR did not actually work?
225 reply means that data connection is still open, according to RFC.
> There are still problems with yet other broken servers and ABOR; I don't
> think they're handling the telnet sequences correctly, and they need a
> workaround too, but I don't have ready access to one of those right now
> to figure out exactly what can be done.
set use-abor no.
> I noticed netkit-ftp turns on SO_OOBINLINE if it's available; any idea
> why it does this? Conceivably it could make some dumb FTP servers
> behave better, but I can't think of any. (I don't think this has
> anything to do with any of the above, but it might.)
This only matters for receiving OOB messages. Ftp server must not send them,
so it does not matter for client.
--
Alexander.
Index: ftpclass.cc
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/ftpclass.cc,v
retrieving revision 1.207
diff -u -r1.207 ftpclass.cc
--- ftpclass.cc 2001/10/12 07:05:44 1.207
+++ ftpclass.cc 2001/10/16 08:44:17
@@ -2376,7 +2376,8 @@
CloseRespQueue();
- if(!(bool)Query("use-abor",hostname) || control_ssl)
+ if(!(bool)Query("use-abor",hostname) || control_ssl
+ || RespQueueSize()>1)
{
if(copy_mode==COPY_NONE
&& !((flags&PASSIVE_MODE) && addr_received<2))
@@ -2785,6 +2786,7 @@
case(CHECK_CWD_STALE):
case(CHECK_PASV):
case(CHECK_EPSV):
+ case(CHECK_TRANSFER_CLOSED):
#ifdef USE_SSL
case(CHECK_AUTH_TLS):
case(CHECK_PROT):
@@ -2808,9 +2810,11 @@
case(CHECK_PORT):
case(CHECK_FILE_ACCESS):
case(CHECK_RNFR):
- case(CHECK_TRANSFER):
RespQueue[i].check_case=CHECK_IGNORE;
break;
+ case(CHECK_TRANSFER):
+ RespQueue[i].check_case=CHECK_TRANSFER_CLOSED;
+ break;
}
if(cc!=CHECK_USER)
RespQueue[i].log_resp=false;
@@ -3447,6 +3451,16 @@
case CHECK_TRANSFER:
TransferCheck(act);
+ break;
+
+ case CHECK_TRANSFER_CLOSED:
+ if(strstr(line,"ABOR")
+ && RespQueueSize()>=2 && RespQueue[RQ_head+1].check_case==CHECK_ABOR)
+ {
+ DebugPrint("**** ","server bug: 426 reply missed",1);
+ PopResp();
+ AbortedClose();
+ }
break;
#ifdef USE_SSL
Index: ftpclass.h
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/ftpclass.h,v
retrieving revision 1.78
diff -u -r1.78 ftpclass.h
--- ftpclass.h 2001/10/09 12:26:05 1.78
+++ ftpclass.h 2001/10/16 08:39:13
@@ -93,7 +93,8 @@
CHECK_USER_PROXY, // check response for USER sent to proxy
CHECK_PASS, // check response for PASS
CHECK_PASS_PROXY, // check response for PASS sent to proxy
- CHECK_TRANSFER // generic check for transfer
+ CHECK_TRANSFER, // generic check for transfer
+ CHECK_TRANSFER_CLOSED // check for transfer complete when Close()d.
#ifdef USE_SSL
,CHECK_AUTH_TLS,
CHECK_PROT