#23618 [Asn->Fbk]: stream_set_timeout() doesn't work for ssl://
ID: 23618
Updated by: iliaa@php.net
Reported By: waboring at 3gstech dot com
-Status: Assigned
+Status: Feedback
Bug Type: Sockets related
Operating System: linux redhate 9
PHP Version: 4.3.1
Assigned To: wez
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
The test script appears to work correctly using the latest CVS.
Previous Comments:
------------------------------------------------------------------------
[2003-05-15 19:01:25] wez@php.net
Working on a fix
------------------------------------------------------------------------
[2003-05-13 18:23:23] waboring at 3gstech dot com
stream_set_timeout() doesn't seem to work when using
fsockopen("ssl://<some host here", 443, $errno, $errstr);
My example code
In my real test I am using an web server on my net that does some
processing in a script and over time spits me back info. This script
shows a test calling www.verisign.com in ssl:// mode and non ssl mode.
I never the timeouts when using ssl://, but I do when using non-ssl
fsockopen connections.
<?php
$url = "/";
$scan_host = "www.verisign.com";
//$fp = fsockopen("ssl://".$scan_host, 443, $errno, $errstr, 5);
$fp = fsockopen($scan_host, 80, $errno, $errstr, 5);
if (!$fp) {
echo "$errstr ($errno)<br>\n";
} else {
$header = "GET ".$url." HTTP/1.0\r\nHost: ".$scan_url."\r\n";
$header .= "Connection: close\r\n\r\n";
fputs ($fp, $header);
stream_set_timeout($fp, 0,500);
$keep_alive = time();
while (!feof($fp)) {
$str = fgets ($fp,1024);
if (strlen($str) > 0) {
echo "got '$str'<br>";
}
$stream_info = stream_get_meta_data( $fp );
if ($stream_info["timed_out"]) {
//the stream timed out
echo "KEEP-ALIVE<br>";
}
if (time() - $keep_alive >= 30) {
echo "keep-alive<br>";
$keep_alive = time();
}
}
fclose ($fp);
}
?>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=23618&edit=1
Thread (4 messages)