PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
← All changes | vendor_prefixed/guzzlehttp/guzzle/src/Client.php +21 -1 28.2 → trunk View file →
@@ -139,9 +139,9 @@
139 139 public function sendAsync(\YoastSEO_Vendor\Psr\Http\Message\RequestInterface $request, array $options = []) : \YoastSEO_Vendor\GuzzleHttp\Promise\PromiseInterface
140 140 {
141 141 // Merge the base URI into the request URI if needed.
142 142 $options = $this->prepareDefaults($options);
143 - return $this->transfer($request->withUri($this->buildUri($request->getUri(), $options), $request->hasHeader('Host')), $options);
143 + return $this->transfer($request->withUri($this->buildUri($request->getUri(), $options), self::shouldPreserveHost($request)), $options);
144 144 }
145 145 /**
146 146 * Send an HTTP request.
147 147 *
@@ -256,8 +256,28 @@
256 256 if ($uri->getScheme() === '' && $uri->getHost() !== '') {
257 257 $uri = $uri->withScheme('http');
258 258 }
259 259 return $uri;
260 + }
261 + /**
262 + * Whether to preserve an existing Host header when the URI changes.
263 + *
264 + * A header matching the current URI carries no explicit override and is
265 + * regenerated after base URI resolution or IDN conversion. Other values
266 + * are preserved as deliberate overrides, as PSR-7 requires.
267 + */
268 + private static function shouldPreserveHost(\YoastSEO_Vendor\Psr\Http\Message\RequestInterface $request) : bool
269 + {
270 + if (!$request->hasHeader('Host')) {
271 + return \false;
272 + }
273 + $uri = $request->getUri();
274 + $host = $uri->getHost();
275 + $port = $uri->getPort();
276 + if ($port !== null) {
277 + $host .= ':' . $port;
278 + }
279 + return $host !== $request->getHeaderLine('Host');
260 280 }
261 281 /**
262 282 * Configures the default options for a client.
263 283 */