php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23618 stream_set_timeout() doesn't work for ssl://
Submitted: 2003-05-13 18:23 UTC Modified: 2003-07-29 07:25 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:0 (0.0%)
From: waboring at 3gstech dot com Assigned: wez (profile)
Status: No Feedback Package: Sockets related
PHP Version: 4.3.1 OS: linux redhate 9
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: waboring at 3gstech dot com
New email:
PHP Version: OS:

 

 [2003-05-13 18:23 UTC] 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);
}

?>



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-15 19:01 UTC] wez@php.net
Working on a fix
 [2003-07-25 08:38 UTC] iliaa@php.net
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.
 [2003-07-29 07:25 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 00:01:27 2024 UTC