Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

231
Views
Conexión a APNS de Apple usando cURL con soporte HTTP\2 a través de nghttp2

Intenté compilar cURL con soporte HTTP/2 siguiendo este tutorial . Estoy usando Docker y mi aplicación se basa en la imagen oficial de PHP Docker , que usa Debian, aunque he producido los mismos problemas en una máquina Ubuntu que se ejecuta dentro de una máquina virtual Vagrant .

Al principio parece que no hay problema. De hecho, ejecutar curl --version muestra todo lo que esperaría:

 curl 7.47.1 (x86_64-pc-linux-gnu) libcurl/7.47.1 OpenSSL/1.0.1k zlib/1.2.8 libidn/1.29 libssh2/1.4.3 nghttp2/1.7.1 librtmp/2.3 Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp Features: IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets

Además, puedo conectarme a https://nghttp2.org muy bien:

 curl --http2 -I https://nghttp2.org HTTP/2.0 200 date:Mon, 15 Feb 2016 18:02:34 GMT content-type:text/html content-length:6680 last-modified:Thu, 11 Feb 2016 14:29:49 GMT etag:"56bc9add-1a18" link:</stylesheets/screen.css>; rel=preload; as=stylesheet accept-ranges:bytes x-backend-header-rtt:0.000581 server:nghttpx nghttp2/1.8.0-DEV via:1.1 nghttpx strict-transport-security:max-age=31536000 x-frame-options:SAMEORIGIN x-xss-protection:1; mode=block x-content-type-options:nosniff

Los problemas comienzan al intentar conectarse a la API del proveedor APNS recientemente relanzada de Apple, que ahora se ejecuta en HTTP/2.

Instalé curl a través de Homebrew en mi Mac (usando --with-nghttp2 ) y puedo obtener la siguiente respuesta (esperada):

 curl -d 'Hello' --http2 https://api.push.apple.com/3/device/test {"reason":"Forbidden"}

Sin embargo, si trato de ejecutar el mismo comando desde mi imagen de Docker, obtengo:

 curl -d 'Hello' --http2 https://api.push.apple.com/3/device/test ?@@?HTTP/2 client preface string missing or corrupt. Hex dump for received bytes: 504f5354202f332f6465766963652f746573742048545450

No estoy seguro de por qué estos problemas parecen ser específicos del servicio de Apple y qué se debe hacer para remediar la situación.

¡Cualquier ayuda sería muy apreciada!

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Para cualquiera que vea esto en el futuro, terminé resolviéndolo, y la respuesta está en Server Fault .

over 4 years ago · Santiago Trujillo Report

0

El problema aquí es que OpenSSL/1.0.1k no viene con el protocolo ALPN.

Apple lo requiere, mientras que https://nghttp2.org está contento con NPN.

Entonces, para resolver esto, haga que OpenSSL/1.0.2 funcione y ya está todo listo.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!