From 5ed130b5752753ca80e924f6a0218a9d7ab20793 Mon Sep 17 00:00:00 2001 From: Jaydn Cunningham Date: Wed, 23 Nov 2022 12:32:33 +1030 Subject: [PATCH] MDL-76370 curl: suppress CONNECT header when using HTTP proxy --- lib/filelib.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/filelib.php b/lib/filelib.php index 902f820d5d7..cda5d2b2e2a 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -3182,7 +3182,14 @@ class curl { $this->proxy_type = CURLPROXY_SOCKS5; } else { $this->proxy_type = CURLPROXY_HTTP; - $this->setopt(array('httpproxytunnel'=>false)); + $this->setopt([ + 'httpproxytunnel' => false, + ]); + if (defined('CURLOPT_SUPPRESS_CONNECT_HEADERS')) { + $this->setopt([ + 'suppress_connect_headers' => true, + ]); + } } $this->setopt(array('proxytype'=>$this->proxy_type)); }