@@ -9,6 +9,9 @@ Async HTTP CONNECT proxy connector, use any TCP/IP protocol through an HTTP prox
99 * [ ConnectorInterface] ( #connectorinterface )
1010 * [ connect()] ( #connect )
1111 * [ ProxyConnector] ( #proxyconnector )
12+ * [ Plain TCP connections] ( #plain-tcp-connections )
13+ * [ Secure TLS connections] ( #secure-tls-connections )
14+ * [ Advanced secure proxy connections] ( #advanced-secure-proxy-connections )
1215* [ Install] ( #install )
1316* [ Tests] ( #tests )
1417* [ License] ( #license )
@@ -118,9 +121,14 @@ higher-level component:
118121+ $client = new SomeClient($proxy);
119122```
120123
124+ #### Plain TCP connections
125+
121126This is most frequently used to issue HTTPS requests to your destination.
122127However, this is actually performed on a higher protocol layer and this
123- connector is actually inherently a general-purpose plain TCP/IP connector:
128+ connector is actually inherently a general-purpose plain TCP/IP connector.
129+
130+ The ` ProxyConnector ` implements the [ ` ConnectorInterface ` ] ( #connectorinterface ) and
131+ hence provides a single public method, the [ ` connect() ` ] ( #connect ) method.
124132
125133``` php
126134$proxy = new ProxyConnector('127.0.0.1:8080', $connector);
@@ -133,9 +141,28 @@ $proxy->connect('tcp://smtp.googlemail.com:587')->then(function (ConnectionInter
133141});
134142```
135143
144+ You can either use the ` ProxyConnector ` directly or you may want to wrap this connector
145+ in React's [ ` Connector ` ] ( https://github.com/reactphp/socket#connector ) :
146+
147+ ``` php
148+ $connector = new Connector($loop, array(
149+ 'tcp' => $proxy,
150+ 'dns' => false
151+ ));
152+
153+ $connector->connect('tcp://smtp.googlemail.com:587')->then(function (ConnectionInterface $stream) {
154+ $stream->write("EHLO local\r\n");
155+ $stream->on('data', function ($chunk) use ($stream) {
156+ echo $chunk;
157+ });
158+ });
159+ ```
160+
136161Note that HTTP CONNECT proxies often restrict which ports one may connect to.
137162Many (public) proxy servers do in fact limit this to HTTPS (443) only.
138163
164+ #### Secure TLS connections
165+
139166If you want to establish a TLS connection (such as HTTPS) between you and
140167your destination, you may want to wrap this connector in React's
141168[ ` Connector ` ] ( https://github.com/reactphp/socket#connector ) or the low-level
@@ -156,6 +183,11 @@ $connector->connect('tls://smtp.googlemail.com:465')->then(function (ConnectionI
156183});
157184```
158185
186+ > Also note how secure TLS connections are in fact entirely handled outside of
187+ this HTTP CONNECT client implementation.
188+
189+ #### Advanced secure proxy connections
190+
159191Note that communication between the client and the proxy is usually via an
160192unencrypted, plain TCP/IP HTTP connection. Note that this is the most common
161193setup, because you can still establish a TLS connection between you and the
0 commit comments