summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Salmon <will.salmon@codethink.co.uk>2020-05-05 15:26:27 +0100
committerWilliam Salmon <will.salmon@codethink.co.uk>2020-05-05 16:00:21 +0100
commit81e5ce707a919f2e0b4f8be5d8b1a44f2a5e355b (patch)
treeb43e564d1773306ed8f1e07a5f839056209e3d21
parent023e63b1623783e6e8f8bd7e09119d75606ffd93 (diff)
downloadbuildstream-81e5ce707a919f2e0b4f8be5d8b1a44f2a5e355b.tar.gz
_downloadablefilesource.py: Set user agent
The default user-agnet for urllib is widely used for many bots and so is blocked by many servers. Buy using our own then we we are not blocked by gitlab.com etc and are also able to identify buildstream request to servers.
-rw-r--r--src/buildstream/plugins/sources/_downloadablefilesource.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/buildstream/plugins/sources/_downloadablefilesource.py b/src/buildstream/plugins/sources/_downloadablefilesource.py
index ad8fe9f22..fcdd005ac 100644
--- a/src/buildstream/plugins/sources/_downloadablefilesource.py
+++ b/src/buildstream/plugins/sources/_downloadablefilesource.py
@@ -163,6 +163,7 @@ class DownloadableFileSource(Source):
default_name = os.path.basename(self.url)
request = urllib.request.Request(self.url)
request.add_header("Accept", "*/*")
+ request.add_header("User-Agent", "BuildStream/2")
# We do not use etag in case what we have in cache is
# not matching ref in order to be able to recover from