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 packages/http/src/Ip/ClientIpResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function resolve(IpAddress|string|null $remoteAddress, RequestHeaders $he
{
$remoteAddress = $this->parse($remoteAddress);

if ($remoteAddress === null || ! $this->trustedProxies->trusts($remoteAddress)) {
if (! $remoteAddress instanceof IpAddress || ! $this->trustedProxies->trusts($remoteAddress)) {
return $remoteAddress;
}

Expand Down
1 change: 1 addition & 0 deletions packages/mcp/src/McpRequestHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ private function listResources(McpServerDefinition $server): array
];
}
}

return ['resources' => $resources];
}

Expand Down
1 change: 1 addition & 0 deletions packages/mcp/src/StdioTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public function run(McpServerDefinition $server, mixed $input, mixed $output): v

continue;
}

$line = trim($line);

if ($line === '') {
Expand Down
18 changes: 7 additions & 11 deletions packages/support/src/Ip/IpAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@
*/
final class IpAddress implements Stringable, Equable
{
/**
* The packed representation of the address. IPv4-mapped IPv6 addresses, such as `::ffff:127.0.0.1`, are narrowed to their IPv4 form.
*
* @internal
*/
private(set) string $bytes;

/**
* Whether the address is an IPv4 address.
*/
Expand All @@ -49,10 +42,13 @@ private function __construct(
* The address as it was given.
*/
private(set) string $value,
string $bytes,
) {
$this->bytes = $bytes;
}
/**
* The packed representation of the address. IPv4-mapped IPv6 addresses, such as `::ffff:127.0.0.1`, are narrowed to their IPv4 form.
*
* @internal
*/
private(set) string $bytes,
) {}

/**
* Creates an address from the given notation, throwing when it is not an address.
Expand Down
2 changes: 1 addition & 1 deletion src/Tempest/Framework/Testing/Http/HttpRouterTester.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ public function makePsrRequest(

$_POST = is_array($body) ? $body : [];

$server = $this->ip === null ? $_SERVER : [...$_SERVER, 'REMOTE_ADDR' => $this->ip->toString()];
$server = $this->ip instanceof IpAddress ? [...$_SERVER, 'REMOTE_ADDR' => $this->ip->toString()] : $_SERVER;

return ServerRequestFactory::fromGlobals($server)->withUploadedFiles($files);
}
Expand Down
1 change: 1 addition & 0 deletions tests/Integration/Mcp/McpStdioTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public function socket_timeouts_do_not_stop_the_message_loop(): void

fclose($pipe);
}

stream_set_timeout($input, seconds: 0, microseconds: 25_000);

$server = $this->container->get(McpConfig::class)->servers[StdioMcpServer::class];
Expand Down
Loading