-
Notifications
You must be signed in to change notification settings - Fork 0
Function readWholeBuffer causes issues on SSL connections #20
Copy link
Copy link
Open
Description
Hi,
Above all, i know that secure SSL support are not fully tested.
When using SSL, readWholeBuffer doesn't work very well (after some research).
If fact, it seems that $metadata['unread_bytes'] causes the error. And in the
PHP doc, i can read : "Note: You shouldn't use this value in a script."
If you print the buffer (with SSL activated) it is always "G" (The "G" of "GET
....")
So i tried this :
public static function readWholeBuffer($resource){
$buffer = '';
$buffsize = 8192;
$metadata['unread_bytes'] = 0;
/*do{
if(feof($resource))
{
return false;
}
$result = fread($resource, $buffsize);
if($result === false || feof($resource))
{
return false;
}
$buffer .= $result;
$metadata = stream_get_meta_data($resource);
$buffsize = min($buffsize, $metadata['unread_bytes']);
} while($metadata['unread_bytes'] > 0);*/
do {
$result = fread($resource, $buffsize);
if( $result === false ) {
return false;
}
$buffer .= $result;
$metadata = stream_get_meta_data($resource);
} while( !feof($resource) );
return $buffer;
}
It is working with SSL but not without SSL (it's blocking on the 'fread'
instruction). Any Ideas ?
I'm using Google Chrome 17 ( Sec-WebSocket-Version: 13 ) and php 5.2.9 ( i've
changed websocket.server.php a little to make it work with 5.2.9 )
Regards,
Vince
Original issue reported on code.google.com by and1hots...@gmail.com on 1 Mar 2012 at 9:13
Reactions are currently unavailable