HTLoadToFile crashing after load on FTP URLs, HTRequest_bytesRead inoperant

I am using HTLoadToFile to retrieve files through http and ftp.
The http access seems to work fine, but the ftp has two annoying behaviours atm:

- The progress information remains empty:

I keep calling HTRequest_bytesRead on each HT_PROG_READ alert callback,
but it remains 0. I can see the file being downloaded and growing though.

- After the download has completed, it crashes. Here's what the end of the
trace says:

Host Event.. READ passed to `ftp://<.....>'
FTP Event... now in state FTP_NEED_DATA
FTP Get Data now in state NEED_BODY
Read Socket. FIN received on socket 20
HTDoClose... Close 20
Net Manager. Decreasing active sockets to 0, 0 persistent sockets
FTP Get Data now in state NEED_BODY
FTP Get Data now in state SUB_ERROR
Error....... Add  22	Severity: 1	Parameter: `Unspecified'	Where: `HTFTPGetData'
FTP Event... now in state FTP_NEED_SERVER
FTP Server.. now in state NEED_SYST
FTP Tx...... SYST

The remote server closes the ftp connection. The local file is complete.
But libwww fails to exit properly and does a SIGSEV right after SYST ..
any idea what would be wrong?

Actually, I know how the crash happens, but I haven't thought of a
solution. I thought for a while that it could be related to the ftp
daemon, but I tried a win32 daemon and proftp, and they both cause the
same crash.

in HTFTP.c at line 1300:

 1299                   else if (status == HT_LOADED || status == HT_CLOSED) {
 1300                       if (ctrl->repcode/100 == 2) {
 1301                           data->complete |= 2;
 1302                           if (data->complete >= 3)
 1303                               ctrl->substate = SUB_SUCCESS;
 1304                           else
 1305                               data_is_active = YES;
 1306                       } else
 1307                           ctrl->substate = SUB_ERROR;
 1308                   } else

this is after

Read Socket. FIN received on socket 20
HTDoClose... Close 20
Net Manager. Decreasing active sockets to 0, 0 persistent sockets
FTP Get Data now in state NEED_BODY

status is HT_CLOSED
ctrl->repcode is 150
data->complete is 1

But the data->complete |= 2 doesn't trigger. If it would, I *think* that
HTFTP.c would finish the job and exit cleanly.

TTimo

Received on Monday, 5 May 2003 11:10:16 UTC