packagist react/http v0.8.0

latest releases: dev-master, v1.6.0, v1.5.0...
6 years ago
  • 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)

Don't miss a new http release

NewReleases is sending notifications on new releases.