diff --git a/src/Client/Transport/HttpTransport.php b/src/Client/Transport/HttpTransport.php index ca2ff445..d0eb140b 100644 --- a/src/Client/Transport/HttpTransport.php +++ b/src/Client/Transport/HttpTransport.php @@ -122,7 +122,7 @@ public function send(string $data): void $this->logger->debug('Received session ID', ['session_id' => $this->sessionId]); } - $contentType = $response->getHeaderLine('Content-Type'); + $contentType = strtolower($response->getHeaderLine('Content-Type')); if (str_contains($contentType, 'text/event-stream')) { $this->activeStream = $response->getBody(); diff --git a/src/Server/Transport/Http/Middleware/AuthorizationMiddleware.php b/src/Server/Transport/Http/Middleware/AuthorizationMiddleware.php index 45c997e4..d4175985 100644 --- a/src/Server/Transport/Http/Middleware/AuthorizationMiddleware.php +++ b/src/Server/Transport/Http/Middleware/AuthorizationMiddleware.php @@ -166,7 +166,7 @@ private function applyAttributes(ServerRequestInterface $request, array $attribu private function parseBearerToken(string $authorization): ?string { - if (!preg_match('/^Bearer\\s+(.+)$/', $authorization, $matches)) { + if (!preg_match('/^Bearer\\s+(.+)$/i', $authorization, $matches)) { return null; } diff --git a/src/Server/Transport/Http/Middleware/ClientRegistrationMiddleware.php b/src/Server/Transport/Http/Middleware/ClientRegistrationMiddleware.php index 82a0b484..6b94e308 100644 --- a/src/Server/Transport/Http/Middleware/ClientRegistrationMiddleware.php +++ b/src/Server/Transport/Http/Middleware/ClientRegistrationMiddleware.php @@ -70,7 +70,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface private function handleRegistration(ServerRequestInterface $request): ResponseInterface { $contentType = $request->getHeaderLine('Content-Type'); - if (!str_starts_with($contentType, 'application/json')) { + if (!str_starts_with(strtolower($contentType), 'application/json')) { return $this->jsonResponse(400, [ 'error' => 'invalid_client_metadata', 'error_description' => 'Content-Type must be application/json.',