mirror of https://github.com/golang/go.git
websocket: use URL.RawPath to construct WebSocket-Location: header
R=rsc CC=golang-dev https://golang.org/cl/651041
This commit is contained in:
parent
71e402d8ff
commit
f15447ca3e
|
|
@ -66,7 +66,7 @@ func (f Handler) ServeHTTP(c *http.Conn, req *http.Request) {
|
|||
return
|
||||
}
|
||||
defer rwc.Close()
|
||||
location := "ws://" + req.Host + req.URL.Path
|
||||
location := "ws://" + req.Host + req.URL.RawPath
|
||||
|
||||
// TODO(ukai): verify origin,location,protocol.
|
||||
|
||||
|
|
|
|||
|
|
@ -60,6 +60,23 @@ func TestEcho(t *testing.T) {
|
|||
ws.Close()
|
||||
}
|
||||
|
||||
func TestWithQuery(t *testing.T) {
|
||||
once.Do(startServer)
|
||||
|
||||
client, err := net.Dial("tcp", "", serverAddr)
|
||||
if err != nil {
|
||||
t.Fatal("dialing", err)
|
||||
}
|
||||
|
||||
ws, err := newClient("/echo?q=v", "localhost", "http://localhost",
|
||||
"ws://localhost/echo?q=v", "", client)
|
||||
if err != nil {
|
||||
t.Errorf("WebSocket handshake error", err)
|
||||
return
|
||||
}
|
||||
ws.Close()
|
||||
}
|
||||
|
||||
func TestHTTP(t *testing.T) {
|
||||
once.Do(startServer)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue