Skip to content
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

Adding curl-options #14

Closed
knallcharge opened this issue Nov 21, 2022 · 4 comments
Closed

Adding curl-options #14

knallcharge opened this issue Nov 21, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@knallcharge
Copy link

knallcharge commented Nov 21, 2022

Hi,
is there a way to add curl-options when instantiating the Translator?
I need to include verify_peer: false and verify_host: false, otherwise I'll get a "SSL certificate error: unable to get local issuer certificate"-exception.

I have tried
$translator = new \DeepL\Translator('KEY', ['headers' => ['verify_peer' => false, 'verify_host' => false]]);
but that doesn't work (same with "0" instead of "false" for both options).
I see the options getting added to $curlOptions in HttpClient (line 182), but they don't seem to do anything.

Thanks

@daniel-jones-deepl
Copy link
Member

Hi @knallcharge, thanks for creating this issue. No, currently the library does not allow configuring the cURL options.

There might be a better way to resolve your problem, by fixing your SSL certificate set up, as described in the StackOverflow answers here. Disabling SSL verification exposes you to security vulnerabilities, so it is best avoided.

That said, yes we can add this functionality in future.

@daniel-jones-deepl daniel-jones-deepl added the enhancement New feature or request label Dec 2, 2022
@knallcharge
Copy link
Author

Hi @daniel-jones-deepl
thanks for getting back! I'm aware of the security issues this causes, but unfortunately my setup is in a company network where I can't resolve the certificate as described in the post you mentioned (tried all that) as a special security software intercepts https-traffic to check it before re-encrypting it with its own certificate. So I could live with the security issues as this is only for development, on the prod-servers we have a different setup and the library works as expected.
So if this could be added some time, I'd be glad.

@JanEbbing
Copy link
Member

Hi @knallcharge , does the new feature to specify a custom HTTP client accomodate your use case? Im afraid to specify cURL options you will need to use a PSR-18 wrapper for cURL, but with that it should work. I provided an example how to use the new option in the README.

@knallcharge
Copy link
Author

Hi @JanEbbing, thanks for the hint. Just tried it (using Symfony's Psr18Client) and it works! I'll still have to do some tests in a different environment, but this should be resolved. Thanks again, closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants