Allow validation of cross-domain redirects (#3561)

* Update compatibility validator to pass redirect check when redirecting to a different domain, whether http or https.
This commit is contained in:
Erica Portnoy
2016-09-29 15:31:13 -07:00
committed by GitHub
parent 769ebfce5e
commit 5fda61f271
@@ -40,8 +40,15 @@ class Validator(object):
return False
redirect_location = response.headers.get("location", "")
# We're checking that the redirect we added behaves correctly.
# It's okay for some server configuration to redirect to an
# http URL, as long as it's on some other domain.
if not redirect_location.startswith("https://"):
return False
if not redirect_location.startswith("http://"):
return False
else:
if redirect_location[len("http://"):] == name:
return False
if response.status_code != 301:
logger.error("Server did not redirect with permanent code")