@@ -239,6 +239,13 @@ the remote host rejects the connection etc.), it will reject with a
239239
240240If you want to connect to hostname-port-combinations, see also the following chapter.
241241
242+ > Advanced usage: Internally, the ` TcpConnector ` allocates an empty * context*
243+ resource for each stream resource.
244+ If the destination URI contains a ` hostname ` query parameter, its value will
245+ be used to set up the TLS peer name.
246+ This is used by the ` SecureConnector ` and ` DnsConnector ` to verify the peer
247+ name and can also be used if you want a custom TLS peer name.
248+
242249### DNS resolution
243250
244251The ` DnsConnector ` class implements the
@@ -288,6 +295,17 @@ $connector = new React\SocketClient\Connector($loop, $dns);
288295$connector->connect('www.google.com:80')->then($callback);
289296```
290297
298+ > Advanced usage: Internally, the ` DnsConnector ` relies on a ` Resolver ` to
299+ look up the IP address for the given hostname.
300+ It will then replace the hostname in the destination URI with this IP and
301+ append a ` hostname ` query parameter and pass this updated URI to the underlying
302+ connector.
303+ The underlying connector is thus responsible for creating a connection to the
304+ target IP address, while this query parameter can be used to check the original
305+ hostname and is used by the ` TcpConnector ` to set up the TLS peer name.
306+ If a ` hostname ` is given explicitly, this query parameter will not be modified,
307+ which can be useful if you want a custom TLS peer name.
308+
291309### Secure TLS connections
292310
293311The ` SecureConnector ` class implements the
@@ -333,13 +351,14 @@ $secureConnector = new React\SocketClient\SecureConnector($dnsConnector, $loop,
333351));
334352```
335353
336- > Advanced usage: Internally, the ` SecureConnector ` has to set the required
337- * context options* on the underlying stream resource.
354+ > Advanced usage: Internally, the ` SecureConnector ` relies on setting up the
355+ required * context options* on the underlying stream resource.
338356It should therefor be used with a ` TcpConnector ` somewhere in the connector
339357stack so that it can allocate an empty * context* resource for each stream
340- resource.
341- Failing to do so may result in some hard to trace race conditions, because all
342- stream resources will use a single, shared * default context* resource otherwise.
358+ resource and verify the peer name.
359+ Failing to do so may result in a TLS peer name mismatch error or some hard to
360+ trace race conditions, because all stream resources will use a single, shared
361+ * default context* resource otherwise.
343362
344363### Connection timeouts
345364
0 commit comments