always consider relative URLs as being of the same origin (fixes #10371)

This commit is contained in:
Benjamin Dauvergne 2016-03-18 15:47:53 +01:00
parent b8625f56e2
commit bfa84bb6ba
1 changed files with 2 additions and 0 deletions

View File

@ -206,6 +206,8 @@ def same_origin(url1, url2):
Checks if two URLs are 'same-origin'
"""
p1, p2 = urlparse(url1), urlparse(url2)
if url1.startswith('/') or url2.startswith('/'):
return True
try:
return (p1.scheme, p1.hostname, p1.port) == (p2.scheme, p2.hostname, p2.port)
except ValueError: