server: Don't use the address in the config for connection establishment.

The address in the config can contain subpaths and it doesn't make sense
for a socket to connect to this address. The net location without the
subpath is now contained in server.address.
This commit is contained in:
Damir Jelić 2019-02-03 22:56:10 +01:00
parent 107a7a606e
commit b884536e7e
5 changed files with 23 additions and 13 deletions

View file

@ -6,14 +6,21 @@ G.CONFIG = MockConfig()
class TestClass(object):
def test_address_parsing(self):
host = MatrixServer._parse_url("example.org", "443")
netloc, host = MatrixServer._parse_url("example.org", "443")
assert host == "example.org:443"
assert netloc == "example.org"
host = MatrixServer._parse_url("example.org/_matrix", "443")
netloc, host = MatrixServer._parse_url("example.org/_matrix", "443")
assert host == "example.org:443/_matrix"
assert netloc == "example.org"
host = MatrixServer._parse_url("https://example.org/_matrix", "443")
netloc, host = MatrixServer._parse_url(
"https://example.org/_matrix",
"443"
)
assert host == "example.org:443/_matrix"
assert netloc == "example.org"
host = MatrixServer._parse_url("https://example.org", "443")
netloc, host = MatrixServer._parse_url("https://example.org", "443")
assert host == "example.org:443"
assert netloc == "example.org"