From b182751d723e09dd45ea2618d09f4b58d588dbb9 Mon Sep 17 00:00:00 2001 From: Marcel Berteler Date: Mon, 28 Nov 2022 08:15:39 +0200 Subject: [PATCH 1/2] Add basic authentication for proxy server #245 --- src/Installer/CKEditorInstaller.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Installer/CKEditorInstaller.php b/src/Installer/CKEditorInstaller.php index 1b9727a5..c99c0328 100644 --- a/src/Installer/CKEditorInstaller.php +++ b/src/Installer/CKEditorInstaller.php @@ -219,6 +219,13 @@ private function createStreamContext(callable $notifier = null) 'request_fulluri' => (bool) getenv('https_proxy_request_fulluri') ?: getenv('http_proxy_request_fulluri'), ]; + + if(!empty($proxyUrl['user']) && !empty($proxyUrl['pass'])) { + $proxyUser = urldecode($proxyUrl['user']).':'.urldecode($proxyUrl['pass']); + $auth = base64_encode($proxyUser); + + $context['http']['header'] = "Proxy-Authorization: Basic $auth"; + } } return stream_context_create($context, [ From 33c0933a57b07404f25beb4ee7396714adc39693 Mon Sep 17 00:00:00 2001 From: Marcel Berteler Date: Mon, 28 Nov 2022 08:18:09 +0200 Subject: [PATCH 2/2] Update CKEditorInstaller.php --- src/Installer/CKEditorInstaller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Installer/CKEditorInstaller.php b/src/Installer/CKEditorInstaller.php index c99c0328..13072a13 100644 --- a/src/Installer/CKEditorInstaller.php +++ b/src/Installer/CKEditorInstaller.php @@ -220,7 +220,7 @@ private function createStreamContext(callable $notifier = null) getenv('http_proxy_request_fulluri'), ]; - if(!empty($proxyUrl['user']) && !empty($proxyUrl['pass'])) { + if (!empty($proxyUrl['user']) && !empty($proxyUrl['pass'])) { $proxyUser = urldecode($proxyUrl['user']).':'.urldecode($proxyUrl['pass']); $auth = base64_encode($proxyUser);