summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--lib/uri/ftp.rb21
2 files changed, 21 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 2f884147e1..4ec8855d33 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Sun Jun 22 09:01:47 2014 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/uri/ftp.rb (initialize): argument checking flag is arg_check,
+ but arg[-1] is fragment.
+
+ * lib/uri/ftp.rb (initialize): explicitly specify arguments.
+
Sat Jun 21 12:50:32 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/fiddle/extconf.rb: supply 0 to fill RUBY_LIBFFI_MODVERSION
diff --git a/lib/uri/ftp.rb b/lib/uri/ftp.rb
index 0c5b13a1b7..557e1fda33 100644
--- a/lib/uri/ftp.rb
+++ b/lib/uri/ftp.rb
@@ -129,17 +129,24 @@ module URI
# Arguments are +scheme+, +userinfo+, +host+, +port+, +registry+, +path+,
# +opaque+, +query+ and +fragment+, in that order.
#
- def initialize(*arg)
- raise InvalidURIError unless arg[5]
- arg[5] = arg[5].sub(/^\//,'').sub(/^%2F/,'/')
- super(*arg)
+ def initialize(scheme,
+ userinfo, host, port, registry,
+ path, opaque,
+ query,
+ fragment,
+ parser = nil,
+ arg_check = false)
+ raise InvalidURIError unless path
+ path = path.sub(/^\//,'')
+ path.sub!(/^%2F/,'/')
+ super(scheme, userinfo, host, port, registry, path, opaque,
+ query, fragment, parser, arg_check)
@typecode = nil
- tmp = @path.index(TYPECODE_PREFIX)
- if tmp
+ if tmp = @path.index(TYPECODE_PREFIX)
typecode = @path[tmp + TYPECODE_PREFIX.size..-1]
@path = @path[0..tmp - 1]
- if arg[-1]
+ if arg_check
self.typecode = typecode
else
self.set_typecode(typecode)