Otherwise, the path could be considered part of the host or port.
This is better than modifying the path to make it absolute when
a host or port is set. We could also raise for invalid paths
when a host or port is set using check_path, but that results
in weird errors, and won't catch issues (such as ftp allowing a
relative path).
Fixes [Bug #19916]
ac32aa005b
URI::Generic#{user,password} return the encoded values, which are
not that useful if you want to do authentication with them.
Automatic decoding by default would break backwards compatibility.
Optional automatic decoding via a keyword to URI.parse would
require threading the option through at least 3 other methods, and
would make semantics confusing (user= takes encoded or unencoded
password?) or require more work. Thus, adding this as a separate
method seemed the simplest approach.
Unfortunately, URI lacks a method for correct decoding. Unlike in
www form components, + in earlier parts of the URI such as the
userinfo section is treated verbatim and not as an encoded space.
Add URI.#{en,de}code_uri_component methods, which are almost the
same as URI.#{en,de}code_www_form_component, but without the
special SP => + handling.
Implements [Feature #9045]
16cfc4e92f
The module here is called `URI`, so it's probably reasonable to expect a requirement for the path to be RFC3986-compliant, but on the other hand, the class is called `File`, so it might be reasonable to expect that a path produced by e.g. the `File` class would be consumable by its `build` method (this fails if the filename contains e.g. a space).
ef79789b83
REGEXP is defined as RFC2396_REGEXP in lib/uri/common.rb. If we include
REGEXP then a broken URL is generated in rdoc for URI and URI::MailTo.
ed6ded9c80
* Using a module to map scheme name to scheme class, which also works with Ractor.
* No constant redefinition, no ObjectSpace, still fast lookup for initial schemes.
883567fd81
`#=~` builds `MatchData`, requiring extra allocations as compared to
`#match?`, which returns a boolean w/o having to build the `MatchData`.
158f58a9cc
These Java properties, retrieved from JRuby's "Java env" ENV_JAVA,
allow JRuby users to use the same proxy properties the rest of the
Java platform uses.
This resolves https://bugs.ruby-lang.org/issues/111943bd2bcc95a