From: david at acz dot org
Operating system: SuSE Linux
PHP version: 5.2.3
PHP Bug Type: OpenSSL related
Bug description: default_socket_timeout does not work with SSL
Description:
------------
The default socket timeout does not work with SSL streams. An strace
shows PHP calls read(2) and blocks forever.
Reproduce code:
---------------
Create sleepforever.php:
<? for(;;) sleep(1); ?>
Try it with HTTP:
$ php -n -r 'ini_set("default_socket_timeout", 1);
fopen("http://127.0.0.1/sleepforever.php", "r");'
Now try it with HTTPS:
$ time php -n -r 'ini_set("default_socket_timeout", 1);
fopen("https://127.0.0.1/sleepforever.php", "r");'
Expected result:
----------------
Warning: fopen(http://127.0.0.1/sleepforever.php): failed to open stream:
HTTP request failed! in Command line code on line 1
real 0m2.052s
user 0m0.020s
sys 0m0.010s
Actual result:
--------------
The process blocks forever. An strace shows this:
connect(3, {sa_family=AF_INET, sin_port=htons(443),
sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now in
progress)
poll([{fd=3, events=POLLIN|POLLOUT|POLLERR|POLLHUP, revents=POLLOUT}], 1,
1000) = 1
getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
fcntl64(3, F_SETFL, O_RDWR) = 0
write(3, "\200j\1\3\1\0Q\0\0\0\20\0\0\26\0\0\23\0\0\n\7\0\300\0\0"...,
108) = 108
read(3, "\26\3\1\0J\2\0", 7) = 7
*** ELIDED ***
write(3, "\27\3\1\0\30N~h\231u\31S]94^\253\235\26t\324\214\t/\261"..., 29)
= 29
poll([{fd=3, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 0
read(3, *** THIS BLOCKS FOREVER ***
--
Edit bug report at http://bugs.php.net/?id=41631&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=41631&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=41631&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=41631&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=41631&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=41631&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=41631&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=41631&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=41631&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=41631&r=support
Expected behavior: http://bugs.php.net/fix.php?id=41631&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=41631&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=41631&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=41631&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41631&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=41631&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=41631&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=41631&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=41631&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=41631&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=41631&r=mysqlcfg