From 8beb64d82c41b68ac1bedff8e3d6904e0b0feae9 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Mon, 20 Mar 2023 21:42:14 +0100 Subject: [PATCH] Fix github header handling to be case insensitive, fixes rate limit extraction (#11366) --- src/Composer/Util/GitHub.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Composer/Util/GitHub.php b/src/Composer/Util/GitHub.php index a495a8569..bd4993b6a 100644 --- a/src/Composer/Util/GitHub.php +++ b/src/Composer/Util/GitHub.php @@ -203,7 +203,7 @@ class GitHub public function isRateLimited(array $headers) { foreach ($headers as $header) { - if (Preg::isMatch('{^X-RateLimit-Remaining: *0$}i', trim($header))) { + if (Preg::isMatch('{^x-ratelimit-remaining: *0$}i', trim($header))) { return true; } } @@ -223,7 +223,7 @@ class GitHub public function requiresSso(array $headers) { foreach ($headers as $header) { - if (Preg::isMatch('{^X-GitHub-SSO: required}i', trim($header))) { + if (Preg::isMatch('{^x-github-sso: required}i', trim($header))) { return true; } }