From 65d97efda8d647f520c5bf23cdb26dfe7f1eb1c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20L=C3=BCck?= Date: Mon, 22 Oct 2018 13:03:18 +0200 Subject: [PATCH] Link to clue/reactphp-buzz for HTTP requests --- README.md | 12 +++++++++++- examples/01-proxy-https.php | 3 +++ examples/02-optional-proxy-https.php | 3 +++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 15fc7dc..91e998e 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ existing higher-level protocol implementation. * [ProxyConnector](#proxyconnector) * [Plain TCP connections](#plain-tcp-connections) * [Secure TLS connections](#secure-tls-connections) + * [HTTP requests](#http-requests) * [Connection timeout](#connection-timeout) * [DNS resolution](#dns-resolution) * [Authentication](#authentication) @@ -49,7 +50,7 @@ existing higher-level protocol implementation. * [License](#license) * [More](#more) -### Quickstart example +## Quickstart example The following example code demonstrates how this library can be used to send a secure HTTPS request to google.com through a local HTTP proxy server: @@ -188,6 +189,15 @@ $connector->connect('tls://smtp.googlemail.com:465')->then(function (ConnectionI > Note how secure TLS connections are in fact entirely handled outside of this HTTP CONNECT client implementation. +#### HTTP requests + +HTTP operates on a higher layer than this low-level HTTP CONNECT implementation. +If you want to issue HTTP requests, you can add a dependency for +[clue/reactphp-buzz](https://github.com/clue/reactphp-buzz). +It can interact with this library by issuing all +[HTTP requests through a HTTP CONNECT proxy server](https://github.com/clue/reactphp-buzz#http-proxy). +This works for both plain HTTP and TLS-encrypted HTTPS requests. + #### Connection timeout By default, the `ProxyConnector` does not implement any timeouts for establishing remote diff --git a/examples/01-proxy-https.php b/examples/01-proxy-https.php index c07ea0d..c91f31d 100644 --- a/examples/01-proxy-https.php +++ b/examples/01-proxy-https.php @@ -2,6 +2,9 @@ // A simple example which requests https://google.com/ through an HTTP CONNECT proxy. // The proxy can be given as first argument and defaults to localhost:8080 otherwise. +// +// For illustration purposes only. If you want to send HTTP requests in a real +// world project, take a look at https://github.com/clue/reactphp-buzz#http-proxy use Clue\React\HttpProxy\ProxyConnector; use React\Socket\Connector; diff --git a/examples/02-optional-proxy-https.php b/examples/02-optional-proxy-https.php index c65e69a..635a925 100644 --- a/examples/02-optional-proxy-https.php +++ b/examples/02-optional-proxy-https.php @@ -6,6 +6,9 @@ // This example highlights how changing from direct connection to using a proxy // actually adds very little complexity and does not mess with your actual // network protocol otherwise. +// +// For illustration purposes only. If you want to send HTTP requests in a real +// world project, take a look at https://github.com/clue/reactphp-buzz#http-proxy use Clue\React\HttpProxy\ProxyConnector; use React\Socket\Connector;