Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Vault
Commits
6c9d585f
Unverified
Commit
6c9d585f
authored
5 years ago
by
Calvin Leung Huang
Committed by
GitHub
5 years ago
Browse files
Options
Download
Email Patches
Plain Diff
http: ensure return after writing response by respondError (#8796)
parent
f21f9d33
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
command/agent/cache/handler.go
+1
-0
command/agent/cache/handler.go
http/logical.go
+2
-0
http/logical.go
http/sys_metrics.go
+1
-0
http/sys_metrics.go
http/sys_raft.go
+1
-0
http/sys_raft.go
with
5 additions
and
0 deletions
+5
-0
command/agent/cache/handler.go
+
1
-
0
View file @
6c9d585f
...
...
@@ -40,6 +40,7 @@ func Handler(ctx context.Context, logger hclog.Logger, proxier Proxier, inmemSin
if
err
!=
nil
{
logger
.
Error
(
"failed to read request body"
)
logical
.
RespondError
(
w
,
http
.
StatusInternalServerError
,
errors
.
New
(
"failed to read request body"
))
return
}
if
r
.
Body
!=
nil
{
r
.
Body
.
Close
()
...
...
This diff is collapsed.
Click to expand it.
http/logical.go
+
2
-
0
View file @
6c9d585f
...
...
@@ -232,6 +232,7 @@ func handleLogicalRecovery(raw *vault.RawBackend, token *atomic.String) http.Han
reqToken
:=
r
.
Header
.
Get
(
consts
.
AuthHeaderName
)
if
reqToken
==
""
||
token
.
Load
()
==
""
||
reqToken
!=
token
.
Load
()
{
respondError
(
w
,
http
.
StatusForbidden
,
nil
)
return
}
resp
,
err
:=
raw
.
HandleRequest
(
r
.
Context
(),
req
)
...
...
@@ -379,6 +380,7 @@ func handleLogicalInternal(core *vault.Core, injectDataIntoTopLevel bool, noForw
case
strings
.
HasPrefix
(
req
.
Path
,
"sys/metrics"
)
:
if
isStandby
,
_
:=
core
.
Standby
();
isStandby
{
respondError
(
w
,
http
.
StatusBadRequest
,
vault
.
ErrCannotForwardLocalOnly
)
return
}
}
...
...
This diff is collapsed.
Click to expand it.
http/sys_metrics.go
+
1
-
0
View file @
6c9d585f
...
...
@@ -17,6 +17,7 @@ func handleMetricsUnauthenticated(core *vault.Core) http.Handler {
case
"GET"
:
default
:
respondError
(
w
,
http
.
StatusMethodNotAllowed
,
nil
)
return
}
// Parse form
...
...
This diff is collapsed.
Click to expand it.
http/sys_raft.go
+
1
-
0
View file @
6c9d585f
...
...
@@ -33,6 +33,7 @@ func handleSysRaftJoinPost(core *vault.Core, w http.ResponseWriter, r *http.Requ
if
req
.
NonVoter
&&
!
nonVotersAllowed
{
respondError
(
w
,
http
.
StatusBadRequest
,
errors
.
New
(
"non-voting nodes not allowed"
))
return
}
var
tlsConfig
*
tls
.
Config
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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
Menu
Projects
Groups
Snippets
Help