Hi Wez,
In my first tests I also included support for streams (using
stream_select) in order to support SSL/TLS enabled connections. However,
the SSL transport layer in the Stream "extension" is totally screwed up
if you use asynchronous socket streams.
That's the first I've heard about this; I've been using it in this
fashion successfully
for some time.
Normal (synchronous) connections are working just fine - no problem
here. Have you really tried SSL with non-blocking streams? It works
_sometimes_ (depends on the timing/server/etc.), but not always.
I've checked the source code and openssl SSL_* calls are not used the
way they should be in non-blocking mode.
I'll prepare a test case later...
That's why I started extending the socket extension with socket_ssl_*
functions that use the openssl extension (and thus are only available if
PHP is compiled with openssl support). I will provide a patch for that
once it's complete and out of beta status.
The problem with ext/sockets is that it is old, unmaintained, buggy,
and is not tied into the streams layer.
Buggy? Well, it used to be really buggy some years ago, but I think it's
rather stable now. Sockets are always a little bit problematic because
they are not the same on all operating systems, but at least on Linux
and Windows I don't have any problems.
What if I would start maintaining the sockets extension? I think PHP
should have some low-level connection stuff built-in.
If you really think of moving ext/sockets to PECL I might as well
concentrate on fixing the SSL/crypto problem in non-blocking streams.
It's just that streams aren't so talkative regarding error messages...
Anyway, the Stream-SSL part has to be fixed _before_ moving the socket
extension to PECL.
The first step is opening a bug report with details on how to
reproduce the problems that you've hinted at:
Yeah, I'm going to do that. I started with a bug (crashes PHP on Windows
XP) regarding the streams extension in November. It's assigned, but no
action has been taken yet: http://bugs.php.net/bug.php?id=39396
I see, it's not a "major" bug, but it crashes PHP and might (_might_) be
used to inject code (haven't checked that).
Maurice.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php