Allow unsetting of X-Container-Sync-To header.
Fixes bug 1071790. Change-Id: Ic0509190b9994e7d983bcf20daa64a650cc974cb
This commit is contained in:
parent
0a03bd06a3
commit
40f46e245c
@ -1306,6 +1306,8 @@ def urlparse(url):
|
|||||||
|
|
||||||
|
|
||||||
def validate_sync_to(value, allowed_sync_hosts):
|
def validate_sync_to(value, allowed_sync_hosts):
|
||||||
|
if not value:
|
||||||
|
return None
|
||||||
p = urlparse(value)
|
p = urlparse(value)
|
||||||
if p.scheme not in ('http', 'https'):
|
if p.scheme not in ('http', 'https'):
|
||||||
return _('Invalid scheme %r in X-Container-Sync-To, must be "http" '
|
return _('Invalid scheme %r in X-Container-Sync-To, must be "http" '
|
||||||
|
@ -880,7 +880,8 @@ log_name = %(yarr)s'''
|
|||||||
for goodurl in ('http://1.1.1.1/v1/a/c/o',
|
for goodurl in ('http://1.1.1.1/v1/a/c/o',
|
||||||
'http://1.1.1.1:8080/a/c/o',
|
'http://1.1.1.1:8080/a/c/o',
|
||||||
'http://2.2.2.2/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,
|
self.assertEquals(utils.validate_sync_to(goodurl,
|
||||||
['1.1.1.1', '2.2.2.2']),
|
['1.1.1.1', '2.2.2.2']),
|
||||||
None)
|
None)
|
||||||
|
Loading…
Reference in New Issue
Block a user