Skip to content

[httpClient] NO_PROXY option is ignored in NativeHttpClient::request() method  #33832

Closed
@Harry-Dunne

Description

@Harry-Dunne

Symfony version(s) affected: 4.3.4

Description
Overriding HTTP Proxy settings in $options argument passed to NativeHttpClient::request() method works for "proxy" option but doesn't work for "no_proxy" option.

How to reproduce

Call the NativeHttpClient::request() method with options overriding your proxy settings in environment variables:

$client = HttpClient::create();
$client->request('GET', 'http://my-host.com/', [
    'no_proxy' => 'my-host',
]);

Possible Solution

I think that the bug lies in this line:

https://github.com/symfony/http-client/blob/92ceb25f8c850d4ec8bce9234c8001c5b32d8387/NativeHttpClient.php#L224

Possible fix:

$noProxy = $options['no_proxy'] ?? $_SERVER['no_proxy'] ?? $_SERVER['NO_PROXY'] ?? '';

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions