mirror of
https://github.com/nadoo/glider.git
synced 2026-11-19 07:09:42 +08:00
ws: fixed bug in ws codes and now it worked
This commit is contained in:
1 parent
9856f943ad
commit
ff1fb8c291
6 files changed
+61
-56
No files matched your search
+8
-1
@@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
"net"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/nadoo/glider/common/log"
|
||||
"github.com/nadoo/glider/proxy"
|
||||
@@ -31,7 +32,13 @@ func NewWS(s string, dialer proxy.Dialer) (*WS, error) {
|
||||
|
||||
addr := u.Host
|
||||
|
||||
client, err := NewClient()
|
||||
colonPos := strings.LastIndex(addr, ":")
|
||||
if colonPos == -1 {
|
||||
colonPos = len(addr)
|
||||
}
|
||||
serverName := addr[:colonPos]
|
||||
|
||||
client, err := NewClient(serverName, u.Path)
|
||||
if err != nil {
|
||||
log.F("create ws client err: %s", err)
|
||||
return nil, err
|
||||
|
||||
Reference in new issue
Block a user