Skip to content

Conversation

bbroerman30
Copy link
Contributor

A bug was identified with the pull request #971 that was merged Friday (Fix 61285 - SSL connections do not timeout ). When compiled and run under Windows, the OpenSSL reads hang even after server socket close due to an infinite loop in the php_openssl_sockop_io() function. (noted when running test case ext/openssl/tests/bug65538_001.phpt)

In this method, the operation is retried when the socket read/write returns an errno of EAGAIN and the SSL error code is SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE. While this worked under Linux, it was incorrect. The current loop should only continue if the errno is EAGAIN and the current operation (read or write) matches the WANT ssl error code (i.e. the operation is read and the ssl error code is SSL_ERROR_WANT_READ ). Otherwise, the operation should exit with the bytes currently in the buffer and the calling method should be allowed to continue processing.

I tested this fix on Windows 7, with PHP compiled using Visual Studio 2012, and in Ubuntu Server 12.2. I ran the entire openssl test suite on both environments, and ran additional tests to ensure operation.

bbroerman30 referenced this pull request Jan 27, 2015
@php-pulls php-pulls merged commit 8302d65 into php:master Jan 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants