From 064e1a6d6d5e976434f39c5c0f0ac5730ce30720 Mon Sep 17 00:00:00 2001 From: David Fuhr Date: Tue, 10 Nov 2015 16:30:01 +0100 Subject: [PATCH] Fix handling of http 400 errors Before 400 errors were silently dropped. This caused composer to store the returned body (usually some html) in cache. This resulted in later errors when composer tried to extract this error response as zip. With this exceptions thrown it handles the error gracefully and falls back to the next URL provided by the package configuration. --- src/Composer/Util/RemoteFilesystem.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Composer/Util/RemoteFilesystem.php b/src/Composer/Util/RemoteFilesystem.php index f3ad94a82..4fd8b6a0e 100644 --- a/src/Composer/Util/RemoteFilesystem.php +++ b/src/Composer/Util/RemoteFilesystem.php @@ -334,6 +334,12 @@ class RemoteFilesystem { switch ($notificationCode) { case STREAM_NOTIFY_FAILURE: + if (400 === $messageCode) { + // This might happen if your host is secured by ssl client certificate authentication + // but you do not send an appropriate certificate + throw new TransportException("The '" . $this->fileUrl . "' URL could not be accessed: " . $message, $messageCode); + } + case STREAM_NOTIFY_AUTH_REQUIRED: if (401 === $messageCode) { // Bail if the caller is going to handle authentication failures itself.