summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2007-03-14 19:21:23 +0000
committerAntony Dovgal <tony2001@php.net>2007-03-14 19:21:23 +0000
commitfe2dbd92bccd7770a78d81121e0245edf64dcc3d (patch)
tree55c2e30a614d22200efff85ec02ce179b80df46a
parent20a7f2b3f4df18584ad9bf6ac2efe67301981aef (diff)
downloadphp-git-fe2dbd92bccd7770a78d81121e0245edf64dcc3d.tar.gz
fix #40750 (openssl stream wrapper ignores default_stream_timeout)
-rw-r--r--ext/openssl/xp_ssl.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c
index 2d77a05bf8..3dcf6e6394 100644
--- a/ext/openssl/xp_ssl.c
+++ b/ext/openssl/xp_ssl.c
@@ -47,6 +47,7 @@ int php_openssl_get_x509_list_id(void);
typedef struct _php_openssl_netstream_data_t {
php_netstream_data_t s;
SSL *ssl_handle;
+ struct timeval connect_timeout;
int enable_on_connect;
int is_client;
int ssl_active;
@@ -390,7 +391,7 @@ static inline int php_openssl_enable_crypto(php_stream *stream,
int n, retry = 1;
if (cparam->inputs.activate && !sslsock->ssl_active) {
- float timeout = sslsock->s.timeout.tv_sec + sslsock->s.timeout.tv_usec / 1000000;
+ float timeout = sslsock->connect_timeout.tv_sec + sslsock->connect_timeout.tv_usec / 1000000;
int blocked = sslsock->s.is_blocked;
if (!sslsock->state_set) {
@@ -607,7 +608,7 @@ static int php_openssl_sockop_set_option(php_stream *stream, int option, int val
tv.tv_sec = FG(default_socket_timeout);
tv.tv_usec = 0;
} else {
- tv = sslsock->s.timeout;
+ tv = sslsock->connect_timeout;
}
} else {
tv.tv_sec = value;
@@ -765,8 +766,13 @@ php_stream *php_openssl_ssl_socket_factory(const char *proto, long protolen,
memset(sslsock, 0, sizeof(*sslsock));
sslsock->s.is_blocked = 1;
- sslsock->s.timeout.tv_sec = timeout->tv_sec;
- sslsock->s.timeout.tv_usec = timeout->tv_usec;
+ /* this timeout is used by standard stream funcs, therefor it should use the default value */
+ sslsock->s.timeout.tv_sec = FG(default_socket_timeout);
+ sslsock->s.timeout.tv_usec = 0;
+
+ /* use separate timeout for our private funcs */
+ sslsock->connect_timeout.tv_sec = timeout->tv_sec;
+ sslsock->connect_timeout.tv_usec = timeout->tv_usec;
/* we don't know the socket until we have determined if we are binding or
* connecting */