ID:               35105
 Updated by:       [EMAIL PROTECTED]
 Reported By:      wckits at rit dot edu
-Status:           Assigned
+Status:           Closed
 Bug Type:         Streams related
 Operating System: SunOS 5.9
 PHP Version:      5CVS-2005-11-08 (snap)
 Assigned To:      wez
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:
------------------------------------------------------------------------

[2005-11-08 21:31:18] [EMAIL PROTECTED]

Assigned to the maintainer and author of streams.


------------------------------------------------------------------------

[2005-11-08 21:07:52] wckits at rit dot edu

Ok, I figured it was just the copy in cvs being broken (some feature
half done or some such), I wasn't trying to be a jerk. I had to add
-mimpure-text to CFLAGS for the last few linking steps to fix the
problem (otherwise I'd get about 16,000 lines of linker errors).

Anyway:

> /u01/wckits/php5-200511081730/sapi/cli/php
<?phpinfo()?>

phpinfo()
PHP Version => 5.1.0RC5-dev

System => SunOS myHostname 5.9 Generic_117171-13 sun4u
Build Date => Nov  8 2005 14:52:09


The timeout problem still exists in php5-latest.

------------------------------------------------------------------------

[2005-11-08 20:14:32] [EMAIL PROTECTED]

Guess what? The snapshot you tried IS the next stable release.
So can you please tell us what didn't work with it?
Just saying "it wont build" does not help much..


------------------------------------------------------------------------

[2005-11-08 19:43:26] wckits at rit dot edu

'Latest' (php5-200511081330) just wont build on my system, same
configuration as 5.0.5... Unless you are willing to cut and paste the
example code into your own latest cvs build this may have to wait for
the next stable release.

------------------------------------------------------------------------

[2005-11-04 15:07:58] wckits at rit dot edu

Description:
------------
A stream opened with stream_socket_client("ssl://..... will not timeout
when reading.

This may have a similar underlying cause to bug #23618 but it is
exposed differently, and is still a problem in 5.0.5.

Reproduce code:
---------------
#!/bin/php-5.0.5/sapi/cli/php
<?
//First connect and do something to prove that we are properly
connected.

print "Setting up context\n";
$ctx = stream_context_create(array(
                        'ssl'=>array(
                                'verify_peer' => false,
                                'allow_self_signed' => true,
                                )
                        ));
print "Creating socket\n";
$socket = stream_socket_client( "ssl://www.rit.edu:443", &$errno,
&$errstr, 10, STREAM_CLIENT_CONNECT, $ctx );
print "Setting timeout\n";
var_dump(stream_set_timeout( $socket, 5 ));
print "Sending bogus request\n";
fwrite($socket, "GET nourl Cupcakes/2.5\n\n\n\n" );
print "Reading Result\n";
var_dump(fgets( $socket));

//Now conenct and read when we know the server isnt going to send
anything

print "Creating NEW socket\n";
$socket = stream_socket_client( "ssl://www.rit.edu:443", &$errno,
&$errstr, 10, STREAM_CLIENT_CONNECT, $ctx );
print "Setting timeout\n";
var_dump(stream_set_timeout( $socket, 5 ));
print "Sending NO request\n";
print "Read should time out in 5....\n";
var_dump(fgets( $socket));
?>


Expected result:
----------------
The first section will run and print an HTTP error. The second section
will run and timeout after printing "Read should timeout in 5..."

Actual result:
--------------
Read does not time out.

I suspect that the read timeout on SSL connections is just not
implemented, because it is hard, but if that is the case the
stream_set_timeout should return false to indicate the error.

If its just not implemented I'd be willing to patch it up if there is
one place to fix it. If there are ssl reads all over the php source I
don't think I'd have the time to track them all down.

I have seen people say "just use select" in response to stream timeout
problems. That does not work with ssl, or at least it may not always
work with ssl. Select can be used if you have access to the native SSL
interface (ie: it could be done right in C) but you need to be able to
check for the WANT_READ condition....


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=35105&edit=1

Reply via email to