Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions ext/ftp/ftp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1605,14 +1605,17 @@ my_recv(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len)

/* {{{ data_available */
int
data_available(ftpbuf_t *ftp, php_socket_t s)
data_available(ftpbuf_t *ftp, php_socket_t s, bool silent)
{
int n;

n = my_poll(s, PHP_POLLREADABLE, 1000);
if (n < 1) {
char buf[256];
if (n == 0) {
if (silent) {
return 0;
}
Comment on lines +1616 to +1618
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While merging up, the signature of the function was changed, so please make it return false rather than 0 then.

#ifdef PHP_WIN32
_set_errno(ETIMEDOUT);
#else
Expand Down Expand Up @@ -1938,7 +1941,9 @@ static void ftp_ssl_shutdown(ftpbuf_t *ftp, php_socket_t fd, SSL *ssl_handle) {
done = 0;
}

while (!done && data_available(ftp, fd)) {
/* Don't report timeouts on the control channel if we're negotiating a shutdown already.
* Some servers don't put a final response. */
while (!done && data_available(ftp, fd, true)) {
ERR_clear_error();
nread = SSL_read(ssl_handle, buf, sizeof(buf));
if (nread <= 0) {
Expand Down Expand Up @@ -2198,7 +2203,7 @@ ftp_nb_continue_read(ftpbuf_t *ftp)
data = ftp->data;

/* check if there is already more data */
if (!data_available(ftp, data->fd)) {
if (!data_available(ftp, data->fd, false)) {
return PHP_FTP_MOREDATA;
}

Expand Down
Loading