mirror of
https://github.com/curl/curl.git
synced 2026-08-26 00:53:39 +03:00
ftp: fix 0-length last write on upload from stdin
When uploading FTP with unknown length, we write a last 0-length chunk with the EOS flag set. OpenSSL's SSL_write() errors on such a write. Skip writing 0-length data to TLS backends instead. Add test in FTPS for such uploads to verify. Fixes #15101 Reported-by: Denis Goleshchikhin Closes #15102
This commit is contained in:
parent
68c358619f
commit
72d2090fc2
3 changed files with 44 additions and 11 deletions
|
|
@ -1743,13 +1743,17 @@ static ssize_t ssl_cf_send(struct Curl_cfilter *cf,
|
|||
bool eos, CURLcode *err)
|
||||
{
|
||||
struct cf_call_data save;
|
||||
ssize_t nwritten;
|
||||
ssize_t nwritten = 0;
|
||||
|
||||
(void)eos; /* unused */
|
||||
CF_DATA_SAVE(save, cf, data);
|
||||
(void)eos;
|
||||
/* OpenSSL and maybe other TLS libs do not like 0-length writes. Skip. */
|
||||
*err = CURLE_OK;
|
||||
nwritten = Curl_ssl->send_plain(cf, data, buf, len, err);
|
||||
CF_DATA_RESTORE(cf, save);
|
||||
if(len > 0) {
|
||||
CF_DATA_SAVE(save, cf, data);
|
||||
*err = CURLE_OK;
|
||||
nwritten = Curl_ssl->send_plain(cf, data, buf, len, err);
|
||||
CF_DATA_RESTORE(cf, save);
|
||||
}
|
||||
return nwritten;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue