Apple push notification curl: (16) Error in the HTTP2 framing layer
Asked Answered
C

1

16

i do run this command on ubuntu terminal

curl --verbose -H 'apns-topic: Skios.TripBruCACT' --header "Content-Type: application/json" --data '{"aps":{"content-available":1,"alert":"hi","sound":"default"}}' --cert /home/mohamed/Downloads/Prod2.pem:a1B23 --http2 'https://api.push.apple.com/3/device/19297dba97212ac6fd16b9cd50f2d86629aed0e49576b2b52ed05086087da802'

but it return curl: (16) Error in the HTTP2 framing layer

Here are the whole result

*   Trying 17.188.145.163...
* Connected to api.push.apple.com (17.188.145.163) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt CApath: none
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Request CERT (13):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Certificate (11):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS handshake, CERT verify (15):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use h2
* Server certificate:
*  subject: CN=api.push.apple.com; OU=management:idms.group.533599; O=Apple Inc.; ST=California; C=US
*  start date: Aug 28 19:03:46 2015 GMT
*  expire date: Sep 26 19:03:46 2017 GMT
*  subjectAltName: host "api.push.apple.com" matched cert's "api.push.apple.com"
*  issuer: CN=Apple IST CA 2 - G1; OU=Certification Authority; O=Apple Inc.; C=US
*  SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* TCP_NODELAY set
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0xdb69a0)
> POST /3/device/19297dba97212ac6fd16b9cd50f2d86629aed0e49576b2b52ed05086087da802 HTTP/1.1
> Host: api.push.apple.com
> User-Agent: curl/7.50.0
> Accept: */*
> apns-topic: Skios.TripBruCACT
> Content-Type: application/json
> Content-Length: 62
> 
* Connection state changed (MAX_CONCURRENT_STREAMS updated)!
* We are completely uploaded and fine
* Closing connection 0
* TLSv1.2 (OUT), TLS alert, Client hello (1):
curl: (16) Error in the HTTP2 framing layer

but i got in last line this error

curl: (16) Error in the HTTP2 framing layer

Cesena answered 9/9, 2016 at 11:50 Comment(2)
Why is the end of the "POST" line showing HTTP/1.1? And the log shows 'Using HTTP2', will this be a problem? Maybe you didn't set up the right http version?Wadleigh
I strongly suspect you experience what might've been a bug in that old version of curl. If I try a modern version against that URL now, it seems to work...Vainglory
P
-1

I understand that you are trying to test the push notification by using your .pem file. Please try the following steps.

Instead of giving the certificate path, change the directory of the terminal to the folder which your .pem file contains.

then, run the following command,

For Development APNS:

curl -d '{"aps":{"alert":"hi","sound":"default"}}' --cert yourpem.pem: -H "apns-topic: yourbundleID" --http2 https://api.development.push.apple.com/3/device/yourdevicetoken

For Production APNS:

curl -d '{"aps":{"alert":"hi","sound":"default"}}' --cert yourpem.pem: -H "apns-topic: yourbundleID" --http2 https://api.push.apple.com/3/device/yourdevicetoken

Palanquin answered 12/2, 2020 at 7:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.