mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
begin abstraction process...
This commit is contained in:
parent
5ce97dbf0a
commit
7994817185
49
lib/ftp.c
49
lib/ftp.c
@ -601,6 +601,34 @@ CURLcode Curl_ftp_done(struct connectdata *conn)
|
||||
|
||||
|
||||
|
||||
static CURLCode _ftp_sendquote(struct connectdata *conn, struct curl_slist *quote)
|
||||
{
|
||||
struct curl_slist *item;
|
||||
ssize_t nread;
|
||||
int ftpcode;
|
||||
|
||||
item = quote;
|
||||
while (item) {
|
||||
if (item->data) {
|
||||
ftpsendf(conn->firstsocket, conn, "%", item->data);
|
||||
|
||||
nread = Curl_GetFTPResponse(conn->firstsocket,
|
||||
conn->data->buffer, conn, &ftpcode);
|
||||
if (nread < 0)
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
|
||||
if (ftpcode >= 400) {
|
||||
failf(conn->data, "QUOT string not accepted: %s", item->data);
|
||||
return CURLE_FTP_QUOTE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
ítem = item->next;
|
||||
}
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
static
|
||||
CURLcode _ftp(struct connectdata *conn)
|
||||
{
|
||||
@ -630,25 +658,8 @@ CURLcode _ftp(struct connectdata *conn)
|
||||
|
||||
/* Send any QUOTE strings? */
|
||||
if(data->quote) {
|
||||
qitem = data->quote;
|
||||
/* Send all QUOTE strings in same order as on command-line */
|
||||
while (qitem) {
|
||||
/* Send string */
|
||||
if (qitem->data) {
|
||||
ftpsendf(conn->firstsocket, conn, "%s", qitem->data);
|
||||
|
||||
nread = Curl_GetFTPResponse(conn->firstsocket, buf, conn, &ftpcode);
|
||||
if(nread < 0)
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
|
||||
if (ftpcode >= 400) {
|
||||
failf(data, "QUOT string not accepted: %s",
|
||||
qitem->data);
|
||||
return CURLE_FTP_QUOTE_ERROR;
|
||||
}
|
||||
}
|
||||
qitem = qitem->next;
|
||||
}
|
||||
if ((result = _ftp_sendquote(conn, data->quote)) != CURLE_OK)
|
||||
return result;
|
||||
}
|
||||
|
||||
if(conn->bits.reuse) {
|
||||
|
Loading…
Reference in New Issue
Block a user