From bcbe5fdcf01db35502c7785350b66d0eaad91d7a Mon Sep 17 00:00:00 2001 From: kicaj Date: Fri, 11 Jan 2019 13:20:09 +0100 Subject: [PATCH] Fix #12885 --- lib/Cake/Network/Http/HttpSocket.php | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/lib/Cake/Network/Http/HttpSocket.php b/lib/Cake/Network/Http/HttpSocket.php index afe03cdae..2e62badae 100644 --- a/lib/Cake/Network/Http/HttpSocket.php +++ b/lib/Cake/Network/Http/HttpSocket.php @@ -452,15 +452,13 @@ class HttpSocket extends CakeSocket { * @return false|HttpSocketResponse Result of request, either false on failure or the response to the request. */ public function get($uri = null, $query = array(), $request = array()) { - if (!empty($query)) { - $uri = $this->_parseUri($uri, $this->config['request']['uri']); - if (isset($uri['query'])) { - $uri['query'] = array_merge($uri['query'], $query); - } else { - $uri['query'] = $query; - } - $uri = $this->_buildUri($uri); + $uri = $this->_parseUri($uri, $this->config['request']['uri']); + if (isset($uri['query'])) { + $uri['query'] = array_merge($uri['query'], $query); + } else { + $uri['query'] = $query; } + $uri = $this->_buildUri($uri); $request = Hash::merge(array('method' => 'GET', 'uri' => $uri), $request); return $this->request($request); @@ -478,15 +476,13 @@ class HttpSocket extends CakeSocket { * @return false|HttpSocketResponse Result of request, either false on failure or the response to the request. */ public function head($uri = null, $query = array(), $request = array()) { - if (!empty($query)) { - $uri = $this->_parseUri($uri, $this->config['request']['uri']); - if (isset($uri['query'])) { - $uri['query'] = array_merge($uri['query'], $query); - } else { - $uri['query'] = $query; - } - $uri = $this->_buildUri($uri); + $uri = $this->_parseUri($uri, $this->config['request']['uri']); + if (isset($uri['query'])) { + $uri['query'] = array_merge($uri['query'], $query); + } else { + $uri['query'] = $query; } + $uri = $this->_buildUri($uri); $request = Hash::merge(array('method' => 'HEAD', 'uri' => $uri), $request); return $this->request($request);