Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a8f8d60

Browse filesBrowse files
committed
Merge branch '6.4' into 7.1
* 6.4: Fix Twig deprecation notice [DependencyInjection] Fix issue between decorator and service locator index [AssetMapper] Fix JsDeliver import regexp do not overwrite the host to request
2 parents 9525d24 + 4c92046 commit a8f8d60
Copy full SHA for a8f8d60

File tree

Expand file treeCollapse file tree

2 files changed

+20
-4
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+20
-4
lines changed

‎CurlHttpClient.php

Copy file name to clipboardExpand all lines: CurlHttpClient.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,10 @@ public function request(string $method, string $url, array $options = []): Respo
188188
$multi->reset();
189189
}
190190

191-
foreach ($options['resolve'] as $host => $ip) {
192-
$resolve[] = null === $ip ? "-$host:$port" : "$host:$port:$ip";
193-
$multi->dnsCache->hostnames[$host] = $ip;
194-
$multi->dnsCache->removals["-$host:$port"] = "-$host:$port";
191+
foreach ($options['resolve'] as $resolveHost => $ip) {
192+
$resolve[] = null === $ip ? "-$resolveHost:$port" : "$resolveHost:$port:$ip";
193+
$multi->dnsCache->hostnames[$resolveHost] = $ip;
194+
$multi->dnsCache->removals["-$resolveHost:$port"] = "-$resolveHost:$port";
195195
}
196196

197197
$curlopts[\CURLOPT_RESOLVE] = $resolve;

‎Tests/CurlHttpClientTest.php

Copy file name to clipboardExpand all lines: Tests/CurlHttpClientTest.php
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,20 @@ public function testOverridingInternalAttributesUsingCurlOptions()
122122
],
123123
]);
124124
}
125+
126+
public function testKeepAuthorizationHeaderOnRedirectToSameHostWithConfiguredHostToIpAddressMapping()
127+
{
128+
$httpClient = $this->getHttpClient(__FUNCTION__);
129+
$response = $httpClient->request('POST', 'http://127.0.0.1:8057/301', [
130+
'headers' => [
131+
'Authorization' => 'Basic Zm9vOmJhcg==',
132+
],
133+
'resolve' => [
134+
'symfony.com' => '10.10.10.10',
135+
],
136+
]);
137+
138+
$this->assertSame(200, $response->getStatusCode());
139+
$this->assertSame('/302', $response->toArray()['REQUEST_URI'] ?? null);
140+
}
125141
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.