support IPV6 addresses in URLs

These are fixes to support IPV6 addresses in URLs, based on changes in the uricore project, which has borrowed werkzeug/urls.py

https://github.com/core/uricore/commit/b4287c7588c76f15a1b2cf8ef33ca39963ab9fea
https://github.com/core/uricore/commit/83e29cbe6010aa6fa5ad43e220a3f1774263c7aa
https://github.com/core/uricore/commit/f574933dc12cb807d9e6f757c0ea22c9e7ce51ae