mirror of
https://github.com/minio/minio.git
synced 2025-11-10 05:59:43 -05:00
Signature-V4: Dump the request with error message on signature mismatch. (#2734)
fixes #2691
This commit is contained in:
committed by
Harshavardhana
parent
725df557b5
commit
a955676986
19
cmd/utils.go
19
cmd/utils.go
@@ -32,6 +32,8 @@ import (
|
||||
"sync"
|
||||
"syscall"
|
||||
|
||||
"encoding/json"
|
||||
|
||||
"github.com/pkg/profile"
|
||||
)
|
||||
|
||||
@@ -327,3 +329,20 @@ func startMonitorShutdownSignal(onExitFn onExitFunc) error {
|
||||
// Successfully started routine.
|
||||
return nil
|
||||
}
|
||||
|
||||
// dump the request into a string in JSON format.
|
||||
func dumpRequest(r *http.Request) string {
|
||||
header := cloneHeader(r.Header)
|
||||
header.Set("Host", r.Host)
|
||||
req := struct {
|
||||
Method string `json:"method"`
|
||||
Path string `json:"path"`
|
||||
Query string `json:"query"`
|
||||
Header http.Header `json:"header"`
|
||||
}{r.Method, r.URL.Path, r.URL.RawQuery, header}
|
||||
jsonBytes, err := json.Marshal(req)
|
||||
if err != nil {
|
||||
return "<error dumping request>"
|
||||
}
|
||||
return string(jsonBytes)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user