agent: Enforce PUT for session destroy. Fixes #285.

This commit is contained in:
Armon Dadgar 2014-08-19 10:53:25 -07:00
parent de89031c1a
commit ee614ace35
1 changed files with 6 additions and 0 deletions

View File

@ -103,6 +103,12 @@ func FixupLockDelay(raw interface{}) error {
// SessionDestroy is used to destroy an existing session // SessionDestroy is used to destroy an existing session
func (s *HTTPServer) SessionDestroy(resp http.ResponseWriter, req *http.Request) (interface{}, error) { func (s *HTTPServer) SessionDestroy(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
// Mandate a PUT request
if req.Method != "PUT" {
resp.WriteHeader(405)
return nil, nil
}
args := structs.SessionRequest{ args := structs.SessionRequest{
Op: structs.SessionDestroy, Op: structs.SessionDestroy,
} }