@@ -83,10 +83,14 @@ multiple concurrent HTTP requests without blocking.
8383
8484## Quickstart example
8585
86- Once [ installed] ( #install ) , you can use the following code to access a
87- HTTP webserver and send some simple HTTP GET requests:
86+ Once [ installed] ( #install ) , you can use the following code to access an
87+ HTTP web server and send some simple HTTP GET requests:
8888
8989``` php
90+ <?php
91+
92+ require __DIR__ . '/vendor/autoload.php';
93+
9094$client = new React\Http\Browser();
9195
9296$client->get('http://www.google.com/')->then(function (Psr\Http\Message\ResponseInterface $response) {
@@ -97,6 +101,10 @@ $client->get('http://www.google.com/')->then(function (Psr\Http\Message\Response
97101This is an HTTP server which responds with ` Hello World! ` to every request.
98102
99103``` php
104+ <?php
105+
106+ require __DIR__ . '/vendor/autoload.php';
107+
100108$http = new React\Http\HttpServer(function (Psr\Http\Message\ServerRequestInterface $request) {
101109 return new React\Http\Message\Response(
102110 200,
@@ -594,7 +602,7 @@ HTTP CONNECT proxy servers (also commonly known as "HTTPS proxy" or "SSL proxy")
594602are commonly used to tunnel HTTPS traffic through an intermediary ("proxy"), to
595603conceal the origin address (anonymity) or to circumvent address blocking
596604(geoblocking). While many (public) HTTP CONNECT proxy servers often limit this
597- to HTTPS port` 443 ` only, this can technically be used to tunnel any TCP/IP-based
605+ to HTTPS port ` 443 ` only, this can technically be used to tunnel any TCP/IP-based
598606protocol, such as plain HTTP and TLS-encrypted HTTPS.
599607
600608``` php
@@ -1282,7 +1290,7 @@ Note that (depending on the given `request-target`) certain URI components may
12821290or may not be present, for example the ` getPath(): string ` method will return
12831291an empty string for requests in ` asterisk-form ` or ` authority-form ` .
12841292Its ` getHost(): string ` method will return the host as determined by the
1285- effective request URI, which defaults to the local socket address if a HTTP/1.0
1293+ effective request URI, which defaults to the local socket address if an HTTP/1.0
12861294client did not specify one (i.e. no ` Host ` header).
12871295Its ` getScheme(): string ` method will return ` http ` or ` https ` depending
12881296on whether the request was made over a secure TLS connection to the target host.
@@ -1754,7 +1762,7 @@ As such, this project only bundles a few middleware implementations that are
17541762required to match PHP's request behavior (see below) and otherwise actively
17551763encourages [ Third-Party Middleware] ( #third-party-middleware ) implementations.
17561764
1757- In order to use middleware request handlers, simply pass an array with all
1765+ In order to use middleware request handlers, simply pass a list of all
17581766callables as defined above to the [ ` HttpServer ` ] ( #httpserver ) .
17591767The following example adds a middleware request handler that adds the current time to the request as a
17601768header (` Request-Time ` ) and a final request handler that always returns a 200 code without a body:
0 commit comments