good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
websocket
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
websocket
Commits
449143ba
Unverified
Commit
449143ba
authored
5 years ago
by
Anmol Sethi
Committed by
GitHub
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #177 from nhooyr/handshake-fixes
Improve handshake to better match RFC
parents
cb50d970
b11e4ec6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
handshake.go
+7
-2
7 additions, 2 deletions
handshake.go
with
7 additions
and
2 deletions
handshake.go
+
7
−
2
View file @
449143ba
...
...
@@ -55,14 +55,18 @@ func verifyClientRequest(w http.ResponseWriter, r *http.Request) error {
}
if
!
headerValuesContainsToken
(
r
.
Header
,
"Connection"
,
"Upgrade"
)
{
w
.
Header
()
.
Set
(
"Connection"
,
"Upgrade"
)
w
.
Header
()
.
Set
(
"Upgrade"
,
"websocket"
)
err
:=
fmt
.
Errorf
(
"websocket protocol violation: Connection header %q does not contain Upgrade"
,
r
.
Header
.
Get
(
"Connection"
))
http
.
Error
(
w
,
err
.
Error
(),
http
.
Status
B
adRequ
est
)
http
.
Error
(
w
,
err
.
Error
(),
http
.
Status
Upgr
ad
e
Requ
ired
)
return
err
}
if
!
headerValuesContainsToken
(
r
.
Header
,
"Upgrade"
,
"WebSocket"
)
{
w
.
Header
()
.
Set
(
"Connection"
,
"Upgrade"
)
w
.
Header
()
.
Set
(
"Upgrade"
,
"websocket"
)
err
:=
fmt
.
Errorf
(
"websocket protocol violation: Upgrade header %q does not contain websocket"
,
r
.
Header
.
Get
(
"Upgrade"
))
http
.
Error
(
w
,
err
.
Error
(),
http
.
Status
B
adRequ
est
)
http
.
Error
(
w
,
err
.
Error
(),
http
.
Status
Upgr
ad
e
Requ
ired
)
return
err
}
...
...
@@ -73,6 +77,7 @@ func verifyClientRequest(w http.ResponseWriter, r *http.Request) error {
}
if
r
.
Header
.
Get
(
"Sec-WebSocket-Version"
)
!=
"13"
{
w
.
Header
()
.
Set
(
"Sec-WebSocket-Version"
,
"13"
)
err
:=
fmt
.
Errorf
(
"unsupported websocket protocol version (only 13 is supported): %q"
,
r
.
Header
.
Get
(
"Sec-WebSocket-Version"
))
http
.
Error
(
w
,
err
.
Error
(),
http
.
StatusBadRequest
)
return
err
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment