Fix parsing hostname part in uri.