Skip to content

Commit a16eb6c

Browse files
committed
chore: always execute parse_url in preventLocalAddress
This change should make it easier to spot wrong uses of the HTTP client on development setups where allow_local_remote_servers is usually true. Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
1 parent bb25602 commit a16eb6c

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

lib/private/Http/Client/Client.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,15 @@ private function isLocalAddressAllowed(array $options) : bool {
158158
}
159159

160160
protected function preventLocalAddress(string $uri, array $options): void {
161-
if ($this->isLocalAddressAllowed($options)) {
162-
return;
163-
}
164-
165161
$host = parse_url($uri, PHP_URL_HOST);
166162
if ($host === false || $host === null) {
167163
throw new LocalServerException('Could not detect any host');
168164
}
165+
166+
if ($this->isLocalAddressAllowed($options)) {
167+
return;
168+
}
169+
169170
if (!$this->remoteHostValidator->isValid($host)) {
170171
throw new LocalServerException('Host "' . $host . '" violates local access rules');
171172
}

0 commit comments

Comments
 (0)