Skip to content

[HttpClient] Allow to provide additional curl options to CurlHttpClient #38026

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 10, 2020
Merged

[HttpClient] Allow to provide additional curl options to CurlHttpClient #38026

merged 1 commit into from
Sep 10, 2020

Conversation

pizzaminded
Copy link
Contributor

@pizzaminded pizzaminded commented Sep 1, 2020

Q A
Branch? master
Bug fix? no
New feature? yes
Deprecations? no
Tickets Fix #37798
License MIT
Doc PR symfony/symfony-docs#14195

Tagging as a draft because:

  • there is no Doc PR Ready yet
  • probably there are better test cases required here.

This PR introduces an option to override default curl options defined in CurlHttpClient. To override them, there is a special place in $options provided:

$response = $httpClient->request('GET', 'http://your.url.here', [
            'extra' => [
                'curl' => [
                    CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4,
                ]
            ]
        ]);

This feature is available only in CurlHttpClient and would be ignored in another clients.

@pizzaminded pizzaminded changed the title [HttpClient] Allow to override curl options [HttpClient] Allow to provide additional curl options to CurlHttpClient Sep 2, 2020
@pizzaminded
Copy link
Contributor Author

Rebased and introduced some checks before options merge.

@nicolas-grekas nicolas-grekas added this to the next milestone Sep 3, 2020
@nicolas-grekas
Copy link
Member

Thank you @pizzaminded.

@nicolas-grekas nicolas-grekas merged commit 0ceafbc into symfony:master Sep 10, 2020
@pizzaminded pizzaminded deleted the http-client-curly-extras branch September 10, 2020 11:06
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull request Sep 12, 2020
…ent section (pizzaminded)

This PR was squashed before being merged into the master branch.

Discussion
----------

[HttpClient] Providing additional options to CurlHttpClient section

Documentation for symfony/symfony#38026 PR.

Commits
-------

729c7df [HttpClient] Providing additional options to CurlHttpClient section
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

httpClient doesn't allow to change the curl_setopt options
4 participants