From 52eecb556c0096f0f331b52a0ee818951af576c8 Mon Sep 17 00:00:00 2001 From: Gleb Schukin Date: Wed, 11 May 2016 15:06:08 +0300 Subject: [PATCH 1/2] Handle rare case when ceph doesn't return Last-Modified for HEAD requests in case DLO manifest doesn't have any segments Signed-off-by: Gleb Schukin --- vendor/github.com/ncw/swift/swift.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/vendor/github.com/ncw/swift/swift.go b/vendor/github.com/ncw/swift/swift.go index 290f73a7..e5be4ebc 100644 --- a/vendor/github.com/ncw/swift/swift.go +++ b/vendor/github.com/ncw/swift/swift.go @@ -1737,9 +1737,11 @@ func (c *Connection) Object(container string, objectName string) (info Object, h return } } - info.ServerLastModified = resp.Header.Get("Last-Modified") - if info.LastModified, err = time.Parse(http.TimeFormat, info.ServerLastModified); err != nil { - return + if resp.Header.Get("Last-Modified") != "" { + info.ServerLastModified = resp.Header.Get("Last-Modified") + if info.LastModified, err = time.Parse(http.TimeFormat, info.ServerLastModified); err != nil { + return + } } info.Hash = resp.Header.Get("Etag") return From 5d7600e3cada81e26b01aa0e2713c3aef517bcdc Mon Sep 17 00:00:00 2001 From: Gleb Schukin Date: Wed, 11 May 2016 15:06:08 +0300 Subject: [PATCH 2/2] Handle rare case when ceph doesn't return Last-Modified for HEAD requests in case DLO manifest doesn't have any segments Signed-off-by: Gleb Schukin --- vendor/github.com/ncw/swift/swift.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vendor/github.com/ncw/swift/swift.go b/vendor/github.com/ncw/swift/swift.go index e5be4ebc..1ad8fcc1 100644 --- a/vendor/github.com/ncw/swift/swift.go +++ b/vendor/github.com/ncw/swift/swift.go @@ -1737,6 +1737,9 @@ func (c *Connection) Object(container string, objectName string) (info Object, h return } } + //HACK + //Currently ceph doestn't return Last-Modified header for DLO manifest without any segments + //Currently it affects all versions of ceph http://tracker.ceph.com/issues/15812 if resp.Header.Get("Last-Modified") != "" { info.ServerLastModified = resp.Header.Get("Last-Modified") if info.LastModified, err = time.Parse(http.TimeFormat, info.ServerLastModified); err != nil {