Verify if request date is 5minutes late, reject such a request as

it could be a possible replay attack.

This commit also fixes #505, by returning MethodNotAllowed instead of NotImplemented
This commit is contained in:
Harshavardhana
2015-04-27 03:54:49 -07:00
parent 1531802b73
commit ade803a923
5 changed files with 73 additions and 16 deletions
+8 -1
View File
@@ -51,6 +51,7 @@ const (
InvalidBucketName
InvalidDigest
InvalidRange
InvalidRequest
MalformedXML
MissingContentLength
MissingRequestBodyError
@@ -61,11 +62,12 @@ const (
RequestTimeTooSkewed
SignatureDoesNotMatch
TooManyBuckets
MethodNotAllowed
)
// Error codes, non exhaustive list - standard HTTP errors
const (
NotAcceptable = iota + 21
NotAcceptable = iota + 23
)
// Error code to Error structure map
@@ -175,6 +177,11 @@ var errorCodeResponse = map[int]Error{
Description: "You have attempted to create more buckets than allowed.",
HTTPStatusCode: http.StatusBadRequest,
},
MethodNotAllowed: {
Code: "MethodNotAllowed",
Description: "The specified method is not allowed against this resource.",
HTTPStatusCode: http.StatusMethodNotAllowed,
},
NotAcceptable: {
Code: "NotAcceptable",
Description: "The requested resource is only capable of generating content not acceptable according to the Accept headers sent in the request.",