Skip to content

Commit

Permalink
Merge pull request #846 from ksss/uri-parse-for
Browse files Browse the repository at this point in the history
Fix URI signatures
  • Loading branch information
soutaro authored Dec 21, 2021
2 parents a93ed74 + efd13d5 commit 74591f7
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 1 deletion.
7 changes: 6 additions & 1 deletion stdlib/uri/0/common.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down Expand Up @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions stdlib/uri/0/ftp.rbs
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions stdlib/uri/0/mailto.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module URI
# RFC6068, the mailto URL scheme.
class MailTo < Generic
end
end
10 changes: 10 additions & 0 deletions stdlib/uri/0/ws.rbs
Original file line number Diff line number Diff line change
@@ -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 <URL:http://support.microsoft.com/kb/834489>.
class WS < Generic
end
end
7 changes: 7 additions & 0 deletions stdlib/uri/0/wss.rbs
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 74591f7

Please sign in to comment.