Golang: http2和TLS握手错误

huangapple go评论106阅读模式
英文:

Golang: http2 and TLS handshake errors

问题

我有一个Go应用程序,同时启用了http(端口80)和https(端口443)。

我一直收到这三种错误的大量报告:

  • http2: server: error reading preface from client 79.49.31.60:37993: timeout waiting for client preface

  • http: TLS handshake error from 151.38.29.250:44235: EOF

  • http: TLS handshake error from 2.239.197.163:6742: read tcp x.xxx.xxx.xxx:443->2.239.197.163:6742: i/o timeout

有人能解释一下这些错误是什么意思吗?

请注意:所有这些请求都来自移动浏览器(Android和iOS设备)。

英文:

I have a Go application with both http (on port 80) and https (on port 443) enabled.

I keep getting lots of these 3 kinds of error:

  • http2: server: error reading preface from client 79.49.31.60:37993: timeout waiting for client preface

  • http: TLS handshake error from 151.38.29.250:44235: EOF

  • http: TLS handshake error from 2.239.197.163:6742: read tcp x.xxx.xxx.xxx:443->2.239.197.163:6742: i/o timeout

can anyone explain what these refer to?

Note that: all these requests are coming from mobile browsers (on Android and iOS devices)

答案1

得分: 13

http2: server: error reading preface from client 79.49.31.60:37993: timeout waiting for client preface

这意味着客户端在服务器超时之前未能发送http2连接前缀(https://www.rfc-editor.org/rfc/rfc7540#section-3.5)。

http: TLS handshake error from 151.38.29.250:44235: EOF
这意味着在服务器和客户端执行TLS握手时,服务器看到连接被关闭,即EOF。

http: TLS handshake error from 2.239.197.163:6742: read tcp x.xxx.xxx.xxx:443->2.239.197.163:6742: i/o timeout
这意味着在服务器等待从客户端读取数据的过程中,客户端在关闭连接之前没有发送任何数据。

正如@JimB指出的,这些情况是完全正常的。如果您认为超时时间过短,您可以通过定义自定义的net.http.Transport来定义自定义超时时间:https://golang.org/pkg/net/http/#Transport,并为超时设置更长的值。

英文:
http2: server: error reading preface from client 79.49.31.60:37993: timeout waiting for client preface

This means that the client failed to send the http2 connection preface (https://www.rfc-editor.org/rfc/rfc7540#section-3.5) before the server timed out.

http: TLS handshake error from 151.38.29.250:44235: EOF

This means that while the server and the client were performing the TLS handshake, the server saw the connection being closed, aka EOF.

http: TLS handshake error from 2.239.197.163:6742: read tcp x.xxx.xxx.xxx:443->2.239.197.163:6742: i/o timeout

This means that while the server was waiting to read from the client during the TLS handshake, the client didn't send anything before closing the connection.

As @JimB pointed out, those are perfectly normal to see. If you think the timeouts are kicking in too soon, you can define custom ones by defining a custom net.http.Transport: https://golang.org/pkg/net/http/#Transport, and set higher values for timeouts.

huangapple
  • 本文由 发表于 2016年9月17日 21:37:29
  • 转载请务必保留本文链接:https://go.coder-hub.com/39547459.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定