Allow unsetting of X-Container-Sync-To header.

Fixes bug 1071790.

Change-Id: Ic0509190b9994e7d983bcf20daa64a650cc974cb
This commit is contained in:
Samuel Merritt 2012-10-26 10:11:22 -07:00
parent 0a03bd06a3
commit 40f46e245c
2 changed files with 4 additions and 1 deletions

View File

@ -1306,6 +1306,8 @@ def urlparse(url):
def validate_sync_to(value, allowed_sync_hosts):
if not value:
return None
p = urlparse(value)
if p.scheme not in ('http', 'https'):
return _('Invalid scheme %r in X-Container-Sync-To, must be "http" '

View File

@ -880,7 +880,8 @@ log_name = %(yarr)s'''
for goodurl in ('http://1.1.1.1/v1/a/c/o',
'http://1.1.1.1:8080/a/c/o',
'http://2.2.2.2/a/c/o',
'https://1.1.1.1/v1/a/c/o'):
'https://1.1.1.1/v1/a/c/o',
''):
self.assertEquals(utils.validate_sync_to(goodurl,
['1.1.1.1', '2.2.2.2']),
None)