|
|
@ -72,22 +72,25 @@ func (h timeHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
// Verify if date headers are set, if not reject the request
|
|
|
|
// Verify if date headers are set, if not reject the request
|
|
|
|
if r.Header.Get("x-amz-date") == "" && r.Header.Get("Date") == "" { |
|
|
|
|
|
|
|
// there is no way to knowing if this is a valid request, could be a attack reject such clients
|
|
|
|
if r.Header.Get("Authorization") != "" { |
|
|
|
writeErrorResponse(w, r, RequestTimeTooSkewed, acceptsContentType, r.URL.Path) |
|
|
|
if r.Header.Get("x-amz-date") == "" && r.Header.Get("Date") == "" { |
|
|
|
return |
|
|
|
// there is no way to knowing if this is a valid request, could be a attack reject such clients
|
|
|
|
} |
|
|
|
writeErrorResponse(w, r, RequestTimeTooSkewed, acceptsContentType, r.URL.Path) |
|
|
|
date, err := getDate(r) |
|
|
|
return |
|
|
|
if err != nil { |
|
|
|
} |
|
|
|
// there is no way to knowing if this is a valid request, could be a attack reject such clients
|
|
|
|
date, err := getDate(r) |
|
|
|
writeErrorResponse(w, r, RequestTimeTooSkewed, acceptsContentType, r.URL.Path) |
|
|
|
if err != nil { |
|
|
|
return |
|
|
|
// there is no way to knowing if this is a valid request, could be a attack reject such clients
|
|
|
|
} |
|
|
|
writeErrorResponse(w, r, RequestTimeTooSkewed, acceptsContentType, r.URL.Path) |
|
|
|
duration := time.Since(date) |
|
|
|
return |
|
|
|
minutes := time.Duration(5) * time.Minute |
|
|
|
} |
|
|
|
if duration.Minutes() > minutes.Minutes() { |
|
|
|
duration := time.Since(date) |
|
|
|
writeErrorResponse(w, r, RequestTimeTooSkewed, acceptsContentType, r.URL.Path) |
|
|
|
minutes := time.Duration(5) * time.Minute |
|
|
|
return |
|
|
|
if duration.Minutes() > minutes.Minutes() { |
|
|
|
|
|
|
|
writeErrorResponse(w, r, RequestTimeTooSkewed, acceptsContentType, r.URL.Path) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
h.handler.ServeHTTP(w, r) |
|
|
|
h.handler.ServeHTTP(w, r) |
|
|
|
} |
|
|
|
} |
|
|
|