Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Snowflake WebExtension
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
The Tor Project
Anti-censorship
Pluggable Transports
Snowflake WebExtension
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
No related tags found
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