-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Allow to set CURLOPT_FORBID_REUSE when constructing http curl client #40482
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
Comments
As allowed by #38026? |
Oh, I read to fast your description. Still, this extra entry is the way IMHO. |
You could use an HttpClientFactory service to achieve what you describe - this would effectively prevent connections from being reused, by creating a new client instance when needed. |
I checked the construction source code before but did not find explicit use of I did not find any |
There is none, that would be yours to create :)
That'd be strange, I don't know how this can happen, knowing the code. Closing as solved then. |
Ah, ok, I get what you mean. I have a factory service. Anyway, it's different problem, different code. Thanks ;) |
Description
Currently,
CurlHttpClient
has a set of allowed options that can be passed on construction and then they're converted to curl opts internally.However, the
CURLOPT_FORBID_REUSE
is not mapped to any option and therefore it's impossible to use when relying on PSR interfaces.Symfony
request()
method allows to pass options through 3rd arg viaextra.curl
but I don't want to use that option nor interface as it exposes implementation details.I'm making http requests to devices that has unreliably implemented HTTP. Therefore it is required to force TCP connection to close in order to enforce some stability. And that's done using
CURLOPT_FORBID_REUSE
.Example
Would it make sense to add
forbid_reuse: true|false
option that can be passed intonew CurlHttpClient(['forbid_reuse': false])
? I don't see any other way to do so.The text was updated successfully, but these errors were encountered: