mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/uri/generic.rb (check_port): allow strings for port= as
described in rdoc. * lib/uri/rfc3986_parser.rb (regexp): implementation detail of above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
66aba8cca2
commit
e02eb253e7
4 changed files with 17 additions and 2 deletions
|
@ -1,3 +1,10 @@
|
|||
Mon Jun 23 12:01:42 2014 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* lib/uri/generic.rb (check_port): allow strings for port= as
|
||||
described in rdoc.
|
||||
|
||||
* lib/uri/rfc3986_parser.rb (regexp): implementation detail of above.
|
||||
|
||||
Mon Jun 23 11:35:01 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* eval.c (setup_exception): set backtrace in system stack error
|
||||
|
|
|
@ -683,7 +683,7 @@ module URI
|
|||
"can not set port with registry or opaque"
|
||||
elsif !v.kind_of?(Fixnum) && parser.regexp[:PORT] !~ v
|
||||
raise InvalidComponentError,
|
||||
"bad component(expected port component): #{v}"
|
||||
"bad component(expected port component): #{v.inspect}"
|
||||
end
|
||||
|
||||
return true
|
||||
|
|
|
@ -84,7 +84,7 @@ module URI
|
|||
QUERY: /\A(?:%\h\h|[!$&-.0-;=@-Z_a-z~]|[\/?])*\z/,
|
||||
FRAGMENT: /\A(?:%\h\h|[!$&-.0-;=@-Z_a-z~]|[\/?])*\z/,
|
||||
OPAQUE: nil,
|
||||
PORT: nil,
|
||||
PORT: /\A[\x09\x0a\x0c\x0d ]*\d*[\x09\x0a\x0c\x0d ]*\z/,
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -697,6 +697,14 @@ class URI::TestGeneric < Test::Unit::TestCase
|
|||
assert_equal('http://foo:bar@baz', uri.to_s)
|
||||
assert_equal('zab', uri.host = 'zab')
|
||||
assert_equal('http://foo:bar@zab', uri.to_s)
|
||||
uri.port = ""
|
||||
assert_nil(uri.port)
|
||||
uri.port = "80"
|
||||
assert_equal(80, uri.port)
|
||||
uri.port = "080"
|
||||
assert_equal(80, uri.port)
|
||||
uri.port = " 080 "
|
||||
assert_equal(80, uri.port)
|
||||
assert_equal(8080, uri.port = 8080)
|
||||
assert_equal('http://foo:bar@zab:8080', uri.to_s)
|
||||
assert_equal('/', uri.path = '/')
|
||||
|
|
Loading…
Add table
Reference in a new issue