Skip to content

dsn: escape and unescape user field #1383

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

Closed

Conversation

liuxinbot
Copy link

Sometimes usernames may have characters that need encoding such as : or @. This fixes the problem by url escaping the username on FormatDSN and unescaping it on ParseDSN.

Although the DSNs are not proper URIs escaping of username is defined in https://www.ietf.org/rfc/rfc3986.txt

Fixes: #688

Description

Please explain the changes you made here.

Checklist

  • Code compiles correctly
  • Created tests which fail without the change (if possible)
  • All tests passing
  • Extended the README / documentation, if necessary
  • Added myself / the copyright holder to the AUTHORS file

Sometimes usernames may have characters that need encoding such as : or
@.  This fixes the problem by url escaping the username on FormatDSN and
unescaping it on ParseDSN.

Although the DSNs are not proper URIs escaping of username is defined in
https://www.ietf.org/rfc/rfc3986.txt

Fixes: go-sql-driver#688
@liuxinbot liuxinbot closed this Jan 17, 2023
@liuxinbot liuxinbot deleted the v1.6.0-username-escape branch January 17, 2023 07:37
@liuxinbot liuxinbot restored the v1.6.0-username-escape branch January 17, 2023 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Username with a ':' fails.
1 participant