Add feature flag to force all direct download URLs to be proxied

Fixes #1667
This commit is contained in:
Joseph Schorr 2016-08-24 12:55:33 -04:00
parent 2b00c644b5
commit dd2e086a20
12 changed files with 350 additions and 34 deletions

View file

@ -28,7 +28,7 @@ from initdb import wipe_database, initialize_database, populate_database
from endpoints.csrf import generate_csrf_token
from tempfile import NamedTemporaryFile
from jsonschema import validate as validate_schema
from util.security.registry_jwt import decode_bearer_token
from util.security.registry_jwt import decode_bearer_header
import endpoints.decorated
import json
@ -1543,7 +1543,7 @@ class TorrentTestMixin(V2RegistryPullMixin):
contents = bencode.bdecode(torrent)
# Ensure that there is a webseed.
self.assertEquals(contents['url-list'], 'http://somefakeurl')
self.assertEquals(contents['url-list'], 'http://somefakeurl?goes=here')
# Ensure there is an announce and some pieces.
self.assertIsNotNone(contents.get('info', {}).get('pieces'))
@ -1887,7 +1887,7 @@ class SquashingTests(RegistryTestCaseMixin, V1RegistryPushMixin, LiveServerTestC
contents = bencode.bdecode(response.content)
# Ensure that there is a webseed.
self.assertEquals(contents['url-list'], 'http://somefakeurl')
self.assertEquals(contents['url-list'], 'http://somefakeurl?goes=here')
# Ensure there is an announce and some pieces.
self.assertIsNotNone(contents.get('info', {}).get('pieces'))
@ -1956,9 +1956,9 @@ class V2LoginTests(V2RegistryLoginMixin, LoginTests, RegistryTestCaseMixin, Base
# Validate the returned token.
encoded = response.json()['token']
token = 'Bearer ' + encoded
header = 'Bearer ' + encoded
payload = decode_bearer_token(token, instance_keys)
payload = decode_bearer_header(header, instance_keys)
self.assertIsNotNone(payload)
if scope is None: