diff options
author | Abderrahim Kitouni <a.kitouni@gmail.com> | 2020-03-24 09:59:29 +0000 |
---|---|---|
committer | Abderrahim Kitouni <a.kitouni@gmail.com> | 2020-03-24 09:59:29 +0000 |
commit | aec9deb3b7cd759ee35751b2e27fb54f7966b0b2 (patch) | |
tree | 107d1eae3a2c98ce1c6525f95761018965e80239 | |
parent | 341940a1bf1a83e7d5c8b422fdfe8baa12a1fd70 (diff) | |
parent | 605b5fbcf50ca1c22c5ed3cbe5446b39fd784589 (diff) | |
download | buildstream-aec9deb3b7cd759ee35751b2e27fb54f7966b0b2.tar.gz |
Merge branch 'abderrahim/etag' into 'master'
_downloadablefilesource.py: don't download the file if etag matches
See merge request BuildStream/buildstream!1833
-rw-r--r-- | src/buildstream/plugins/sources/_downloadablefilesource.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/buildstream/plugins/sources/_downloadablefilesource.py b/src/buildstream/plugins/sources/_downloadablefilesource.py index 50f8561fb..ad8fe9f22 100644 --- a/src/buildstream/plugins/sources/_downloadablefilesource.py +++ b/src/buildstream/plugins/sources/_downloadablefilesource.py @@ -178,7 +178,11 @@ class DownloadableFileSource(Source): with contextlib.closing(opener.open(request)) as response: info = response.info() - etag = info["ETag"] if "ETag" in info else None + # some servers don't honor the 'If-None-Match' header + if self.ref and etag and info["ETag"] == etag: + return self.ref + + etag = info["ETag"] filename = info.get_filename(default_name) filename = os.path.basename(filename) |