mirror of
https://github.com/pgsty/minio.git
synced 2026-07-24 14:36:15 +03:00
handlers: Ignore malformatted datetime type header (#4097)
Ignore headers, such as If-Modified-Since, If-Unmodified-Since, etc.. when they are received with a format other than HTTP date.
This commit is contained in:
committed by
Harshavardhana
parent
4448285a83
commit
e4bd882f11
@@ -1342,6 +1342,19 @@ func (s *TestSuiteCommon) TestHeadOnObjectLastModified(c *C) {
|
||||
response, err = client.Do(request)
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(response.StatusCode, Equals, http.StatusPreconditionFailed)
|
||||
|
||||
// make HTTP request to obtain object info.
|
||||
// But this time set a date with unrecognized format to the "If-Modified-Since" header
|
||||
request, err = newTestSignedRequest("HEAD", getHeadObjectURL(s.endPoint, bucketName, objectName),
|
||||
0, nil, s.accessKey, s.secretKey, s.signer)
|
||||
c.Assert(err, IsNil)
|
||||
request.Header.Set("If-Unmodified-Since", "Mon, 02 Jan 2006 15:04:05 +00:00")
|
||||
response, err = client.Do(request)
|
||||
c.Assert(err, IsNil)
|
||||
// Since the "If-Modified-Since" header was ahead in time compared to the actual
|
||||
// modified time of the object expecting the response status to be http.StatusNotModified.
|
||||
c.Assert(response.StatusCode, Equals, http.StatusOK)
|
||||
|
||||
}
|
||||
|
||||
// TestHeadOnBucket - Validates response for HEAD on the bucket.
|
||||
|
||||
Reference in New Issue
Block a user