mirror of
https://github.com/hashicorp/vault.git
synced 2026-06-11 09:51:16 -04:00
http: pass raw request through
This commit is contained in:
parent
92dadc4dca
commit
273da85e85
4 changed files with 8 additions and 8 deletions
|
|
@ -63,10 +63,10 @@ func parseRequest(r *http.Request, out interface{}) error {
|
|||
|
||||
// request is a helper to perform a request and properly exit in the
|
||||
// case of an error.
|
||||
func request(core *vault.Core, w http.ResponseWriter, reqURL *url.URL, r *logical.Request) (*logical.Response, bool) {
|
||||
func request(core *vault.Core, w http.ResponseWriter, rawReq *http.Request, r *logical.Request) (*logical.Response, bool) {
|
||||
resp, err := core.HandleRequest(r)
|
||||
if err == vault.ErrStandby {
|
||||
respondStandby(core, w, reqURL)
|
||||
respondStandby(core, w, rawReq.URL)
|
||||
return resp, false
|
||||
}
|
||||
if respondCommon(w, resp) {
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ func handleLogical(core *vault.Core) http.Handler {
|
|||
// Make the internal request. We attach the connection info
|
||||
// as well in case this is an authentication request that requires
|
||||
// it. Vault core handles stripping this if we need to.
|
||||
resp, ok := request(core, w, r.URL, requestAuth(r, &logical.Request{
|
||||
resp, ok := request(core, w, r, requestAuth(r, &logical.Request{
|
||||
Operation: op,
|
||||
Path: path,
|
||||
Data: req,
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ func handleSysRenew(core *vault.Core) http.Handler {
|
|||
}
|
||||
}
|
||||
|
||||
resp, ok := request(core, w, r.URL, requestAuth(r, &logical.Request{
|
||||
resp, ok := request(core, w, r, requestAuth(r, &logical.Request{
|
||||
Operation: logical.WriteOperation,
|
||||
Path: "sys/renew/" + path,
|
||||
Data: map[string]interface{}{
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ func handleSysListPolicies(core *vault.Core) http.Handler {
|
|||
return
|
||||
}
|
||||
|
||||
resp, ok := request(core, w, r.URL, requestAuth(r, &logical.Request{
|
||||
resp, ok := request(core, w, r, requestAuth(r, &logical.Request{
|
||||
Operation: logical.ReadOperation,
|
||||
Path: "sys/policy",
|
||||
}))
|
||||
|
|
@ -64,7 +64,7 @@ func handleSysDeletePolicy(core *vault.Core, w http.ResponseWriter, r *http.Requ
|
|||
return
|
||||
}
|
||||
|
||||
_, ok := request(core, w, r.URL, requestAuth(r, &logical.Request{
|
||||
_, ok := request(core, w, r, requestAuth(r, &logical.Request{
|
||||
Operation: logical.DeleteOperation,
|
||||
Path: "sys/policy/" + path,
|
||||
}))
|
||||
|
|
@ -88,7 +88,7 @@ func handleSysReadPolicy(core *vault.Core, w http.ResponseWriter, r *http.Reques
|
|||
return
|
||||
}
|
||||
|
||||
resp, ok := request(core, w, r.URL, requestAuth(r, &logical.Request{
|
||||
resp, ok := request(core, w, r, requestAuth(r, &logical.Request{
|
||||
Operation: logical.ReadOperation,
|
||||
Path: "sys/policy/" + path,
|
||||
}))
|
||||
|
|
@ -119,7 +119,7 @@ func handleSysWritePolicy(core *vault.Core, w http.ResponseWriter, r *http.Reque
|
|||
return
|
||||
}
|
||||
|
||||
_, ok := request(core, w, r.URL, requestAuth(r, &logical.Request{
|
||||
_, ok := request(core, w, r, requestAuth(r, &logical.Request{
|
||||
Operation: logical.WriteOperation,
|
||||
Path: "sys/policy/" + path,
|
||||
Data: map[string]interface{}{
|
||||
|
|
|
|||
Loading…
Reference in a new issue