尝试建立与推送服务器的连接时,HTTP2框架层中的Curl错误

时间:2018-09-11 08:06:22

标签: curl libcurl

我有一个客户端-服务器项目,其中客户端和服务器通过HTTP2协议相互通信。我选择此协议是因为我想使用http2的推送功能。我可以在Google Chrome中接收推送的文件,但是当我尝试使用curl获取相同的URI时,会收到一些错误。 这是我的错误详细信息:

curl: (16) Error in the HTTP2 framing layer

这是Google chrome浏览器生成的curl命令,我用来接收来自服务器的推送:

curl 'https://sonicserver1.com:8681/Servlet4Push/sonicServer' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36' -H 'X-DevTools-Emulate-Network-Conditions-Client-Id: BC49F4CB52D05528532E99BA9E109453' --compressed --insecure

我应该提到我知道curl命令行不支持推入数据检索,但是我认为它不会产生此错误。因为当我在服务器本身中运行此命令时,它什么也不显示,也没有错误。

换一种说法,我尝试libcurl本身来接收推送数据。根据此处记录的serverpush示例: libcurl serverpush example 并用my server URI替换localhost URI 仍然,我收到一些框架错误:

Info: http2 error: Remote peer returned unexpected data while we expected SETTINGS frame.  Perhaps, peer does not support HTTP/2 properly.

以下是libcurl serverpush范例日志的完整日志:

