mirror of
https://github.com/curl/curl.git
synced 2025-01-24 14:15:18 +08:00
Somewhat ugly fix to deal with non-blocking sockets. We just loop and try
again. THIS IS NOT A NICE FIX. We should/must make a select() then and only retry when we can write to the socket again.
This commit is contained in:
parent
6e9d1617c6
commit
b6dba9f5dd
24
lib/ftp.c
24
lib/ftp.c
@ -2058,9 +2058,11 @@ CURLcode Curl_ftp(struct connectdata *conn)
|
|||||||
CURLcode Curl_ftpsendf(struct connectdata *conn,
|
CURLcode Curl_ftpsendf(struct connectdata *conn,
|
||||||
const char *fmt, ...)
|
const char *fmt, ...)
|
||||||
{
|
{
|
||||||
size_t bytes_written;
|
ssize_t bytes_written;
|
||||||
char s[256];
|
char s[256];
|
||||||
size_t write_len;
|
ssize_t write_len;
|
||||||
|
char *sptr=s;
|
||||||
|
CURLcode res = CURLE_OK;
|
||||||
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
@ -2074,9 +2076,23 @@ CURLcode Curl_ftpsendf(struct connectdata *conn,
|
|||||||
|
|
||||||
bytes_written=0;
|
bytes_written=0;
|
||||||
write_len = strlen(s);
|
write_len = strlen(s);
|
||||||
Curl_write(conn, conn->firstsocket, s, write_len, &bytes_written);
|
|
||||||
|
|
||||||
return (bytes_written==write_len)?CURLE_OK:CURLE_WRITE_ERROR;
|
do {
|
||||||
|
res = Curl_write(conn, conn->firstsocket, sptr, write_len,
|
||||||
|
&bytes_written);
|
||||||
|
|
||||||
|
if(CURLE_OK != res)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if(bytes_written != write_len) {
|
||||||
|
write_len -= bytes_written;
|
||||||
|
sptr += bytes_written;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
} while(1);
|
||||||
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
Loading…
Reference in New Issue
Block a user