Merge branch 'develop' of gitee.com:fusenpack/fusenapi into develop
This commit is contained in:
commit
ca645368aa
|
@ -81,9 +81,10 @@ type wsConnectItem struct {
|
|||
// 请求建立连接,升级websocket协议
|
||||
func (l *DataTransferLogic) DataTransfer(w http.ResponseWriter, r *http.Request) {
|
||||
//把子协议携带的token设置到标准token头信息中
|
||||
r.Header.Set("Authorization", "Bearer "+r.Header.Get("Sec-Websocket-Protocol"))
|
||||
token := r.Header.Get("Sec-Websocket-Protocol")
|
||||
r.Header.Set("Authorization", "Bearer "+token)
|
||||
//设置Sec-Websocket-Protocol
|
||||
upgrade.Subprotocols = []string{r.Header.Get("Sec-Websocket-Protocol")}
|
||||
upgrade.Subprotocols = []string{token}
|
||||
//升级websocket
|
||||
conn, err := upgrade.Upgrade(w, r, nil)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue
Block a user