summaryrefslogtreecommitdiff
path: root/test/uri
AgeCommit message (Collapse)Author
2025-11-04[ruby/uri] Re-allow consecutive, leading and trailing dots in EMAIL_REGEXPDaisuke Aritomo
Effectively reverts commit https://github.com/ruby/uri/commit/788274b180d6 and https://github.com/ruby/uri/commit/0abac721d8fe. EMAIL_REGEXP was mostly drawn from WHATWG HTML LS. This spec states that it intentionally violates RFC 5322 to provide a practical regex for validation. > This requirement is a willful violation of RFC 5322, which defines a > syntax for email addresses that is simultaneously too strict (before the > "@" character), too vague (after the "@" character), and too lax > (allowing comments, whitespace characters, and quoted strings in manners > unfamiliar to most users) to be of practical use here. The allowing of consecutive dot s(`a..a@`) and leading/trailing dots (`.a@`, `a.@`) is not the only derivation from RFC 5322. If a truly RFC 5322-compliant regexp is needed, tt should be organized under a different name, since too much departure from the original EMAIL_REGEXP must be introduced. https://github.com/ruby/uri/commit/c551d7020b
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-07[ruby/uri] Clear user info totally at setting any of authority infoNobuyoshi Nakada
Fix CVE-2025-27221. https://hackerone.com/reports/3221142 https://github.com/ruby/uri/commit/5cec76b9e8
2025-07-13[ruby/uri] Repeat matching to reduce deviationsNobuyoshi Nakada
https://github.com/ruby/uri/commit/fa49e5b8ae
2025-07-13[ruby/uri] Test in exponential scale with rehearsalNobuyoshi Nakada
https://github.com/ruby/uri/commit/be35e0b4d8
2025-07-12[ruby/uri] Improve performance of `URI::MailTo::EMAIL_REGEXP`Nobuyoshi Nakada
Fix the performance regression at #172 for valid emails. ``` yml prelude: | require 'uri/mailto' n = 1000 re = URI::MailTo::EMAIL_REGEXP benchmark: n.t..t.: re.match?("n.t..t.@docomo.ne.jp") example: re.match?("example@example.info") ``` | |released| 788274b| c5974f0| this| |:--------|-------:|-------:|-------:|-------:| |n.t..t. | 3.795M| 4.864M| 4.993M| 8.739M| | | -| 1.28x| 1.32x| 2.30x| |example | 3.911M| 3.740M| 2.838M| 3.880M| | | 1.38x| 1.32x| -| 1.37x| https://github.com/ruby/uri/commit/7363a134ac
2025-07-12[ruby/uri] Do not allow empty host names, as they are not allowed by RFC 3986Jeremy Evans
Pointed out by John Hawthorn. Fixes [Bug #20686] https://github.com/ruby/uri/commit/c0cfa04a66
2025-07-12[ruby/uri] Prohibit successive dots in emailNobuyoshi Nakada
https://github.com/ruby/uri/commit/32335923bf
2025-07-12[ruby/uri] More tests for `check_to`Nobuyoshi Nakada
https://github.com/ruby/uri/commit/b1b5f9a476
2025-07-12[ruby/uri] lib/uri/mailto.rb (EMAIL_REGEXP): use assertions surrounding the ↵Nikita Levchuk
local part instead of a character class https://github.com/ruby/uri/commit/2d7d2d9988
2025-07-12[ruby/uri] lib/uri/mailto.rb (EMAIL_REGEXP): the local part should not ↵Nikita Levchuk
contain leading or trailing dots https://github.com/ruby/uri/commit/618e2bb640
2025-07-12[ruby/uri] Make URI::regexp schemes case sensitiveNobuyoshi Nakada
(https://github.com/ruby/uri/pull/38) https://github.com/ruby/uri/commit/0c2b6468fa
2025-07-12[ruby/uri] Fix the message for unexpected argumentNobuyoshi Nakada
Use just `self` instead of `self.class`, in `URI::Generic.build`. Since this is a class method, `self.class` is always `Class` even in inherited sub classes, and does not have `#component` method. https://github.com/ruby/uri/commit/6f44d3d40e
2025-07-08[ruby/uri] Prefer dedicated assertion methodsNobuyoshi Nakada
https://github.com/ruby/uri/commit/d79b3f5b94
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-06-04[ruby/uri] Revert "Alias value or join to take in old Ruby"Hiroshi SHIBATA
This reverts commit https://github.com/ruby/uri/commit/443ed0cf8540. https://github.com/ruby/uri/commit/9e51838a04
2025-06-03[ruby/uri] Alias value or join to take in old RubyHiroshi SHIBATA
https://github.com/ruby/uri/commit/443ed0cf85
2025-05-31`Ractor::Port`Koichi Sasada
* Added `Ractor::Port` * `Ractor::Port#receive` (support multi-threads) * `Rcator::Port#close` * `Ractor::Port#closed?` * Added some methods * `Ractor#join` * `Ractor#value` * `Ractor#monitor` * `Ractor#unmonitor` * Removed some methods * `Ractor#take` * `Ractor.yield` * Change the spec * `Racotr.select` You can wait for multiple sequences of messages with `Ractor::Port`. ```ruby ports = 3.times.map{ Ractor::Port.new } ports.map.with_index do |port, ri| Ractor.new port,ri do |port, ri| 3.times{|i| port << "r#{ri}-#{i}"} end end p ports.each{|port| pp 3.times.map{port.receive}} ``` In this example, we use 3 ports, and 3 Ractors send messages to them respectively. We can receive a series of messages from each port. You can use `Ractor#value` to get the last value of a Ractor's block: ```ruby result = Ractor.new do heavy_task() end.value ``` You can wait for the termination of a Ractor with `Ractor#join` like this: ```ruby Ractor.new do some_task() end.join ``` `#value` and `#join` are similar to `Thread#value` and `Thread#join`. To implement `#join`, `Ractor#monitor` (and `Ractor#unmonitor`) is introduced. This commit changes `Ractor.select()` method. It now only accepts ports or Ractors, and returns when a port receives a message or a Ractor terminates. We removes `Ractor.yield` and `Ractor#take` because: * `Ractor::Port` supports most of similar use cases in a simpler manner. * Removing them significantly simplifies the code. We also change the internal thread scheduler code (thread_pthread.c): * During barrier synchronization, we keep the `ractor_sched` lock to avoid deadlocks. This lock is released by `rb_ractor_sched_barrier_end()` which is called at the end of operations that require the barrier. * fix potential deadlock issues by checking interrupts just before setting UBF. https://bugs.ruby-lang.org/issues/21262 Notes: Merged: https://github.com/ruby/ruby/pull/13445
2025-02-26[ruby/uri] Fix merger of URI with authority componentHiroshi SHIBATA
https://hackerone.com/reports/2957667 https://github.com/ruby/uri/commit/2789182478 Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2025-02-26[ruby/uri] Truncate userinfo with URI#join, URI#merge and URI#+Hiroshi SHIBATA
https://github.com/ruby/uri/commit/3675494839
2024-11-26[ruby/uri] Suppress deprecate warning of test class (retry)Yusuke Endoh
(https://github.com/ruby/uri/pull/140) A follow-up to https://github.com/ruby/uri/commit/bd2e4be9d0fa Also, leave a comment that the use of `URI::REGEXP` is intentional https://github.com/ruby/uri/commit/bdf765e44a
2024-11-26[ruby/uri] Suppress deprecate warning of test class and use ↵Hiroshi SHIBATA
EnvUtil.suppress_warning. https://github.com/ruby/uri/commit/bd2e4be9d0
2024-11-26[ruby/uri] Revert "Prevent a warning: URI::REGEXP is obsoleteHiroshi SHIBATA
(https://github.com/ruby/uri/pull/138)" This reverts commit https://github.com/ruby/uri/commit/c00726a20a00. https://github.com/ruby/uri/commit/22f5a7a790
2024-11-25[ruby/uri] Prevent a warning: URI::REGEXP is obsoleteYusuke Endoh
(https://github.com/ruby/uri/pull/138) https://github.com/ruby/uri/commit/c00726a20a
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-14[ruby/uri] Restore constants like URI::REGEXP::PATTERN::IPV6ADDRHiroshi SHIBATA
https://github.com/ruby/uri/commit/ee9a38701a
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-08[ruby/uri] Use URI::RFC2396_PARSER explicitly in URIHiroshi SHIBATA
https://github.com/ruby/uri/commit/898b889811
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-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] Rename and switch RFC2396_PARSER testHiroshi SHIBATA
https://github.com/ruby/uri/commit/2e0f73f05e
2024-07-19[ruby/uri] Switch to inspect with default parserHiroshi SHIBATA
https://github.com/ruby/uri/commit/0ab9abbf08
2024-01-05[ruby/uri] Make URI#to_s prepend relative path with / if there is a host or portJeremy Evans
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] https://github.com/ruby/uri/commit/ac32aa005b
2023-06-29[ruby/uri] Fix quadratic backtracking on invalid port numberNobuyoshi Nakada
https://hackerone.com/reports/1958260 https://github.com/ruby/uri/commit/9d7bcef1e6
2023-06-29[ruby/uri] Fix quadratic backtracking on invalid relative URINobuyoshi Nakada
https://hackerone.com/reports/1958260 https://github.com/ruby/uri/commit/9010ee2536
2023-06-25[ruby/uri] Fix host part in relative referece #83Nobuyoshi Nakada
In relative referece, host part can be ommitted but can not be empty. https://github.com/ruby/uri/commit/2980f0ba02
2023-06-13[ruby/uri] Fix RFC3986 regexpsNobuyoshi Nakada
https://github.com/ruby/uri/commit/8e38592241
2023-05-05[ruby/uri] Define test cases as qualified class namesNobuyoshi Nakada
https://github.com/ruby/uri/commit/aaa22a2443
2023-05-05[ruby/uri] Increase repeat orders of magnitudeNobuyoshi Nakada
https://github.com/ruby/uri/commit/cfbeade935
2023-03-29[ruby/uri] Increase rehearsalsNobuyoshi Nakada
2023-03-28[ruby/uri] Test for quadratic backtracking on invalid URINobuyoshi Nakada
https://hackerone.com/reports/1444501 https://github.com/ruby/uri/commit/54abaa739b
2022-10-13[ruby/uri] Fix splitting relative URINobuyoshi Nakada
https://github.com/ruby/uri/commit/ffbab83de6
2022-10-13URI.parse should set empty string in host instead of nilNARUSE, Yui
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-22Use https for wss testHiroshi SHIBATA
2022-04-22[ruby/uri] Feat: Support WSSOKURA Masafumi
There was a file for WSS so I added one line of `require_relative` to make it work. Now `URI.parse('wss://example.com')` returns `URI::WS`. https://github.com/ruby/uri/commit/ff8a103564
2021-10-22'uri/https' is neededKoichi Sasada
`URI.parse('https://a.b.c/')` needs 'uri/https'.
2021-10-22[ruby/uri] URI#HTTP#origin and URI#HTTP#authority ↵Tiago
(https://github.com/ruby/uri/pull/30) https://github.com/ruby/uri/commit/bf13946c32 Co-authored-by: Samuel Williams <samuel.williams@oriontransfer.co.nz>