参与人数: 10 人
Go 标准包阅读
Go 版本:go 1.10.1
- server.go
- Next Protocol Negotiation = NPN
- Expect 100 Continue support
见参考资料
- header提到了:Expect和host
- 判断了 header里面的HOST,但是后面又删除,为什么?
server.go#L980
delete(req.Header, "Host")
- 判断是否支持 HTTP2 (isH2Upgrade)
// isH2Upgrade reports whether r represents the http2 "client preface"
// magic string.
func (r *Request) isH2Upgrade() bool {
return r.Method == "PRI" && len(r.Header) == 0 && r.URL.Path == "*" && r.Proto == "HTTP/2.0"
}
调用:ProtoAtLeast(1, 1)
...
// ProtoAtLeast reports whether the HTTP protocol used
// in the request is at least major.minor.
func (r *Request) ProtoAtLeast(major, minor int) bool {
return r.ProtoMajor > major ||
r.ProtoMajor == major && r.ProtoMinor >= minor
}
待补充。。。