Skip to content

Commit

Permalink
Showing 13 changed files with 127 additions and 114 deletions.
6 changes: 3 additions & 3 deletions core/pom.xml
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ DO NOT MODIFIY - GENERATED CODE
<artifactId>jruby-core</artifactId>
<name>JRuby Core</name>
<properties>
<version.ruby>2.3.1</version.ruby>
<version.ruby>2.3.3</version.ruby>
<prawn.dir>${test.dir}/prawn</prawn.dir>
<spec.tags.dir>${spec.dir}/tags</spec.tags.dir>
<polyglot.dump.pom>pom.xml</polyglot.dump.pom>
@@ -27,7 +27,7 @@ DO NOT MODIFIY - GENERATED CODE
<jruby.test.memory.permgen>2G</jruby.test.memory.permgen>
<installer.gems>${jruby.win32ole.gem}</installer.gems>
<prawn.git.repo>git://github.com/sandal/prawn.git</prawn.git.repo>
<version.ruby.minor>1</version.ruby.minor>
<version.ruby.minor>3</version.ruby.minor>
<tzdata.version>2013d</tzdata.version>
<install4j.executable>/Applications/install4j 4/bin/install4jc</install4j.executable>
<jay.bin>jay</jay.bin>
@@ -47,7 +47,7 @@ DO NOT MODIFIY - GENERATED CODE
<parser.dir>core/src/main/java/org/jruby/parser</parser.dir>
<jruby.basedir>${basedir}/..</jruby.basedir>
<rubyspec.dir>${spec.dir}/ruby</rubyspec.dir>
<version.ruby.revision>54768</version.ruby.revision>
<version.ruby.revision>56859</version.ruby.revision>
<jruby.test.memory>3G</jruby.test.memory>
<mspec.dir>${spec.dir}/mspec</mspec.dir>
<build.date>${maven.build.timestamp}</build.date>
6 changes: 3 additions & 3 deletions default.build.properties
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ rake.args=
install4j.executable=/Applications/install4j 4/bin/install4jc

# Ruby versions
version.ruby=2.3.1
version.ruby=2.3.3
version.ruby.major=2.3
version.ruby.minor=1
version.ruby.revision=54768
version.ruby.minor=3
version.ruby.revision=56859
40 changes: 17 additions & 23 deletions lib/ruby/stdlib/drb/timeridconv.rb
Original file line number Diff line number Diff line change
@@ -18,26 +18,27 @@ class TimerHolder2 # :nodoc:

class InvalidIndexError < RuntimeError; end

def initialize(timeout=600)
def initialize(keeping=600)
super()
@sentinel = Object.new
@gc = {}
@curr = {}
@renew = {}
@timeout = timeout
@keeper = keeper
@keeping = keeping
@expires = Time.now + @keeping
end

def add(obj)
synchronize do
rotate
key = obj.__id__
@curr[key] = obj
@renew[key] = obj
return key
end
end

def fetch(key, dv=@sentinel)
synchronize do
rotate
obj = peek(key)
if obj == @sentinel
return dv unless dv == @sentinel
@@ -48,42 +49,35 @@ def fetch(key, dv=@sentinel)
end
end

def include?(key)
synchronize do
obj = peek(key)
return false if obj == @sentinel
true
end
end

private
def peek(key)
synchronize do
return @curr.fetch(key, @renew.fetch(key, @gc.fetch(key, @sentinel)))
return @renew.fetch(key) { @gc.fetch(key, @sentinel) }
end
end

private
def alternate
def rotate
synchronize do
@gc = @curr # GCed
@curr = @renew
return if @expires > Time.now
@gc = @renew # GCed
@renew = {}
@expires = Time.now + @keeping
end
end

def keeper
Thread.new do
loop do
alternate
sleep(@timeout)
rotate
sleep(@keeping)
end
end
end
end

# Creates a new TimerIdConv which will hold objects for +timeout+ seconds.
def initialize(timeout=600)
@holder = TimerHolder2.new(timeout)
# Creates a new TimerIdConv which will hold objects for +keeping+ seconds.
def initialize(keeping=600)
@holder = TimerHolder2.new(keeping)
end

def to_obj(ref) # :nodoc:
4 changes: 2 additions & 2 deletions lib/ruby/stdlib/logger.rb
Original file line number Diff line number Diff line change
@@ -593,8 +593,8 @@ def next_rotate_time(now, shift_age)
when 'weekly'
t = Time.mktime(now.year, now.month, now.mday) + SiD * (7 - now.wday)
when 'monthly'
t = Time.mktime(now.year, now.month, 1) + SiD * 31
return Time.mktime(t.year, t.month, 1) if t.mday > 1
t = Time.mktime(now.year, now.month, 1) + SiD * 32
return Time.mktime(t.year, t.month, 1)
else
return now
end
3 changes: 3 additions & 0 deletions lib/ruby/stdlib/net/ftp.rb
Original file line number Diff line number Diff line change
@@ -295,6 +295,9 @@ def putline(line) # :nodoc:
if @debug_mode
print "put: ", sanitize(line), "\n"
end
if /[\r\n]/ =~ line
raise ArgumentError, "A line must not contain CR or LF"
end
line = line + CRLF
@sock.write(line)
end
2 changes: 1 addition & 1 deletion lib/ruby/stdlib/net/http.rb
Original file line number Diff line number Diff line change
@@ -1447,7 +1447,7 @@ def transport_request(req)
begin
res = HTTPResponse.read_new(@socket)
res.decode_content = req.decode_content
end while res.kind_of?(HTTPContinue)
end while res.kind_of?(HTTPInformation)

res.uri = req.uri

7 changes: 6 additions & 1 deletion lib/ruby/stdlib/net/http/generic_request.rb
Original file line number Diff line number Diff line change
@@ -321,7 +321,12 @@ def wait_for_continue(sock, ver)
end

def write_header(sock, ver, path)
buf = "#{@method} #{path} HTTP/#{ver}\r\n"
reqline = "#{@method} #{path} HTTP/#{ver}"
if /[\r\n]/ =~ reqline
raise ArgumentError, "A Request-Line must not contain CR or LF"
end
buf = ""
buf << reqline << "\r\n"
each_capitalized do |k,v|
buf << "#{k}: #{v}\r\n"
end
165 changes: 86 additions & 79 deletions lib/ruby/stdlib/optparse.rb
Original file line number Diff line number Diff line change
@@ -251,45 +251,31 @@
#
# class ScriptOptions
# attr_accessor :library, :inplace, :encoding, :transfer_type,
# :verbose
# :verbose, :extension, :delay, :time, :record_separator,
# :list
#
# def initialize
# self.library = []
# self.inplace = false
# self.encoding = "utf8"
# self.transfer_type = :auto
# self.verbose = false
# end
# end
#
# #
# # Return a structure describing the options.
# #
# def self.parse(args)
# # The options specified on the command line will be collected in
# # *options*.
#
# @options = ScriptOptions.new
# option_parser.parse!(args)
# @options
# end
#
# attr_reader :parser, :options
#
# def option_parser
# @parser ||= OptionParser.new do |parser|
# def define_options(parser)
# parser.banner = "Usage: example.rb [options]"
# parser.separator ""
# parser.separator "Specific options:"
#
# # add additional options
# perform_inplace_option
# delay_execution_option
# execute_at_time_option
# specify_record_separator_option
# list_example_option
# specify_encoding_option
# optional_option_argument_with_keyword_completion_option
# boolean_verbose_option
# perform_inplace_option(parser)
# delay_execution_option(parser)
# execute_at_time_option(parser)
# specify_record_separator_option(parser)
# list_example_option(parser)
# specify_encoding_option(parser)
# optional_option_argument_with_keyword_completion_option(parser)
# boolean_verbose_option(parser)
#
# parser.separator ""
# parser.separator "Common options:"
@@ -305,80 +291,95 @@
# exit
# end
# end
# end
#
# def perform_inplace_option
# # Specifies an optional option argument
# parser.on("-i", "--inplace [EXTENSION]",
# "Edit ARGV files in place",
# " (make backup if EXTENSION supplied)") do |ext|
# options.inplace = true
# options.extension = ext || ''
# options.extension.sub!(/\A\.?(?=.)/, ".") # Ensure extension begins with dot.
# def perform_inplace_option(parser)
# # Specifies an optional option argument
# parser.on("-i", "--inplace [EXTENSION]",
# "Edit ARGV files in place",
# "(make backup if EXTENSION supplied)") do |ext|
# self.inplace = true
# self.extension = ext || ''
# self.extension.sub!(/\A\.?(?=.)/, ".") # Ensure extension begins with dot.
# end
# end
# end
#
# def delay_execution_option
# # Cast 'delay' argument to a Float.
# parser.on("--delay N", Float, "Delay N seconds before executing") do |n|
# options.delay = n
# def delay_execution_option(parser)
# # Cast 'delay' argument to a Float.
# parser.on("--delay N", Float, "Delay N seconds before executing") do |n|
# self.delay = n
# end
# end
# end
#
# def execute_at_time_option
# # Cast 'time' argument to a Time object.
# parser.on("-t", "--time [TIME]", Time, "Begin execution at given time") do |time|
# options.time = time
# def execute_at_time_option(parser)
# # Cast 'time' argument to a Time object.
# parser.on("-t", "--time [TIME]", Time, "Begin execution at given time") do |time|
# self.time = time
# end
# end
# end
#
#
# def specify_record_separator_option
# # Cast to octal integer.
# parser.on("-F", "--irs [OCTAL]", OptionParser::OctalInteger,
# "Specify record separator (default \\0)") do |rs|
# options.record_separator = rs
# def specify_record_separator_option(parser)
# # Cast to octal integer.
# parser.on("-F", "--irs [OCTAL]", OptionParser::OctalInteger,
# "Specify record separator (default \\0)") do |rs|
# self.record_separator = rs
# end
# end
# end
#
# def list_example_option
# # List of arguments.
# parser.on("--list x,y,z", Array, "Example 'list' of arguments") do |list|
# options.list = list
# def list_example_option(parser)
# # List of arguments.
# parser.on("--list x,y,z", Array, "Example 'list' of arguments") do |list|
# self.list = list
# end
# end
# end
#
# def specify_encoding_option
# # Keyword completion. We are specifying a specific set of arguments (CODES
# # and CODE_ALIASES - notice the latter is a Hash), and the user may provide
# # the shortest unambiguous text.
# code_list = (CODE_ALIASES.keys + CODES).join(',')
# parser.on("--code CODE", CODES, CODE_ALIASES, "Select encoding",
# " (#{code_list})") do |encoding|
# options.encoding = encoding
# def specify_encoding_option(parser)
# # Keyword completion. We are specifying a specific set of arguments (CODES
# # and CODE_ALIASES - notice the latter is a Hash), and the user may provide
# # the shortest unambiguous text.
# code_list = (CODE_ALIASES.keys + CODES).join(', ')
# parser.on("--code CODE", CODES, CODE_ALIASES, "Select encoding",
# "(#{code_list})") do |encoding|
# self.encoding = encoding
# end
# end
# end
#
# def optional_option_argument_with_keyword_completion_option(parser)
# # Optional '--type' option argument with keyword completion.
# parser.on("--type [TYPE]", [:text, :binary, :auto],
# "Select transfer type (text, binary, auto)") do |t|
# self.transfer_type = t
# end
# end
#
# def optional_option_argument_with_keyword_completion_option
# # Optional '--type' option argument with keyword completion.
# parser.on("--type [TYPE]", [:text, :binary, :auto],
# "Select transfer type (text, binary, auto)") do |t|
# options.transfer_type = t
# def boolean_verbose_option(parser)
# # Boolean switch.
# parser.on("-v", "--[no-]verbose", "Run verbosely") do |v|
# self.verbose = v
# end
# end
# end
#
# #
# # Return a structure describing the options.
# #
# def parse(args)
# # The options specified on the command line will be collected in
# # *options*.
#
# def boolean_verbose_option
# # Boolean switch.
# parser.on("-v", "--[no-]verbose", "Run verbosely") do |v|
# options.verbose = v
# @options = ScriptOptions.new
# @args = OptionParser.new do |parser|
# @options.define_options(parser)
# parser.parse!(args)
# end
# @options
# end
#
# attr_reader :parser, :options
# end # class OptparseExample
# options = OptparseExample.parse(ARGV)
# pp options
#
# example = OptparseExample.new
# options = example.parse(ARGV)
# pp options # example.options
# pp ARGV
#
# === Shell Completion
@@ -412,7 +413,7 @@ def self.candidate(key, icase = false, pat = nil, &block)
candidates = []
block.call do |k, *v|
(if Regexp === k
kn = nil
kn = "".freeze
k === key
else
kn = defined?(k.id2name) ? k.id2name : k
@@ -1335,6 +1336,7 @@ def make_switch(opts, block = nil)
default_pattern = nil
klass = nil
q, a = nil
has_arg = false

opts.each do |o|
# argument class
@@ -1413,6 +1415,8 @@ def make_switch(opts, block = nil)
if a
default_style = default_style.guess(arg = a)
default_pattern, conv = search(:atype, o) unless default_pattern
else
has_arg = true
end
sdesc << "-#{q}"
short << Regexp.new(q)
@@ -1435,6 +1439,9 @@ def make_switch(opts, block = nil)

default_pattern, conv = search(:atype, default_style.pattern) unless default_pattern
if !(short.empty? and long.empty?)
if has_arg and default_style == Switch::NoArgument
default_style = Switch::RequiredArgument
end
s = (style || default_style).new(pattern || default_pattern,
conv, sdesc, ldesc, arg, desc, block)
elsif !block
2 changes: 1 addition & 1 deletion lib/ruby/stdlib/rexml/attribute.rb
Original file line number Diff line number Diff line change
@@ -110,7 +110,7 @@ def hash
# b.to_string # -> "ns:x='y'"
def to_string
if @element and @element.context and @element.context[:attribute_quote] == :quote
%Q^#@expanded_name="#{to_s().gsub(/"/, '&quote;')}"^
%Q^#@expanded_name="#{to_s().gsub(/"/, '&quot;')}"^
else
"#@expanded_name='#{to_s().gsub(/'/, '&apos;')}'"
end
2 changes: 1 addition & 1 deletion lib/ruby/stdlib/uri/generic.rb
Original file line number Diff line number Diff line change
@@ -428,7 +428,7 @@ def check_password(v, user = @user)

if parser.regexp[:USERINFO] !~ v
raise InvalidComponentError,
"bad component(expected user component): #{v}"
"bad password component"
end

return true
3 changes: 3 additions & 0 deletions lib/ruby/stdlib/uri/mailto.rb
Original file line number Diff line number Diff line change
@@ -136,6 +136,9 @@ def initialize(*arg)
@to = nil
@headers = []

# The RFC3986 parser does not normally populate opaque
@opaque = "?#{@query}" if @query && !@opaque

unless @opaque
raise InvalidComponentError,
"missing opaque part for mailto URL"
1 change: 1 addition & 0 deletions lib/ruby/stdlib/webrick/httpservlet/cgihandler.rb
Original file line number Diff line number Diff line change
@@ -52,6 +52,7 @@ def do_GET(req, res)
meta = req.meta_vars
meta["SCRIPT_FILENAME"] = @script_filename
meta["PATH"] = @config[:CGIPathEnv]
meta.delete("HTTP_PROXY")
if /mswin|bccwin|mingw/ =~ RUBY_PLATFORM
meta["SystemRoot"] = ENV["SystemRoot"]
end
File renamed without changes.

0 comments on commit 36dc548

Please sign in to comment.