== Info:   Trying 185.112.34.186...
== Info: TCP_NODELAY set
== Info: Connected to sonicserver1.com (185.112.34.186) port 8681 (#0)
== Info: ALPN, offering h2
== Info: ALPN, offering http/1.1
== Info: Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
== Info: successfully set certificate verify locations:
== Info:   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
== Info: TLSv1.2 (OUT), TLS header, Certificate Status (22):
=> Send SSL data, 5 bytes (0x5)
0000: .....
== Info: TLSv1.2 (OUT), TLS handshake, Client hello (1):
=> Send SSL data, 512 bytes (0x200)
0000: ......BG.../...c...:TQ.~..2....U..sr......0.,.(.$.............k.
0040: j.i.h.9.8.7.6.........2...*.&.......=.5.../.+.'.#.............g.
0080: @.?.>.3.2.1.0.........E.D.C.B.1.-.).%.......<./...A.....G.......
00c0: ..sonicserver1.com........................................... ..
0100: ...................................3t.........h2.http/1.1.......
0140: ................................................................
0180: ................................................................
01c0: ................................................................
<= Recv SSL data, 5 bytes (0x5)
0000: ....&
== Info: TLSv1.2 (IN), TLS handshake, Server hello (2):
<= Recv SSL data, 90 bytes (0x5a)
0000: ...V..[...).<...(...z..>f..L..}.U6...G [........dG....<.l4.&.;Z.
0040: .Gy...?./...............h2
== Info: TLSv1.2 (IN), TLS handshake, Certificate (11):
<= Recv SSL data, 891 bytes (0x37b)
0000: ...w..t..q0..m0..U.......YM.J0...*.H........0g1.0...U....Unknown
0040: 1.0...U....Unknown1.0...U....Unknown1.0...U....rv1.0...U....Unkn
0080: own1.0...U....Unknown0...180725084132Z..190725084132Z0g1.0...U..
00c0: ..Unknown1.0...U....Unknown1.0...U....Unknown1.0...U....rv1.0...
0100: U....Unknown1.0...U....Unknown0.."0...*.H.............0.........
0140: ..}..v$Hq.5...?I.O.*....J6v...'........'..d....8.RZ.^....s.H.b..
0180: ,.Q.A..6gQ..W.7.q]..&.].=...b...b.. .B>/...Q.)..yX.U@..M.%.h.k.s
01c0: .H..&.U.|..|o/.iQ...DN.0...W....XX....m\.>.I2.5..../.'.:.......+
0200: p.........X@E...f.(=...).|.7...<r..1.......H...s......T.o.8/..9.
0240: .....!0.0...U......d|.JN.Hb...NA|....|X0...*.H.................2
0280: A...1..j..G.R..n..r.n..Ie..=..*........A........./8.M"..V..(|.@.
02c0: Sh..w.~?..0..,......`yt6.|.*....v7..$b.i?mu.u{.A.E..(K......j...
0300: <.....q.U..{.{...).#B..4....>6...(.sQ].>..m.W..Z...&.....B....`.
0340: 5.?.2m.N.-.N...5...1.w.ItIEm......Q!.k.iW1.W.....:.....7...
== Info: TLSv1.2 (IN), TLS handshake, Server key exchange (12):
<= Recv SSL data, 333 bytes (0x14d)
0000: ...I...A.j)Mb4..s.&..>.yE_7..F..9d.t..1..|.U.,N...\i..*Z.']Po.L.
0040: @m..9..y.....N.W..h"..11..h...&@.A.CoB......c/.....;.;2..j.4yD.n
0080: 3...Y~.2.D .$....[...2.........E\f.....@g4........i04?.~Fok.u P.
00c0: .h..Q......c.P<.L.....>.n.._V.}w.R.M...m1..O...H.@)....}......._
0100: ].8...AZ....kN.._}..?F.rU.@#I.+...4q...o...ax.Y.....x=.x|.v....\
0140: `T...~gW..sI.
== Info: TLSv1.2 (IN), TLS handshake, Server finished (14):
<= Recv SSL data, 4 bytes (0x4)
0000: ....
=> Send SSL data, 5 bytes (0x5)
0000: ....F
== Info: TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
=> Send SSL data, 70 bytes (0x46)
0000: ...BA...fB...+=f..1.......0....:..d........F....0...zv.OGs>.]...
0040: ..M>*L
=> Send SSL data, 5 bytes (0x5)
0000: .....
== Info: TLSv1.2 (OUT), TLS change cipher, Client hello (1):
=> Send SSL data, 1 bytes (0x1)
0000: .
=> Send SSL data, 5 bytes (0x5)
0000: ....(
== Info: TLSv1.2 (OUT), TLS handshake, Finished (20):
=> Send SSL data, 16 bytes (0x10)
0000: ........U.\k..:.
<= Recv SSL data, 5 bytes (0x5)
0000: .....
== Info: TLSv1.2 (IN), TLS change cipher, Client hello (1):
<= Recv SSL data, 1 bytes (0x1)
0000: .
<= Recv SSL data, 5 bytes (0x5)
0000: ....(
== Info: TLSv1.2 (IN), TLS handshake, Finished (20):
<= Recv SSL data, 16 bytes (0x10)
0000: .......7_.5.....
== Info: SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
== Info: ALPN, server accepted to use h2
== Info: Server certificate:
== Info:  subject: C=Unknown; ST=Unknown; L=Unknown; O=rv; OU=Unknown; CN=Unknown
== Info:  start date: Jul 25 08:41:32 2018 GMT
== Info:  expire date: Jul 25 08:41:32 2019 GMT
== Info:  issuer: C=Unknown; ST=Unknown; L=Unknown; O=rv; OU=Unknown; CN=Unknown
== Info:  SSL certificate verify result: self signed certificate (18), continuing anyway.
== Info: Using HTTP2, server supports multi-use
== Info: Connection state changed (HTTP/2 confirmed)
== Info: Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
=> Send SSL data, 5 bytes (0x5)
0000: ....0
=> Send SSL data, 5 bytes (0x5)
0000: ....-
=> Send SSL data, 5 bytes (0x5)
0000: ....%
== Info: Using Stream ID: 1 (easy handle 0x3345c0)
=> Send SSL data, 5 bytes (0x5)
0000: ....N
=> Send header, 84 bytes (0x54)
0000: GET /Servlet4Push/sonicServer HTTP/1.1
0028: Host: sonicserver1.com:8681
0045: Accept: */*
0052:
<= Recv SSL data, 5 bytes (0x5)
0000: .....
== Info: http2 error: Remote peer returned unexpected data while we expected SETTINGS frame.  Perhaps, peer does not support HTTP/2 properly.
=> Send SSL data, 5 bytes (0x5)
0000: ....:
== Info: Curl_http_done: called premature == 1
== Info: Closing connection 0
=> Send SSL data, 5 bytes (0x5)
0000: .....
== Info: TLSv1.2 (OUT), TLS alert, Client hello (1):
=> Send SSL data, 2 bytes (0x2)
0000: 

0 个答案:

没有答案