Fix idna and ipv6 literal handling in MatrixFederationAgent (#4487)
Turns out that the library does a better job of parsing URIs than our reinvented wheel. Who knew. There are two things going on here. The first is that, unlike parse_server_name, URI.fromBytes will strip off square brackets from IPv6 literals, which means that it is valid input to ClientTLSOptionsFactory and HostnameEndpoint. The second is that we stay in `bytes` throughout (except for the argument to ClientTLSOptionsFactory), which avoids the weirdness of (sometimes) ending up with idna-encoded values being held in `unicode` variables. TBH it probably would have been ok but it made the tests fragile.
Showing
- changelog.d/4487.misc 1 addition, 0 deletionschangelog.d/4487.misc
- synapse/http/federation/matrix_federation_agent.py 12 additions, 11 deletionssynapse/http/federation/matrix_federation_agent.py
- tests/http/federation/test_matrix_federation_agent.py 180 additions, 1 deletiontests/http/federation/test_matrix_federation_agent.py
Loading
Please register or sign in to comment