Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
f15447ca
Commit
f15447ca
authored
Mar 19, 2010
by
Fumitoshi Ukai
Committed by
Russ Cox
Mar 19, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
websocket: use URL.RawPath to construct WebSocket-Location: header
R=rsc CC=golang-dev
https://golang.org/cl/651041
parent
71e402d8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletion
+18
-1
server.go
src/pkg/websocket/server.go
+1
-1
websocket_test.go
src/pkg/websocket/websocket_test.go
+17
-0
No files found.
src/pkg/websocket/server.go
View file @
f15447ca
...
...
@@ -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
.
Raw
Path
// TODO(ukai): verify origin,location,protocol.
...
...
src/pkg/websocket/websocket_test.go
View file @
f15447ca
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment