Check that we have auth headers and fail nicely

This commit is contained in:
Erik Johnston 2014-10-17 21:00:58 +01:00
parent cd198dfea8
commit ac9345b47a

View File

@ -238,6 +238,11 @@ class TransportLayer(object):
auth_headers = request.requestHeaders.getRawHeaders(b"Authorization") auth_headers = request.requestHeaders.getRawHeaders(b"Authorization")
if not auth_headers:
raise SynapseError(
401, "Missing Authorization headers", Codes.UNAUTHORIZED,
)
for auth in auth_headers: for auth in auth_headers:
if auth.startswith("X-Matrix"): if auth.startswith("X-Matrix"):
(origin, key, sig) = parse_auth_header(auth) (origin, key, sig) = parse_auth_header(auth)