1
0
Fork 0

Fix github header handling to be case insensitive, fixes rate limit extraction (#11366)

pull/11920/head
Jordi Boggiano 2023-03-20 21:42:14 +01:00
parent 44ebeb7e8f
commit 8beb64d82c
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 2 additions and 2 deletions

View File

@ -203,7 +203,7 @@ class GitHub
public function isRateLimited(array $headers) public function isRateLimited(array $headers)
{ {
foreach ($headers as $header) { 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; return true;
} }
} }
@ -223,7 +223,7 @@ class GitHub
public function requiresSso(array $headers) public function requiresSso(array $headers)
{ {
foreach ($headers as $header) { 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; return true;
} }
} }