I don't think you're stripping the userinfo quite right. You're stripping everything after the at-sign, when you want to strip what's before:
scheme://user:password@some.host:port/path?query_key=query_value&another_key=another_value#fragment