Skip to content


Browse files Browse the repository at this point in the history
[lib] Change boto2 to not override the User Agent if already present
This enables to reuse the boto HttpRequest client with Raz signed URLs.
The Raz URLs are signed and the User Agent is part of the signature,
so this one should not be changed.
  • Loading branch information
romainr committed Jun 4, 2021
1 parent 6bf8397 commit 49a0354
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion desktop/core/ext-py/boto-2.46.1/boto/
Expand Up @@ -372,7 +372,8 @@ def authorize(self, connection, **kwargs):
self.headers[key] = quote(val.encode('utf-8'), safe)
setattr(self, '_headers_quoted', True)

self.headers['User-Agent'] = UserAgent
if not self.headers('User-Agent'):
self.headers['User-Agent'] = UserAgent

connection._auth_handler.add_auth(self, **kwargs)

Expand Down
7 changes: 4 additions & 3 deletions desktop/core/ext-py/boto-2.46.1/boto/s3/
Expand Up @@ -890,9 +890,10 @@ def sender(http_conn, method, path, data, headers):
headers = headers.copy()
# Overwrite user-supplied user-agent.
for header in find_matching_headers('User-Agent', headers):
del headers[header]
headers['User-Agent'] = UserAgent
#for header in find_matching_headers('User-Agent', headers):
# del headers[header]
if not headers.get('User-Agent'):
headers['User-Agent'] = UserAgent
# If storage_class is None, then a user has not explicitly requested
# a storage class, so we can assume STANDARD here
if self._storage_class not in [None, 'STANDARD']:
Expand Down

0 comments on commit 49a0354

Please sign in to comment.