From 8df3db566a3a937b45ebf11adb90d265e6f5e2d4 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sun, 17 Nov 2019 20:45:02 +0100 Subject: initial checking of customized version 1.0rc9 --- .../Parser/Message/AbstractMessageParser.php | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 vendor/guzzle/guzzle/src/Guzzle/Parser/Message/AbstractMessageParser.php (limited to 'vendor/guzzle/guzzle/src/Guzzle/Parser/Message/AbstractMessageParser.php') diff --git a/vendor/guzzle/guzzle/src/Guzzle/Parser/Message/AbstractMessageParser.php b/vendor/guzzle/guzzle/src/Guzzle/Parser/Message/AbstractMessageParser.php new file mode 100644 index 0000000..d25f9cc --- /dev/null +++ b/vendor/guzzle/guzzle/src/Guzzle/Parser/Message/AbstractMessageParser.php @@ -0,0 +1,58 @@ + $requestUrl, + 'scheme' => 'http' + ); + + // Check for the Host header + if (isset($parts['headers']['Host'])) { + $urlParts['host'] = $parts['headers']['Host']; + } elseif (isset($parts['headers']['host'])) { + $urlParts['host'] = $parts['headers']['host']; + } else { + $urlParts['host'] = null; + } + + if (false === strpos($urlParts['host'], ':')) { + $urlParts['port'] = ''; + } else { + $hostParts = explode(':', $urlParts['host']); + $urlParts['host'] = trim($hostParts[0]); + $urlParts['port'] = (int) trim($hostParts[1]); + if ($urlParts['port'] == 443) { + $urlParts['scheme'] = 'https'; + } + } + + // Check if a query is present + $path = $urlParts['path']; + $qpos = strpos($path, '?'); + if ($qpos) { + $urlParts['query'] = substr($path, $qpos + 1); + $urlParts['path'] = substr($path, 0, $qpos); + } else { + $urlParts['query'] = ''; + } + + return $urlParts; + } +} -- cgit v1.2.3-54-g00ecf