diff --git a/stdlib/uri/0/common.rbs b/stdlib/uri/0/common.rbs index 453559943..fae260cfb 100644 --- a/stdlib/uri/0/common.rbs +++ b/stdlib/uri/0/common.rbs @@ -268,7 +268,7 @@ module URI # It's recommended to first ::escape the provided `uri_str` if there are any # invalid URI characters. # - def self.parse: (String uri) -> URI::Generic + def self.parse: (_ToStr uri) -> (File | FTP | HTTP | HTTPS | LDAP | LDAPS | MailTo | WS | WSS | Generic) # ## Synopsis # @@ -308,6 +308,11 @@ module URI # def self.scheme_list: () -> Hash[String, Class] + # Construct a URI instance, using the scheme to detect the appropriate class + # from +URI.scheme_list+. + # + def self.for: (String scheme, *untyped arguments, ?default: Class) -> (File | FTP | HTTP | HTTPS | LDAP | LDAPS | MailTo | WS | WSS | Generic) + # ## Synopsis # # URI::split(uri) diff --git a/stdlib/uri/0/ftp.rbs b/stdlib/uri/0/ftp.rbs new file mode 100644 index 000000000..66b66965e --- /dev/null +++ b/stdlib/uri/0/ftp.rbs @@ -0,0 +1,10 @@ +module URI + # FTP URI syntax is defined by RFC1738 section 3.2. + # + # This class will be redesigned because of difference of implementations; + # the structure of its path. draft-hoffman-ftp-uri-04 is a draft but it + # is a good summary about the de facto spec. + # http://tools.ietf.org/html/draft-hoffman-ftp-uri-04 + class FTP < Generic + end +end diff --git a/stdlib/uri/0/mailto.rbs b/stdlib/uri/0/mailto.rbs new file mode 100644 index 000000000..968998fa0 --- /dev/null +++ b/stdlib/uri/0/mailto.rbs @@ -0,0 +1,5 @@ +module URI + # RFC6068, the mailto URL scheme. + class MailTo < Generic + end +end diff --git a/stdlib/uri/0/ws.rbs b/stdlib/uri/0/ws.rbs new file mode 100644 index 000000000..69845f911 --- /dev/null +++ b/stdlib/uri/0/ws.rbs @@ -0,0 +1,10 @@ +module URI + # The syntax of WS URIs is defined in RFC6455 section 3. + # + # Note that the Ruby URI library allows WS URLs containing usernames and + # passwords. This is not legal as per the RFC, but used to be + # supported in Internet Explorer 5 and 6, before the MS04-004 security + # update. See . + class WS < Generic + end +end diff --git a/stdlib/uri/0/wss.rbs b/stdlib/uri/0/wss.rbs new file mode 100644 index 000000000..4630826a4 --- /dev/null +++ b/stdlib/uri/0/wss.rbs @@ -0,0 +1,7 @@ +module URI + # The default port for WSS URIs is 443, and the scheme is 'wss:' rather + # than 'ws:'. Other than that, WSS URIs are identical to WS URIs; + # see URI::WS. + class WSS < WS + end +end