Commit f15447ca authored by Fumitoshi Ukai's avatar Fumitoshi Ukai Committed by Russ Cox

websocket: use URL.RawPath to construct WebSocket-Location: header

R=rsc
CC=golang-dev
https://golang.org/cl/651041
parent 71e402d8
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment