Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: net/url: (*Userinfo).Username function should return bool value alongside with string #66838

Closed
otaxhu opened this issue Apr 15, 2024 · 1 comment
Labels
Milestone

Comments

@otaxhu
Copy link

otaxhu commented Apr 15, 2024

Proposal Details

I'm not an expert of the RFC documents for urls, I would like to know if the following urls are valid:

  1. This is supposed to have a empty username and empty password (totally different from null username or password)
https://:@domain.com
  1. This is supposed to have empty username and null password
https://@domain.com
  1. This have both username and password null.
https://domain.com

If the second and third statements are true, then Userinfo functions Username and Password should have a mechanism in which should notify to the caller that this values are empty or null.

Password function already returns a bool value indicating presence or nullness of that field. I would like to know if it's correct to have Username function to return the same :)

@gopherbot gopherbot added this to the Proposal milestone Apr 15, 2024
@seankhliao
Copy link
Member

The Username method signature cannot change, as it would break go1compat.
That said, UserInfo does already differentiate between itself being nil and the username being empty: https://go.dev/play/p/tOdeqGObADy

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants