add Upgrade Response status code check to begin/abort websocket client
This commit is contained in:
parent
5fcdc9ca70
commit
3c5d45ee21
|
@ -76,6 +76,12 @@ func (s *Server) Launch() error {
|
|||
upgrader, err := upgrader.Upgrade(sock)
|
||||
if err != nil {
|
||||
fmt.Printf(" - upgrade error: %s\n", err)
|
||||
sock.Close()
|
||||
continue
|
||||
}
|
||||
if upgrader.Response.GetStatusCode() != 101 {
|
||||
fmt.Printf(" - upgrade bad request\n")
|
||||
sock.Close()
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue