使用cURL连接到苹果的APNS,通过nghttp2支持HTTP\2 [英] Connecting to Apple's APNS using cURL with HTTP\2 support via nghttp2

查看:732
本文介绍了使用cURL连接到苹果的APNS,通过nghttp2支持HTTP\2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试通过以下本教程。我正在使用 Docker ,我的应用程序基于官方PHP Docker图像,它使用Debian,尽管我在一个运行在 Vagrant VM。

I've attempted to compile cURL with HTTP/2 support by following this tutorial. I'm using Docker and my application is based off the official PHP Docker image, which uses Debian, although I've produced the same problems in an Ubuntu machine running inside a Vagrant VM.

起初似乎没有问题。确实,运行 curl --version 显示了我期望的一切:

There appears to be no problem at first. Indeed, running curl --version shows everything I'd expect:

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 

此外,我可以连接到 https:// nghttp2.org 很好:

Also, I can connect to https://nghttp2.org just fine:

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

连接到苹果最近重新启动的=nofollow> =nofollow>

The problems begin when trying to connect to Apple's recently re-launched APNS Provider API which now runs on HTTP/2.

我已经通过Homebrew安装了Mac(使用 - with-nghttp2 ),我可以得到以下(预期)响应:

I've installed curl via Homebrew on my Mac (using --with-nghttp2) and I can get the following (expected) response:

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

但是,如果我尝试从Docker映像中运行相同的命令,我会得到:

However, if I try to run the same command from within my Docker image, I get:

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

我不知道为什么这个问题似乎是苹果的服务,以及需要做些什么来补救这种情况。

I'm unsure why this problems seems to be specific to Apple's service, and what needs to be done to remedy the situation.

任何帮助将大大 赞赏

推荐答案

对于以后看到这个的人,我最终解决了这个问题,答案是在服务器故障

For anyone seeing this in the future, I ended up solving this, and the answer is on Server Fault.

这篇关于使用cURL连接到苹果的APNS,通过nghttp2支持HTTP\2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