summaryrefslogtreecommitdiff
path: root/lib/uri/common.rb
AgeCommit message (Collapse)Author
2025-10-31[ruby/uri] Switch a parsing behavior completely when switching a parseryuuji.yaginuma
Currently, some methods' behavior(e.g. `URI.parse`) don't change when switching a parser. This is because some methods use `DEFAULT_PARSER`, but `parser=` doesn't change `DEFAULT_PARSER`. This PR introduces a constant to keep a parser's instance and change it when switching a parser. Also, change to use it in methods. https://github.com/ruby/uri/commit/aded210709
2025-10-31[ruby/uri] chore(docs): replace reference to the obsolete URI.escape with ↵vivshaw
URI::RFC2396_PARSER.escape https://github.com/ruby/uri/commit/72e7d6b364
2025-07-14[ruby/uri] [DOC] Document private visibility tooNobuyoshi Nakada
For the references to URI::RFC2396_Parser private methods. https://github.com/ruby/uri/commit/372fbb455d
2025-06-26[ruby/uri] [DOC] State that uri library is needed to call Kernel#URINobuyoshi Nakada
So that the example works as-is. https://github.com/ruby/uri/commit/30212d311e
2025-06-26[ruby/uri] Fix a typoNobuyoshi Nakada
https://github.com/ruby/uri/commit/b636e83d99 Co-authored-by: Olle Jonsson <olle.jonsson@gmail.com>
2025-06-26[ruby/uri] Use Lo category chars as escaped charsNobuyoshi Nakada
TruffleRuby does not allow Symbol categories as identifiers. https://github.com/ruby/uri/commit/5531d42375
2025-06-26[ruby/uri] Escape reserved characters in scheme nameNobuyoshi Nakada
Fix https://github.com/ruby/uri/pull/89 https://github.com/ruby/uri/commit/d543c0dafa
2025-02-27[ruby/uri] Use a fully qualified name in warning messagesyuuji.yaginuma
Currently, some warning messages don't contain a `URI` like the following. ```ruby warning: URI::ABS_URI is obsolete. Use RFC2396_PARSER.regexp[:ABS_URI] explicitly. ``` But, without `URI` prefix, the suggested value doesn't work. So I think we should use a fully qualified name to avoid confusion. https://github.com/ruby/uri/commit/428eb10e44
2025-01-24[ruby/uri] [DOC] Make documentation 100%Nobuyoshi Nakada
https://github.com/ruby/uri/commit/fe7aa3dac2
2024-11-14[ruby/uri] Check existence constants only URI moduleHiroshi SHIBATA
https://github.com/ruby/uri/commit/b6f583369a
2024-11-14[ruby/uri] Removed duplicated declare step for constants under the ↵Hiroshi SHIBATA
URI::RFC2396_REGEXP::PATTERN https://github.com/ruby/uri/commit/60a8bc1575
2024-11-08[ruby/uri] Added more fallback constants like URI::PARTTERN and URI::REGEXPHiroshi SHIBATA
Fixed https://github.com/ruby/uri/issues/125 https://github.com/ruby/uri/commit/1f3d3df02a
2024-08-06[ruby/uri] Fallback missing constants with RFC3986_PARSERHiroshi SHIBATA
(https://github.com/ruby/uri/pull/113) * Fallback missing constants with RFC3986_PARSER * raise missing constant * Update test/uri/test_common.rb Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> * Update lib/uri/common.rb Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> * Update lib/uri/common.rb Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> --------- https://github.com/ruby/uri/commit/c2fdec079a Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2024-08-05[ruby/uri] Use DEFAULT_PARSER at split, parse, joinHiroshi SHIBATA
https://github.com/ruby/uri/commit/28af4e155a
2024-07-21[ruby/uri] Restrict constant checks to current namespace to avoid conflicts ↵Randy Stauner
with globals https://github.com/ruby/uri/commit/7a64e0245f
2024-07-19[ruby/uri] Also support URI::PATTERN with switch-backHiroshi SHIBATA
https://github.com/ruby/uri/commit/823697edb4
2024-07-19[ruby/uri] Added test for constant definition and remove URI::REGEXP when ↵Hiroshi SHIBATA
using RFC3986_PARSER https://github.com/ruby/uri/commit/6f616d97fc
2024-07-19[ruby/uri] Added URI.parser= method for switch back to RFC2396_ParserHiroshi SHIBATA
https://github.com/ruby/uri/commit/d7dc19ad3f
2023-01-08[ruby/uri] [DOC] Enhanced RDoc for URIBurdette Lamar
(https://github.com/ruby/uri/pull/55) https://github.com/ruby/uri/commit/89ab4f1407
2023-01-08[ruby/uri] [DOC] Enhanced RDoc for URI.decode_www_formBurdette Lamar
(https://github.com/ruby/uri/pull/53) https://github.com/ruby/uri/commit/ce379e6125
2023-01-07[ruby/uri] [DOC] Common rdoc (https://github.com/ruby/uri/pull/52)Burdette Lamar
https://github.com/ruby/uri/commit/be8047028f
2023-01-06[ruby/uri] [DOC] Enhanced RDoc for common methodsBurdette Lamar
(https://github.com/ruby/uri/pull/50) https://github.com/ruby/uri/commit/7ff4fb372b
2023-01-04[ruby/uri] [DOC] Common methods rdocBurdette Lamar
(https://github.com/ruby/uri/pull/49) https://github.com/ruby/uri/commit/02dfc79366
2023-01-03[ruby/uri] [DOC] Enhanced RDoc for common methodsBurdette Lamar
(https://github.com/ruby/uri/pull/48) https://github.com/ruby/uri/commit/2bfd848c26
2022-05-12[ruby/uri] Improve URI.register_scheme tests and automatically upcase the ↵Benoit Daloze
given scheme * Also add docs and mention current limitations. * For reference, https://stackoverflow.com/a/3641782/388803 mentions the valid characters in schemes. https://github.com/ruby/uri/commit/4346daac75
2022-05-12[ruby/uri] Add URI::Generic#decoded_#{user,password}Jeremy Evans
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] https://github.com/ruby/uri/commit/16cfc4e92f
2022-04-22[ruby/uri] Include RFC2396_REGEXP module directlyPeter Zhu
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. https://github.com/ruby/uri/commit/ed6ded9c80
2021-07-28Update to latest uriBenoit Daloze
* https://github.com/ruby/uri/commit/bc47bf71df2b2e9cea09d0b2684ceac7355e42a0 * To include the fix from https://github.com/ruby/uri/pull/27
2021-07-27Fix test failure for parallel testingHiroshi SHIBATA
2021-07-27[ruby/uri] Add proper Ractor support to URIBenoit Daloze
* 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. https://github.com/ruby/uri/commit/883567fd81
2021-07-27[ruby/uri] Revert "Fix to support Ruby 3.0 Ractor"Benoit Daloze
* This reverts commit 1faa4fdc161d7aeebdb5de0c407b923beaecf898. * It has too many problems, see https://github.com/ruby/uri/pull/22 for discussion. https://github.com/ruby/uri/commit/b959da2dc9
2021-07-27[ruby/uri] Fix to support Ruby 3.0 Ractorkvokka
https://github.com/ruby/uri/commit/1faa4fdc16
2021-04-22[ruby/uri] Use Regexp#match? to avoid extra allocationsSteven Harman
`#=~` builds `MatchData`, requiring extra allocations as compared to `#match?`, which returns a boolean w/o having to build the `MatchData`. https://github.com/ruby/uri/commit/158f58a9cc
2020-12-16fix doc typod-m-u
s/it's/its Notes: Merged: https://github.com/ruby/ruby/pull/3920
2020-09-15[ruby/uri] Remove deprecated URI.escape/URI.unescapeJeremy Evans
https://github.com/ruby/uri/commit/61c6a47ebf
2020-07-13[DOC] Use https:// instead of http:// [ci skip]Kazuhiro NISHIYAMA
2020-03-26* remove trailing spaces. [ci skip]git
2020-03-26[ruby/uri] Remove RCS keywordsDavid Rodríguez
https://github.com/ruby/uri/commit/1bcb1203ad
2020-03-26[ruby/uri] Simplify construction of URI instances using parser interface.Samuel Williams
https://github.com/ruby/uri/commit/c145017dd7
2020-01-09Fix warnings for URI.encode and URI.decodeJeremy Evans
Use __callee__ to display the called method. Fixes [Bug #16469]
2019-09-27Warn for URI.{,un}{escape,encode}, even if not in verbose modeJeremy Evans
The verbose mode warning has been present for almost 10 years. If we ever plan to remove these methods, we should make the warning a regular deprecation warning so that people are aware. Implements [Feature #15961] Notes: Merged: https://github.com/ruby/ruby/pull/2494
2019-09-27Fix fallback in URI.encode_www_form_component to include #Jeremy Evans
Patch from Matthew Kerwin. Fixes [Bug #14358] Notes: Merged: https://github.com/ruby/ruby/pull/2494
2018-11-02lib/*: Prefer require_relative over require.marcandre
[#15206] [Fix GH-1976] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-25common.rb: unused constantnobu
* lib/uri/common.rb (URI::HTML5ASCIIINCOMPAT): remove the constant which has been unused since r40460, and wrong since r49069 due to the operator precedence. [ruby-core:86678] [Bug #14711] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-21Improve docs for URI librarystomar
* lib/uri/generic.rb: [DOC] fix invalid example code to make it syntax highlighted; drop unnecessary `puts', `p'; adapt to current inspect format without Object id; do not display unnecessary return values in examples; fix or prevent unintended description lists; fix broken RDoc; fix grammar and typos. * lib/uri.rb: ditto. * lib/uri/common.rb: ditto. * lib/uri/file.rb: ditto. * lib/uri/ftp.rb: ditto. * lib/uri/http.rb: ditto. * lib/uri/ldap.rb: ditto. * lib/uri/mailto.rb: ditto. * lib/uri/rfc2396_parser.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-28uri/common: reduce allocations and retained objectsnormal
Thanks to Sam Saffron for this patch, it shows a nice reduction which affects many web applications: require 'memory_profiler' MemoryProfiler.report do require 'uri' end.pretty_print Before: Total allocated: 986643 bytes (15159 objects) Total retained: 246370 bytes (2532 objects) After: Total allocated: 926903 bytes (13665 objects) Total retained: 208570 bytes (1587 objects) * lib/uri/common.rb: reduce allocations and retained objects [ruby-core:85161] [Feature #14410] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12Add uplevel keyword to Kernel#warn and use itshyouhei
If uplevel keyword is given, the warning message is prepended with caller file and line information and the string "warning: ". The use of the uplevel keyword makes Kernel#warn format output similar to how rb_warn formats output. This patch modifies net/ftp and net/imap to use Kernel#warn instead of $stderr.puts or $stderr.printf, since they are used for printing warnings. This makes lib/cgi/core and tempfile use $stderr.puts instead of warn for debug logging, since they are used for debug printing and not for warning. This does not modify bundler, rubygems, or rdoc, as those are maintained outside of ruby and probably wish to remain backwards compatible with older ruby versions. rb_warn_m code is originally from nobu, but I've changed it so that it only includes the path and lineno from uplevel (not the method), and also prepends the string "warning: ", to make it more similar to rb_warn. From: Jeremy Evans code@jeremyevans.net Signed-off-by: Urabe Shyouhei shyouhei@ruby-lang.org git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21Use caller with length to reduce unused stringskazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-26* lib/uri/common.rb: [DOC] add rdoc to describesonots
URI.unescape is obsolete [ci-skip] [fix GH-1630] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-23Fix typo of URI#escape [Bug #13147]naruse
patched by Steve Hill <sghill.dev@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e