From e02eb253e7a31f4767eecd8d55a62e5a5608b74a Mon Sep 17 00:00:00 2001 From: naruse Date: Mon, 23 Jun 2014 03:18:51 +0000 Subject: * 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 --- lib/uri/generic.rb | 2 +- lib/uri/rfc3986_parser.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/uri/generic.rb b/lib/uri/generic.rb index b924f53cd7..7fbe5ff396 100644 --- a/lib/uri/generic.rb +++ b/lib/uri/generic.rb @@ -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 diff --git a/lib/uri/rfc3986_parser.rb b/lib/uri/rfc3986_parser.rb index cd95ab8860..aa74e11eb4 100644 --- a/lib/uri/rfc3986_parser.rb +++ b/lib/uri/rfc3986_parser.rb @@ -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 -- cgit v1.2.3