mirror of
https://github.com/curl/curl.git
synced 2026-08-26 16:23:32 +03:00
ftp: make EPRT connections non-blocking
On platforms where neither accept4 nor fcntl was available, an EPRT connection did not send the accepted socket as non-blocking. This became apparent when TLS was in use and the test receive on shutdown did simply hang. Reported-by: Denis Goleshchikhin Fixes #19753 Closes #19851
This commit is contained in:
parent
15e5ac6da8
commit
891566c72d
6 changed files with 231 additions and 8 deletions
|
|
@ -2114,15 +2114,22 @@ static CURLcode cf_tcp_accept_connect(struct Curl_cfilter *cf,
|
|||
curlx_strerror(SOCKERRNO, errbuf, sizeof(errbuf)));
|
||||
return CURLE_FTP_ACCEPT_FAILED;
|
||||
}
|
||||
#if !defined(HAVE_ACCEPT4) && defined(HAVE_FCNTL)
|
||||
if((fcntl(s_accepted, F_SETFD, FD_CLOEXEC) < 0) ||
|
||||
(curlx_nonblock(s_accepted, TRUE) < 0)) {
|
||||
failf(data, "fcntl set CLOEXEC/NONBLOCK: %s",
|
||||
#ifndef HAVE_ACCEPT4
|
||||
#ifdef HAVE_FCNTL
|
||||
if(fcntl(s_accepted, F_SETFD, FD_CLOEXEC) < 0) {
|
||||
failf(data, "fcntl set CLOEXEC: %s",
|
||||
curlx_strerror(SOCKERRNO, errbuf, sizeof(errbuf)));
|
||||
Curl_socket_close(data, cf->conn, s_accepted);
|
||||
return CURLE_FTP_ACCEPT_FAILED;
|
||||
}
|
||||
#endif
|
||||
#endif /* HAVE_FCNTL */
|
||||
if(curlx_nonblock(s_accepted, TRUE) < 0) {
|
||||
failf(data, "set socket NONBLOCK: %s",
|
||||
curlx_strerror(SOCKERRNO, errbuf, sizeof(errbuf)));
|
||||
Curl_socket_close(data, cf->conn, s_accepted);
|
||||
return CURLE_FTP_ACCEPT_FAILED;
|
||||
}
|
||||
#endif /* !HAVE_ACCEPT4 */
|
||||
infof(data, "Connection accepted from server");
|
||||
|
||||
/* Replace any filter on SECONDARY with one listening on this socket */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue