#23618 [NEW]: stream_set_timeout() doesn't work for ssl://

From: Date: Tue, 13 May 2003 23:23:23 +0000
Subject: #23618 [NEW]: stream_set_timeout() doesn't work for ssl://
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-39575@lists.php.net to get a copy of this message
From:             waboring at 3gstech dot com
Operating system: linux redhate 9
PHP version:      4.3.1
PHP Bug Type:     Sockets related
Bug description:  stream_set_timeout() doesn't work for ssl:// 

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 bug report at http://bugs.php.net/?id=23618&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=23618&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=23618&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=23618&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=23618&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=23618&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=23618&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=23618&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=23618&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=23618&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=23618&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23618&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=23618&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=23618&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=23618&r=gnused



Thread (4 messages)

« previous php.bugs (#39575) next »