mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 15:23:51 +00:00
Bug 1356524
- Only add Authorization header when sending requests to the tooltool url. r=gps
We're going to potentially use the same download manager for tooltool and taskcluster artifacts, and we don't want to send the tooltool authentication header to the taskcluster requests. --HG-- extra : rebase_source : 79a0afdbf06cb05d7792f413ab1f6715b2a9fe2e
This commit is contained in:
parent
81cd3ec73b
commit
29eb575e7e
@ -1565,6 +1565,7 @@ class PackageFrontend(MachCommandBase):
|
||||
open_manifest,
|
||||
unpack_file,
|
||||
)
|
||||
from requests.adapters import HTTPAdapter
|
||||
import redo
|
||||
import requests
|
||||
import shutil
|
||||
@ -1594,8 +1595,16 @@ class PackageFrontend(MachCommandBase):
|
||||
if authentication_file:
|
||||
with open(authentication_file, 'rb') as f:
|
||||
token = f.read().strip()
|
||||
cache._download_manager.session.headers['Authorization'] = \
|
||||
'Bearer {}'.format(token)
|
||||
|
||||
class TooltoolAuthenticator(HTTPAdapter):
|
||||
def send(self, request, *args, **kwargs):
|
||||
request.headers['Authorization'] = \
|
||||
'Bearer {}'.format(token)
|
||||
return super(TooltoolAuthenticator, self).send(
|
||||
request, *args, **kwargs)
|
||||
|
||||
cache._download_manager.session.mount(
|
||||
tooltool_url, TooltoolAuthenticator())
|
||||
|
||||
manifest = open_manifest(tooltool_manifest)
|
||||
downloaded_files = {}
|
||||
|
Loading…
Reference in New Issue
Block a user