3 questions about annotations, naming, and protocols
guowei-gong opened this issue · 4 comments
-
due/network/ws/server.go 中,为什么除了 GET 请求会被升级,其余的都会抛出 405 的错误?
通常 HTTP GET 请求是获取资源的请求,也就是只读请求,但是 Websocket 是双向通信协议呀。
-
ws 和 tcp 的 server_conn_mgr.go 中的结构体 connMgr(ws/server_conn_mgr.go)和 serverConnMgr 结构体(tcp/server_conn_mgr.go)是否可以统一命名?
-
due/network/ws/client_conn.go 中的 clientConn 结构体中的 conn 字段注解有误。
我想确认 2 和 3 是否修改后,会让 Due 变得更好(或者这样做是否对)?得到答复后,我很乐意修改它们并提交 pr。
期待你的回复 :-)
问题1:
rfc6455
Once a connection to the server has been established (including a
connection via a proxy or over a TLS-encrypted tunnel), the client
MUST send an opening handshake to the server. The handshake consists
of an HTTP Upgrade request, along with a list of required and
optional header fields. The requirements for this handshake are as
follows.
-
The handshake MUST be a valid HTTP request as specified by
[RFC2616]. -
The method of the request MUST be GET, and the HTTP version MUST
be at least 1.1.For example, if the WebSocket URI is "ws://example.com/chat",
the first line sent should be "GET /chat HTTP/1.1". -
The "Request-URI" part of the request MUST match the /resource
name/ defined in Section 3 (a relative URI) or be an absolute
http/https URI that, when parsed, has a /resource name/, /host/,
and /port/ that match the corresponding ws/wss URI. -
The request MUST contain a |Host| header field whose value
contains /host/ plus optionally ":" followed by /port/ (when not
using the default port). -
The request MUST contain an |Upgrade| header field whose value
MUST include the "websocket" keyword.
问题2和问题3已在v2-feature-main分支中进行了修改
感谢您的反馈
感谢您的反馈
感谢您的答复!同时感谢您提供了这么好的框架,让我学习