php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46512 fsockopen() timeout can't be below 1.0 with SSL
Submitted: 2008-11-06 20:35 UTC Modified: 2008-11-16 01:00 UTC
From: noah at rave dot ca Assigned: dsp (profile)
Status: No Feedback Package: OpenSSL related
PHP Version: 5.2.7RC2 OS: Windows Server 2003
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
29 + 24 = ?
Subscribe to this entry?

 
 [2008-11-06 20:35 UTC] noah at rave dot ca
Description:
------------
When you use fsockopen and connect to SSL if the timeout is less then 1.0 it will cause an error... If it's 1.0 or over it will work as expected...

Reproduce code:
---------------
	if ($fp = fsockopen('ssl://www.website.com', 443, $errno, $errstr, 0.1))
	{
		$out = "GET /schedule/schedule_end/ HTTP/1.1\r\n";
		$out .= "Host: www.website.com\r\n";
		$out .= "Connection: Close\r\n\r\n";
		fputs($fp, $out);
		fclose($fp);
	}

SHOWS ERROR:

Warning: fsockopen() [function.fsockopen]: SSL: connection timeout in C:\Websites\website.com\website\include\show\admin\a.php on line 2

Warning: fsockopen() [function.fsockopen]: Failed to enable crypto in C:\Websites\website.com\website\include\show\admin\a.php on line 2

Warning: fsockopen() [function.fsockopen]: unable to connect to ssl://www.website.com:443 (Unknown error) in C:\Websites\website.com\website\include\show\admin\a.php on line 2




	if ($fp = fsockopen('ssl://www.website.com', 443, $errno, $errstr, 1))
	{
		$out = "GET /schedule/schedule_end/ HTTP/1.1\r\n";
		$out .= "Host: www.website.com\r\n";
		$out .= "Connection: Close\r\n\r\n";
		fputs($fp, $out);
		fclose($fp);
	}

WORKS AS EXPECTED!!!

Expected result:
----------------
It should run with a 0.05, 0.1 or 0.99 timeout as it did in previous versions...


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-06 20:40 UTC] noah at rave dot ca
I'm actually using RC3, which is not in the list...
 [2008-11-08 23:38 UTC] dsp@php.net
In which version did it work for you. For me it seems to be the same behaviour as in PHP 5.2.6. I tested it on Linux.
 [2008-11-11 17:32 UTC] noah at rave dot ca
I'll do some tests tomorrow (Wednesday), I been out of town sorry. I'll let you know.
 [2008-11-16 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 12:01:30 2024 UTC