/**
* Respond to HTTP requests for filesystem resources
*/
public function __invoke(Request $request, Response $response)
{
$uri = $request->getLocalVar("aerys.sendfile") ?: $request->getUri();
$path = ($qPos = \strpos($uri, "?")) ? \substr($uri, 0, $qPos) : $uri;
// IMPORTANT! Do NOT remove this. If this is left in, we'll be able to use /path\..\../outsideDocRoot defeating the removeDotPathSegments() function! (on Windows at least)
$path = \str_replace("\\", "/", $path);
$path = self::removeDotPathSegments($path);
// We specifically break the lookup generator out into its own method
// so that we can potentially avoid forcing the server to resolve a
// coroutine when the file is already cached.
return ($fileInfo = $this->fetchCachedStat($path, $request)) ? $this->respond($fileInfo, $request, $response) : $this->respondWithLookup($this->root . $path, $path, $request, $response);
}