Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Snowflake
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Analyze
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
trinity-1686a
Snowflake
Commits
5b01df90
Commit
5b01df90
authored
5 years ago
by
David Fifield
Browse files
Options
Downloads
Patches
Plain Diff
Initialize the global upgrader.CheckOrigin statically.
Only once, not again on every call to initServer.
parent
a4287095
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
server/server.go
+3
-3
3 additions, 3 deletions
server/server.go
with
3 additions
and
3 deletions
server/server.go
+
3
−
3
View file @
5b01df90
...
...
@@ -94,7 +94,9 @@ func clientAddr(clientIPParam string) string {
return
(
&
net
.
TCPAddr
{
IP
:
clientIP
,
Port
:
1
,
Zone
:
""
})
.
String
()
}
var
upgrader
=
websocket
.
Upgrader
{}
var
upgrader
=
websocket
.
Upgrader
{
CheckOrigin
:
func
(
r
*
http
.
Request
)
bool
{
return
true
},
}
type
HTTPHandler
struct
{}
...
...
@@ -139,8 +141,6 @@ func initServer(addr *net.TCPAddr,
return
nil
,
fmt
.
Errorf
(
"cannot listen on port %d; configure a port using ServerTransportListenAddr"
,
addr
.
Port
)
}
upgrader
.
CheckOrigin
=
func
(
r
*
http
.
Request
)
bool
{
return
true
}
var
handler
HTTPHandler
server
:=
&
http
.
Server
{
Addr
:
addr
.
String
(),
...
...
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