Skip to content

Releases: reactphp/http

v1.1.0

11 Sep 11:02
Compare
Choose a tag to compare
  • Feature: Support upcoming PHP 8 release, update to reactphp/socket v1.6 and adjust type checks for invalid chunk headers.
    (#391 by @clue)

  • Feature: Consistently resolve base URL according to HTTP specs.
    (#379 by @clue)

  • Feature / Fix: Expose Transfer-Encoding: chunked response header and fix chunked responses for HEAD requests.
    (#381 by @clue)

  • Internal refactoring to remove unneeded MessageFactory and Response classes.
    (#380 and #389 by @clue)

  • Minor documentation improvements and improve test suite, update to support PHPUnit 9.3.
    (#385 by @clue and #393 by @SimonFrings)

v1.0.0

11 Jul 13:33
Compare
Choose a tag to compare

A major new feature release, see release announcement.

  • First stable LTS release, now following SemVer.
    We'd like to emphasize that this component is production ready and battle-tested.
    We plan to support all long-term support (LTS) releases for at least 24 months,
    so you have a rock-solid foundation to build on top of.

This update involves some major new features and a number of BC breaks due to
some necessary API cleanup. We've tried hard to avoid BC breaks where possible
and minimize impact otherwise. We expect that most consumers of this package
will be affected by BC breaks, but updating should take no longer than a few
minutes. See below for more details:

  • Feature: Add async HTTP client implementation.
    (#368 by @clue)

    $browser = new React\Http\Browser($loop);
    $browser->get($url)->then(function (Psr\Http\Message\ResponseInterface $response) {
        echo $response->getBody();
    });

    The code has been imported as-is from clue/reactphp-buzz v2.9.0,
    with only minor changes to the namespace and we otherwise leave all the existing APIs unchanged.
    Upgrading from clue/reactphp-buzz v2.9.0
    to this release should be a matter of updating some namespace references only:

    // old
    $browser = new Clue\React\Buzz\Browser($loop);
    
    // new
    $browser = new React\Http\Browser($loop);
  • Feature / BC break: Add LoopInterface as required first constructor argument to Server and
    change Server to accept variadic middleware handlers instead of array.
    (#361 and #362 by @WyriHaximus)

    // old
    $server = new React\Http\Server($handler);
    $server = new React\Http\Server([$middleware, $handler]);
    
    // new
    $server = new React\Http\Server($loop, $handler);
    $server = new React\Http\Server($loop, $middleware, $handler);
  • Feature / BC break: Move Response class to React\Http\Message\Response and
    expose ServerRequest class to React\Http\Message\ServerRequest.
    (#370 by @clue)

    // old
    $response = new React\Http\Response(200, [], 'Hello!');
    
    // new
    $response = new React\Http\Message\Response(200, [], 'Hello!');
  • Feature / BC break: Add StreamingRequestMiddleware to stream incoming requests, mark StreamingServer as internal.
    (#367 by @clue)

    // old: advanced StreamingServer is now internal only
    $server = new React\Http\StreamingServer($handler);
    
    // new: use StreamingRequestMiddleware instead of StreamingServer
    $server = new React\Http\Server(
         $loop,
         new React\Http\Middleware\StreamingRequestMiddleware(),
         $handler
    );
  • Feature / BC break: Improve default concurrency to 1024 requests and cap default request buffer at 64K.
    (#371 by @clue)

    This improves default concurrency to 1024 requests and caps the default request buffer at 64K.
    The previous defaults resulted in just 4 concurrent requests with a request buffer of 8M.
    See Server for details on how to override these defaults.

  • Feature: Expose ReactPHP in User-Agent client-side request header and in Server server-side response header.
    (#374 by @clue)

  • Mark all classes as final to discourage inheriting from it.
    (#373 by @WyriHaximus)

  • Improve documentation and use fully-qualified class names throughout the documentation and
    add ReactPHP core team as authors to composer.json and license file.
    (#366 and #369 by @WyriHaximus and #375 by @clue)

  • Improve test suite and support skipping all online tests with --exclude-group internet.
    (#372 by @clue)

v0.8.7

05 Jul 11:33
Compare
Choose a tag to compare
  • Fix: Fix parsing multipart request body with quoted header parameters (dot net).
    (#363 by @ebimmel)

  • Fix: Fix calculating concurrency when post_max_size ini is unlimited.
    (#365 by @clue)

  • Improve test suite to run tests on PHPUnit 9 and clean up test suite.
    (#364 by @SimonFrings)

v0.8.6

12 Jan 16:52
v0.8.6
248202e
Compare
Choose a tag to compare
  • Fix: Fix parsing Cookie request header with comma in its values.
    (#352 by @Fiskie)

  • Fix: Avoid unneeded warning when decoding invalid data on PHP 7.4.
    (#357 by @WyriHaximus)

  • Add .gitattributes to exclude dev files from exports.
    (#353 by @reedy)

v0.8.5

29 Oct 14:18
Compare
Choose a tag to compare
  • Internal refactorings and optimizations to improve request parsing performance.
    Benchmarks suggest number of requests/s improved by ~30% for common GET requests.
    (#345, #346, #349 and #350 by @clue)

  • Add documentation and example for JSON/XML request body and
    improve documentation for concurrency and streaming requests and for error handling.
    (#341 and #342 by @clue)

v0.8.4

16 Jan 07:28
v0.8.4
Compare
Choose a tag to compare
  • Improvement: Internal refactoring to simplify response header logic.
    (#321 by @clue)

  • Improvement: Assign Content-Length response header automatically only when size is known.
    (#329 by @clue)

  • Improvement: Import global functions for better performance.
    (#330 by @WyriHaximus)

v0.8.3

11 Apr 15:04
Compare
Choose a tag to compare
  • Feature: Do not pause connection stream to detect closed connections immediately.
    (#315 by @clue)

  • Feature: Keep incoming Transfer-Encoding: chunked request header.
    (#316 by @clue)

  • Feature: Reject invalid requests that contain both Content-Length and Transfer-Encoding request headers.
    (#318 by @clue)

  • Minor internal refactoring to simplify connection close logic after sending response.
    (#317 by @clue)

v0.8.2

06 Apr 08:12
Compare
Choose a tag to compare
  • Fix: Do not pass $next handler to final request handler.
    (#308 by @clue)

  • Fix: Fix awaiting queued handlers when cancelling a queued handler.
    (#313 by @clue)

  • Fix: Fix Server to skip SERVER_ADDR params for Unix domain sockets (UDS).
    (#307 by @clue)

  • Documentation for PSR-15 middleware and minor documentation improvements.
    (#314 by @clue and #297, #298 and #310 by @seregazhuk)

  • Minor code improvements and micro optimizations.
    (#301 by @seregazhuk and #305 by @kalessil)

v0.8.1

05 Jan 15:32
Compare
Choose a tag to compare
  • Major request handler performance improvement. Benchmarks suggest number of
    requests/s improved by more than 50% for common GET requests!
    We now avoid queuing, buffering and wrapping incoming requests in promises
    when we're below limits and instead can directly process common requests.
    (#291, #292, #293, #294 and #296 by @clue)

  • Fix: Fix concurrent invoking next middleware request handlers
    (#293 by @clue)

  • Small code improvements
    (#286 by @seregazhuk)

  • Improve test suite to be less fragile when using ext-event and
    fix test suite forward compatibility with upcoming EventLoop releases
    (#288 and #290 by @clue)

v0.8.0

12 Dec 13:19
Compare
Choose a tag to compare
  • Feature / BC break: Add new Server facade that buffers and parses incoming
    HTTP requests. This provides full PSR-7 compatibility, including support for
    form submissions with POST fields and file uploads.
    The old Server has been renamed to StreamingServer for advanced usage
    and is used internally.
    (#266, #271, #281, #282, #283 and #284 by @WyriHaximus and @clue)

    // old: handle incomplete/streaming requests
    $server = new Server($handler);
    
    // new: handle complete, buffered and parsed requests
    // new: full PSR-7 support, including POST fields and file uploads
    $server = new Server($handler);
    
    // new: handle incomplete/streaming requests
    $server = new StreamingServer($handler);

    While this is technically a small BC break, this should in fact not break
    most consuming code. If you rely on the old request streaming, you can
    explicitly use the advanced StreamingServer to restore old behavior.

  • Feature: Add support for middleware request handler arrays
    (#215, #228, #229, #236, #237, #238, #246, #247, #277, #279 and #285 by @WyriHaximus, @clue and @jsor)

    // new: middleware request handler arrays
    $server = new Server(array(
        function (ServerRequestInterface $request, callable $next) {
            $request = $request->withHeader('Processed', time());
            return $next($request);
        },
        function (ServerRequestInterface $request) {
            return new Response();
        }
    ));
  • Feature: Add support for limiting how many next request handlers can be
    executed concurrently (LimitConcurrentRequestsMiddleware)
    (#272 by @clue and @WyriHaximus)

    // new: explicitly limit concurrency
    $server = new Server(array(
        new LimitConcurrentRequestsMiddleware(10),
        $handler
    ));
  • Feature: Add support for buffering the incoming request body
    (RequestBodyBufferMiddleware).
    This feature mimics PHP's default behavior and respects its post_max_size
    ini setting by default and allows explicit configuration.
    (#216, #224, #263, #276 and #278 by @WyriHaximus and #235 by @andig)

    // new: buffer up to 10 requests with 8 MiB each
    $server = new StreamingServer(array(
        new LimitConcurrentRequestsMiddleware(10),
        new RequestBodyBufferMiddleware('8M'),
        $handler
    ));
  • Feature: Add support for parsing form submissions with POST fields and file
    uploads (RequestBodyParserMiddleware).
    This feature mimics PHP's default behavior and respects its ini settings and
    MAX_FILE_SIZE POST fields by default and allows explicit configuration.
    (#220, #226, #252, #261, #264, #265, #267, #268, #274 by @WyriHaximus and @clue)

    // new: buffer up to 10 requests with 8 MiB each
    // and limit to 4 uploads with 2 MiB each
    $server = new StreamingServer(array(
        new LimitConcurrentRequestsMiddleware(10),
        new RequestBodyBufferMiddleware('8M'),
        new RequestBodyParserMiddleware('2M', 4)
        $handler
    ));
  • Feature: Update Socket to work around sending secure HTTPS responses with PHP < 7.1.4
    (#244 by @clue)

  • Feature: Support sending same response header multiple times (e.g. Set-Cookie)
    (#248 by @clue)

  • Feature: Raise maximum request header size to 8k to match common implementations
    (#253 by @clue)

  • Improve test suite by adding forward compatibility with PHPUnit 6, test
    against PHP 7.1 and PHP 7.2 and refactor and remove risky and duplicate tests.
    (#243, #269 and #270 by @carusogabriel and #249 by @clue)

  • Minor code refactoring to move internal classes to React\Http\Io namespace
    and clean up minor code and documentation issues
    (#251 by @clue, #227 by @kalessil, #240 by @christoph-kluge, #230 by @jsor and #280 by @andig)