Asynchronous file handling by thekid · Pull Request #72 · xp-forge/web

This pull request makes handling files, including ranges, interruptible as described here. This way, file downloads will not block the entire server.

Using this Download class:

use web\Application;
use web\handler\FilesFrom;

class Download extends Application {

  public function routes() {
    return ['/' => new FilesFrom('.')];
  }
}

...and starting the server with -m async, we can see how two parallel downloads can run simultaneously:

image