diff -u -r ../wget-1.7/src/ftp-basic.c ./src/ftp-basic.c --- ../wget-1.7/src/ftp-basic.c Sun May 27 15:34:57 2001 +++ ./src/ftp-basic.c Thu Jun 14 21:26:50 2001 @@ -631,3 +631,52 @@ /* All OK. */ return FTPOK; } + +/* Sends the ABOR request to the server. */ +uerr_t +ftp_abor (struct rbuf *rbuf) +{ + char *request, *respline; + int nwritten; + uerr_t err; + + /* Send ABOR request. */ + request = ftp_request ("ABOR", 0); + nwritten = iwrite (RBUF_FD (rbuf), request, strlen (request)); + if (nwritten < 0) + { + xfree (request); + return WRITEFAILED; + } + xfree (request); + /* Get appropriate response. */ + err = ftp_response (rbuf, &respline); + if (err != FTPOK) + { + xfree (respline); + return err; + } + if (*respline != '2' && *respline != '4') + { + xfree (respline); + return FTPUNKNOWNTYPE; + } + if(*respline == '4') /* Connection closed, now we have to wait for 226 */ + { + xfree (respline); + err = ftp_response (rbuf, &respline); + if (err != FTPOK) + { + xfree (respline); + return err; + } + if (*respline != '2') + { + xfree (respline); + return FTPUNKNOWNTYPE; + } + } + xfree (respline); + /* All OK. */ + return FTPOK; +} diff -u -r ../wget-1.7/src/ftp.c ./src/ftp.c --- ../wget-1.7/src/ftp.c Sun May 27 15:34:58 2001 +++ ./src/ftp.c Thu Jun 14 21:30:59 2001 @@ -801,6 +801,13 @@ /* If no transmission was required, then everything is OK. */ if (!(cmd & (DO_LIST | DO_RETR))) return RETRFINISHED; + + /* If its a RETR command and we are in spider mode everything is OK. */ + if(cmd & DO_RETR && opt.spider){ + closeport(dtsock); + ftp_abor(&con->rbuf); /* Be nice and tell the server we don't want it */ + return RETRFINISHED; + } if (!passive_mode_open) /* we are not using pasive mode so we need to accept */ @@ -1129,14 +1136,16 @@ /* If we get out of the switch above without continue'ing, we've successfully downloaded a file. Remember this fact. */ - downloaded_file(FILE_DOWNLOADED_NORMALLY, locf); + if(!(con->cmd & DO_RETR) || !opt.spider) + downloaded_file(FILE_DOWNLOADED_NORMALLY, locf); if (con->st & ON_YOUR_OWN) { CLOSE (RBUF_FD (&con->rbuf)); rbuf_uninitialize (&con->rbuf); } - logprintf (LOG_VERBOSE, _("%s (%s) - `%s' saved [%ld]\n\n"), + if(!(con->cmd & DO_RETR) || !opt.spider) + logprintf (LOG_VERBOSE, _("%s (%s) - `%s' saved [%ld]\n\n"), tms, tmrate, locf, len); if (!opt.verbose && !opt.quiet) { @@ -1164,7 +1173,7 @@ by the more specific option --dont-remove-listing, and the code to do this deletion is in another function. */ } - else + else if(!opt.spider) /* This is not a directory listing file. */ { /* Unlike directory listing files, don't pretend normal files weren't diff -u -r ../wget-1.7/src/ftp.h ./src/ftp.h --- ../wget-1.7/src/ftp.h Sun May 27 15:34:59 2001 +++ ./src/ftp.h Thu Jun 14 20:16:20 2001 @@ -44,6 +44,7 @@ uerr_t ftp_list PARAMS ((struct rbuf *, const char *)); uerr_t ftp_syst PARAMS ((struct rbuf *, enum stype *)); uerr_t ftp_pwd PARAMS ((struct rbuf *, char **)); +uerr_t ftp_abor PARAMS ((struct rbuf *)); struct urlinfo;