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

configurable curl options (avoid http_code 0) #109

Closed
tobiasbambullis opened this issue Jul 31, 2020 · 1 comment
Closed

configurable curl options (avoid http_code 0) #109

tobiasbambullis opened this issue Jul 31, 2020 · 1 comment

Comments

@tobiasbambullis
Copy link
Contributor

tobiasbambullis commented Jul 31, 2020

hey,

great plugin! One small thing we had to change. In our productive system we got a http_code = 0 when calling $client->push().

So we changed Client.php to this:

`private function prepareHandle(Notification $notification)
{
$request = new Request($notification, $this->isProductionEnv);
$ch = curl_init();

$this->authProvider->authenticateClient($request);

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt_array($ch, $request->getOptions());
curl_setopt($ch, CURLOPT_HTTPHEADER, $request->getDecoratedHeaders());

// store device token to identify response
curl_setopt($ch, CURLOPT_PRIVATE, $notification->getDeviceToken());

return $ch;

}`

It would be a better solution if "Client" has a method like "setOptions" where you can set all curl options to do it!

@pnlarsson
Copy link

# curl https://api.push.apple.com
curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: https://curl.haxx.se/docs/sslcerts.html

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=962596

Debian removed GeoTrust cert that Apple CA was signed with (kind of).

This solved it for me:

wget --no-check-certificate -c https://www.geotrust.com/resources/root_certificates/certificates/GeoTrust_Global_CA.pem   \
    && mkdir /usr/local/share/ca-certificates/extra                                                                       \
    && mv GeoTrust_Global_CA.pem /usr/local/share/ca-certificates/extra/GeoTrust_Global_CA.crt                            \
    && update-ca-certificates

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

No branches or pull requests

3 participants