Commit graph

137 commits

Author SHA1 Message Date
Hiroshi SHIBATA
b407b6b5b2 [ruby/uri] Fix merger of URI with authority component
https://hackerone.com/reports/2957667

2789182478

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2025-02-26 07:08:45 +00:00
Hiroshi SHIBATA
57dcb4bb9b [ruby/uri] Truncate userinfo with URI#join, URI#merge and URI#+
3675494839
2025-02-26 07:08:44 +00:00
Yusuke Endoh
16d98dc3c1 [ruby/uri] Suppress deprecate warning of test class (retry)
(https://github.com/ruby/uri/pull/140)

A follow-up to bd2e4be9d0

Also, leave a comment that the use of `URI::REGEXP` is intentional

bdf765e44a
2024-11-26 10:02:58 +00:00
Hiroshi SHIBATA
8655b9f7c6 [ruby/uri] Suppress deprecate warning of test class and use EnvUtil.suppress_warning.
bd2e4be9d0
2024-11-26 03:32:01 +00:00
Hiroshi SHIBATA
1d9dc4c504 [ruby/uri] Revert "Prevent a warning: URI::REGEXP is obsolete
(https://github.com/ruby/uri/pull/138)"

This reverts commit c00726a20a.

22f5a7a790
2024-11-26 03:32:01 +00:00
Yusuke Endoh
da8f554011 [ruby/uri] Prevent a warning: URI::REGEXP is obsolete
(https://github.com/ruby/uri/pull/138)

c00726a20a
2024-11-25 07:28:52 +00:00
Hiroshi SHIBATA
1bab8bf88f [ruby/uri] Removed duplicated declare step for constants under the URI::RFC2396_REGEXP::PATTERN
60a8bc1575
2024-11-14 02:20:04 +00:00
Hiroshi SHIBATA
1d6c986104 [ruby/uri] Restore constants like URI::REGEXP::PATTERN::IPV6ADDR
ee9a38701a
2024-11-14 02:20:04 +00:00
Hiroshi SHIBATA
d7c65398e0 [ruby/uri] Added more fallback constants like URI::PARTTERN and URI::REGEXP
Fixed https://github.com/ruby/uri/issues/125

1f3d3df02a
2024-11-08 06:06:30 +00:00
Hiroshi SHIBATA
68ebd56a76 [ruby/uri] Use URI::RFC2396_PARSER explicitly in URI
898b889811
2024-08-08 02:09:27 +00:00
Hiroshi SHIBATA
267da552a1 [ruby/uri] Fallback missing constants with RFC3986_PARSER
(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>

---------

c2fdec079a

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2024-08-06 09:09:52 +00:00
Hiroshi SHIBATA
8db2325a11 [ruby/uri] Also support URI::PATTERN with switch-back
823697edb4
2024-07-19 00:50:38 +00:00
Hiroshi SHIBATA
082335494b [ruby/uri] Added test for constant definition and remove URI::REGEXP when using RFC3986_PARSER
6f616d97fc
2024-07-19 00:50:37 +00:00
Hiroshi SHIBATA
862041d054 [ruby/uri] Rename and switch RFC2396_PARSER test
2e0f73f05e
2024-07-19 00:50:36 +00:00
Hiroshi SHIBATA
ce4da88a57 [ruby/uri] Switch to inspect with default parser
0ab9abbf08
2024-07-19 00:50:36 +00:00
Jeremy Evans
37657c79b6 [ruby/uri] Make URI#to_s prepend relative path with / if there is a host or port
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
2024-01-05 16:07:55 +00:00
Nobuyoshi Nakada
995ce947be [ruby/uri] Fix quadratic backtracking on invalid port number
https://hackerone.com/reports/1958260

9d7bcef1e6
2023-06-29 01:07:52 +00:00
Nobuyoshi Nakada
1eff362492 [ruby/uri] Fix quadratic backtracking on invalid relative URI
https://hackerone.com/reports/1958260

9010ee2536
2023-06-29 01:07:51 +00:00
Nobuyoshi Nakada
c21436cb35 [ruby/uri] Fix host part in relative referece #83
In relative referece, host part can be ommitted but can not be empty.

2980f0ba02
2023-06-25 15:24:05 +00:00
Nobuyoshi Nakada
6d734a8975 [ruby/uri] Fix RFC3986 regexps
8e38592241
2023-06-13 05:57:17 +00:00
Nobuyoshi Nakada
cc4c28d0ce [ruby/uri] Define test cases as qualified class names
aaa22a2443
2023-05-05 00:46:11 +00:00
Nobuyoshi Nakada
c598bc4603 [ruby/uri] Increase repeat orders of magnitude
cfbeade935
2023-05-05 00:46:10 +00:00
Nobuyoshi Nakada
f241a8de56
[ruby/uri] Increase rehearsals 2023-03-29 09:52:33 +09:00
Nobuyoshi Nakada
9c687c65ee [ruby/uri] Test for quadratic backtracking on invalid URI
https://hackerone.com/reports/1444501

54abaa739b
2023-03-28 02:12:21 +00:00
Nobuyoshi Nakada
4b1504ae0a [ruby/uri] Fix splitting relative URI
ffbab83de6
2022-10-13 16:24:53 +09:00
NARUSE, Yui
dd5118f852
URI.parse should set empty string in host instead of nil 2022-10-13 11:04:06 +09:00
Benoit Daloze
40ca208a6d [ruby/uri] Improve URI.register_scheme tests and automatically upcase the given scheme
* Also add docs and mention current limitations.
* For reference, https://stackoverflow.com/a/3641782/388803 mentions the
  valid characters in schemes.

4346daac75
2022-05-12 18:19:17 +09:00
Jeremy Evans
fbebfe1697 [ruby/uri] Add URI::Generic#decoded_#{user,password}
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
2022-05-12 14:54:37 +09:00
Hiroshi SHIBATA
3fa768c5c3
Use https for wss test 2022-04-22 12:11:36 +09:00
OKURA Masafumi
c94f964e3f [ruby/uri] Feat: Support WSS
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`.

ff8a103564
2022-04-22 11:59:54 +09:00
Koichi Sasada
6b9285e8d4 'uri/https' is needed
`URI.parse('https://a.b.c/')` needs 'uri/https'.
2021-10-22 23:56:07 +09:00
Tiago
553f234a07 [ruby/uri] URI#HTTP#origin and URI#HTTP#authority (https://github.com/ruby/uri/pull/30)
bf13946c32

Co-authored-by: Samuel Williams <samuel.williams@oriontransfer.co.nz>
2021-10-22 19:48:36 +09:00
Benoit Daloze
59a65f2d24 Update to latest uri
* bc47bf71df
* To include the fix from https://github.com/ruby/uri/pull/27
2021-07-28 12:26:31 +02:00
Hiroshi SHIBATA
d3d68aa842
[ruby/uri] User assert_ractor for test case of Ractor
bbf8b44dba
2021-07-27 16:57:03 +09:00
Benoit Daloze
1cf111774f
[ruby/uri] Add proper Ractor support to URI
* 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
2021-07-27 16:54:27 +09:00
Benoit Daloze
090d799c24
[ruby/uri] Revert "Fix to support Ruby 3.0 Ractor"
* This reverts commit 1faa4fdc161d7aeebdb5de0c407b923beaecf898.
* It has too many problems, see https://github.com/ruby/uri/pull/22 for discussion.

b959da2dc9
2021-07-27 16:54:26 +09:00
kvokka
a288c21a5d
[ruby/uri] Fix to support Ruby 3.0 Ractor
1faa4fdc16
2021-07-27 16:54:26 +09:00
Jeremy Evans
3e27ca6047 [ruby/uri] Add tests for URI::RFC{2396,3986}_Parser#inspect
d47dae2f8e
2021-04-22 14:54:37 +09:00
Lukas Zapletal
c46a4b8c7f [ruby/uri] Optimize URI#hostname and URI#hostname=
3b7ccfd835
2021-04-22 14:54:28 +09:00
Nobuyoshi Nakada
46b93175ed
Fakes IPSocket.getaddress in the whole method
To get rid of calling `getaddrinfo`, which may keep FDs
internally.
2020-05-06 16:06:25 +09:00
Nobuyoshi Nakada
e04418bb16 [ruby/uri] Check if DN exists
https://bugs.ruby-lang.org/issues/16830

b4bf8c1217
2020-05-05 23:29:39 +09:00
Hiroshi SHIBATA
b94f50ed91
Added implictily require for URI::HTTP 2020-03-26 20:28:01 +09:00
Matt Muller
92a238a21c
[ruby/uri] Add support for WebSockets
805a95786a
2020-03-26 18:06:14 +09:00
Jeremy Evans
7909f06212 Check for invalid hex escapes in URI#query=
Fixes [Bug #11275]
2019-10-08 07:30:55 -07:00
Jeremy Evans
a2c26fe1c6 Fix fallback in URI.encode_www_form_component to include #
Patch from Matthew Kerwin.

Fixes [Bug #14358]
2019-09-27 07:43:32 -07:00
Hiroshi SHIBATA
209ea85b54
Make portable for standalone test-unit gem.
* It can invoke test-unit with envutil.rb
  * refute_match of test-unit couldn't handle String instance.
2019-08-19 18:37:22 +09:00
naruse
d50ecb63ec http_proxy setting should respect both parent domain and subdomain
URI::Generic: Respect no_proxy for both parent domain and
subdomains It is now possible to add just the subdomains for proxy bypass. In
a setting where the main domain needs to go through proxy while the
subdomains don't, it is now possible to just add the subdomains to the
no_proxy list.
The assumption that subdomains and the parent domain should
behave the same wrt no_proxy has been removed.

eg: Adding .example.com in no_proxy would allow example.com
to go through the proxy.

From: Harsimran Singh Maan <maan.harry@gmail.com>
fix https://github.com/ruby/ruby/pull/1748
[Bug #14345]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-17 07:40:01 +00:00
naruse
234a30459c set UTF-8 if given URI string is ASCII
Now URI is normally UTF-8, and US-ASCII URI string is considered as
escaped a UTF-8 string.
https://github.com/rails/rails/issues/32294

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-22 11:20:03 +00:00
nobu
b6e2c52857 Docs and tests on URI.hierarchical?, URI.absolute?
Improve code coverage and clarify meaning of hierarchical based on RFC
text.

[Fix GH-1846]

From: Xavier Riley <xavriley@hotmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-21 16:03:59 +00:00
naruse
04883f12c8 Introduce URI::File to handle file URI scheme
* the default value of URI::File's authority is "" (localhost).
  Both nil and "localhost" is normalized to "" by default.
* URI::File ignores setting userinfo and port
[Feature #14035]
fix https://github.com/ruby/ruby/pull/1719
fic https://github.com/ruby/ruby/pull/1832

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-15 16:51:31 +00:00