Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Łukasz Nowak
caddy
Commits
1d47e590
Commit
1d47e590
authored
Nov 17, 2015
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
proxy: Make headers when upstream is created; avoid potential nil ptr deref
parent
280ba9db
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
11 deletions
+6
-11
middleware/proxy/upstream.go
middleware/proxy/upstream.go
+6
-11
No files found.
middleware/proxy/upstream.go
View file @
1d47e590
...
...
@@ -40,11 +40,12 @@ func NewStaticUpstreams(c parse.Dispenser) ([]Upstream, error) {
var
upstreams
[]
Upstream
for
c
.
Next
()
{
upstream
:=
&
staticUpstream
{
from
:
""
,
Hosts
:
nil
,
Policy
:
&
Random
{},
FailTimeout
:
10
*
time
.
Second
,
MaxFails
:
1
,
from
:
""
,
proxyHeaders
:
make
(
http
.
Header
),
Hosts
:
nil
,
Policy
:
&
Random
{},
FailTimeout
:
10
*
time
.
Second
,
MaxFails
:
1
,
}
if
!
c
.
Args
(
&
upstream
.
from
)
{
...
...
@@ -159,14 +160,8 @@ func parseBlock(c *parse.Dispenser, u *staticUpstream) error {
if
!
c
.
Args
(
&
header
,
&
value
)
{
return
c
.
ArgErr
()
}
if
u
.
proxyHeaders
==
nil
{
u
.
proxyHeaders
=
make
(
http
.
Header
)
}
u
.
proxyHeaders
.
Add
(
header
,
value
)
case
"websocket"
:
if
u
.
proxyHeaders
==
nil
{
u
.
proxyHeaders
=
make
(
http
.
Header
)
}
u
.
proxyHeaders
.
Add
(
"Connection"
,
"{>Connection}"
)
u
.
proxyHeaders
.
Add
(
"Upgrade"
,
"{>Upgrade}"
)
case
"without"
:
...
...
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