reactphp/socket-client — pull request #11 by DaveRandom (2014-07-31 23:40:55+00:00)
Title: Ensure SNI details are always set on socket creation

In PHP versions <5.6, SNI is not handled correctly unless the context options are set at the time of socket creation. This causes Apache to return 400 responses to HTTPS requests, as the hostname specified in the Host: header does not match the name indicated by SNI. More info on the Apache-specific effect of this can be found [here](https://bugzilla.redhat.com/show_bug.cgi?id=1098711#c7)

This patch addresses the problem by always setting the SNI_server_name for every socket at creation time. Unfortunately the nature of the problem combined with the manner in which connectors work means that
this is done to every socket regardless of whether it will be used for SSL or not, but this does not have any adverse effects except the microscopic performance hit of creating a stream context where it is not needed.