mirror of
https://github.com/apple/container.git
synced 2026-10-13 09:39:18 +00:00
Fix: bad request will remove header and retry login (#711)
If you're requesting on `/v2/` with basic auth, AWS ECR will return 400 Bad Request and won't provide `www-authenticate` information. Retry the request after removing the Authorization header. Continue PR #429 Fixed apple/container#847 Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>
This commit is contained in:
1 parent
b62edd2e2d
commit
de075fff8a
1 file changed
+5
@@ -210,6 +210,11 @@ public final class RegistryClient: ContentClient {
|
||||
throw err
|
||||
}
|
||||
|
||||
continue
|
||||
} else if _response.status == .badRequest && request.headers.contains(name: "Authorization") {
|
||||
// Retry without basic auth
|
||||
request.headers.remove(name: "Authorization")
|
||||
retryCount += 1
|
||||
continue
|
||||
}
|
||||
guard let retryOptions = self.retryOptions else {
|
||||
|
||||
Reference in new issue
Block a user