Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"php": "^8.2 || ^8.3 || ^8.4",
"phunkie/phunkie": "^1.5",
"phunkie/effect": "^1.4",
"phunkie/streams": "^1.4"
"phunkie/streams": "^1.5"
},
"require-dev": {
"phpunit/phpunit": "^10.0 || ^11.0",
Expand Down
16 changes: 8 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions src/Client/ResponseBody.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@

namespace Phunkie\Http4p\Client;

use Phunkie\Streams\Closeable;
use Phunkie\Streams\IO\Resource as Source;

/**
* The body of a response read from the socket as it is pulled: chunked transfer encoding decoded
* chunk by chunk, a Content-Length counted down, or everything until the server closes. The socket
* is closed when the body ends.
* is closed when the body ends, and through Closeable when the stream is cut short or throws.
*/
final class ResponseBody implements Source
final class ResponseBody implements Source, Closeable
{
private const CHUNKED = 'chunked';
private const COUNTED = 'counted';
Expand Down
4 changes: 2 additions & 2 deletions src/Server/PhpServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
use Phunkie\Http4p\Response;
use Phunkie\Http4p\Route;
use Phunkie\Http4p\Router;
use Phunkie\Streams\IO\File\Path;
use Phunkie\Types\ImmList;
use Throwable;

use function Phunkie\Effect\Functions\io\io;
use function Phunkie\Http4p\Functions\Headers;
use function Phunkie\Http4p\Functions\Response;
use function Phunkie\Http4p\Functions\StatusInternalServerError;
use function Phunkie\Streams\Functions\io\readHandle;

/**
* Serves an application through PHP's own SAPI: one request per PHP process, as php-fpm, the
Expand Down Expand Up @@ -82,7 +82,7 @@ public function handleRequest(): IO
}

// Get body as Stream
$body = \Stream(new Path('php://input'), 65536);
$body = readHandle(io(fn () => fopen('php://input', 'rb')), 65536);

return new Request($method, $uri, Headers($headers), $body);
})->flatMap(fn ($request) => ($this->handler)($request))
Expand Down
Loading