diff options
author | Daniel Lowrey <rdlowrey@php.net> | 2015-01-27 13:23:58 -0500 |
---|---|---|
committer | Daniel Lowrey <rdlowrey@php.net> | 2015-01-27 13:23:58 -0500 |
commit | 7d663aa90cee76a6cdcfdfdc9bcf730ac2029ee0 (patch) | |
tree | f0289323bf036873b345741716fefa7aed4f8c04 | |
parent | 0290571ccfb3a440599ca009e97f2879bb1d09f0 (diff) | |
parent | 4965fe7fb8c0fdc8a666bee37f46cad329fefe1f (diff) | |
download | php-git-7d663aa90cee76a6cdcfdfdc9bcf730ac2029ee0.tar.gz |
Merge branch 'windows-ssl-timeout-fix'
-rw-r--r-- | ext/openssl/xp_ssl.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c index 0b83fb1678..fb37b03b8f 100644 --- a/ext/openssl/xp_ssl.c +++ b/ext/openssl/xp_ssl.c @@ -1829,10 +1829,13 @@ static size_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, siz retry = handle_ssl_error(stream, nr_bytes, 0); /* If we get this (the above doesn't check) then we'll retry as well. */ - if (errno == EAGAIN && ( err == SSL_ERROR_WANT_READ || SSL_ERROR_WANT_WRITE ) ) { + if (errno == EAGAIN && err == SSL_ERROR_WANT_READ && read) { retry = 1; } - + if (errno == EAGAIN && SSL_ERROR_WANT_WRITE && read == 0) { + retry = 1; + } + /* Also, on reads, we may get this condition on an EOF. We should check properly. */ if (read) { stream->eof = (retry == 0 && errno != EAGAIN && !SSL_pending(sslsock->ssl_handle)); @@ -1868,9 +1871,10 @@ static size_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, siz (POLLIN|POLLPRI) : (POLLOUT|POLLPRI), has_timeout ? &left_time : NULL); } } - /* Finally, we keep going until we got data, and an SSL_ERROR_NONE, unless we had an error. */ - } while (retry); + /* Finally, we keep going until we got data, and an SSL_ERROR_NONE, unless we had an error. */ + } while (retry); + /* Tell PHP if we read / wrote bytes. */ if (nr_bytes > 0) { php_stream_notify_progress_increment(PHP_STREAM_CONTEXT(stream), nr_bytes, 0); |