зеркало из https://github.com/github/ruby.git
* lib/uri/common.rb (URI::Parser#initialize_pattern):
workaround fix pattern of hostname for RFC 3986. [ruby-dev:42672] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30089 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
e959e9f34a
Коммит
2a35a782ab
|
@ -1,3 +1,8 @@
|
|||
Mon Dec 6 09:16:46 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* lib/uri/common.rb (URI::Parser#initialize_pattern):
|
||||
workaround fix pattern of hostname for RFC 3986. [ruby-dev:42672]
|
||||
|
||||
Mon Dec 6 09:14:38 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* lib/mkmf.rb (check_signedness): rename unused variable prelude.
|
||||
|
|
|
@ -31,7 +31,7 @@ module URI
|
|||
# mark = "-" | "_" | "." | "!" | "~" | "*" | "'" |
|
||||
# "(" | ")"
|
||||
# unreserved = alphanum | mark
|
||||
UNRESERVED = "-_.!~*'()#{ALNUM}"
|
||||
UNRESERVED = "\\-_.!~*'()#{ALNUM}"
|
||||
# reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
|
||||
# "$" | ","
|
||||
# reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
|
||||
|
@ -239,8 +239,8 @@ module URI
|
|||
ret[:ESCAPED] = escaped = (opts.delete(:ESCAPED) || PATTERN::ESCAPED)
|
||||
ret[:UNRESERVED] = unreserved = opts.delete(:UNRESERVED) || PATTERN::UNRESERVED
|
||||
ret[:RESERVED] = reserved = opts.delete(:RESERVED) || PATTERN::RESERVED
|
||||
ret[:DOMLABEL] = domlabel = opts.delete(:DOMLABEL) || PATTERN::DOMLABEL
|
||||
ret[:TOPLABEL] = toplabel = opts.delete(:TOPLABEL) || PATTERN::TOPLABEL
|
||||
ret[:DOMLABEL] = opts.delete(:DOMLABEL) || PATTERN::DOMLABEL
|
||||
ret[:TOPLABEL] = opts.delete(:TOPLABEL) || PATTERN::TOPLABEL
|
||||
ret[:HOSTNAME] = hostname = opts.delete(:HOSTNAME)
|
||||
|
||||
# RFC 2396 (URI Generic Syntax)
|
||||
|
@ -258,8 +258,9 @@ module URI
|
|||
ret[:FRAGMENT] = fragment = "#{uric}*"
|
||||
|
||||
# hostname = *( domainlabel "." ) toplabel [ "." ]
|
||||
# reg-name = *( unreserved / pct-encoded / sub-delims ) # RFC3986
|
||||
unless hostname
|
||||
ret[:HOSTNAME] = hostname = "(?:#{domlabel}\\.)*#{toplabel}\\.?"
|
||||
ret[:HOSTNAME] = hostname = "(?:[a-zA-Z0-9\\-._~!$&'()*+,;=]|%\\h\\h)*"
|
||||
end
|
||||
|
||||
# RFC 2373, APPENDIX B:
|
||||
|
@ -326,7 +327,7 @@ module URI
|
|||
ret[:REL_SEGMENT] = rel_segment = "(?:[#{unreserved};@&=+$,]|#{escaped})+"
|
||||
|
||||
# scheme = alpha *( alpha | digit | "+" | "-" | "." )
|
||||
ret[:SCHEME] = scheme = "[#{PATTERN::ALPHA}][-+.#{PATTERN::ALPHA}\\d]*"
|
||||
ret[:SCHEME] = scheme = "[#{PATTERN::ALPHA}][\\-+.#{PATTERN::ALPHA}\\d]*"
|
||||
|
||||
# abs_path = "/" path_segments
|
||||
ret[:ABS_PATH] = abs_path = "/#{path_segments}"
|
||||
|
|
Загрузка…
Ссылка в новой задаче