-
-
Notifications
You must be signed in to change notification settings - Fork 368
Description
There are already some issues regarding the percent encoding (e.g. #503). I can see that the spec being implemented is https://url.spec.whatwg.org/#userinfo-percent-encode-set. The docs are lacking some info that you need to find by looking up the spec or this issue tracker.
The spec has this note:
Of the possible values for the percentEncodeSet argument only two end up encoding U+0025 (%) and thus give “roundtripable data”: component percent-encode set and application/x-www-form-urlencoded percent-encode set. The other values for the percentEncodeSet argument — which happen to be used by the URL parser — leave U+0025 (%) untouched and as such it needs to be percent-encoded first in order to be properly represented.
I thereby suggest adding something like the following to the docs of Url::set_password:
# Note:
[`Url::set_password()`] uses the [`parser::USERINFO`] encode set which does not
include `%` per the [URL Standard](http://url.spec.whatwg.org/). This does not create
roundtripable data if you password contains one or more `%` characters.
Apply a percent encoding to your input using an encode set that includes `%` prior
to passing it to [`Url::set_password()`].
Something similar might be worth adding to Url::set_username as well. Though usernames tend to contain less special chars nowadays.