mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
4cd1cd7201
* regex.c (re_compile_pattern): * \1 .. \9 should be backreferences always. * regex.c (re_match): backreferences corresponding to unclosed/unmatched parentheses should fail always. * string.c (rb_str_cat): use rb_str_buf_cat() if possible. [new] * string.c (rb_str_append): ditto. * string.c (rb_str_buf_cat): remove unnecessary check (type, taint, modify) to gain performance. * string.c (rb_str_buf_append): ditto. * string.c (rb_str_buf_finish): removed. * string.c (rb_str_buf_new): buffering string function. [new] * string.c (rb_str_buf_append): ditto. * string.c (rb_str_buf_cat): ditto. * string.c (rb_str_buf_finish): ditto. * time.c (make_time_t): local time adjustment revised. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1475 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
41 lines
979 B
Ruby
41 lines
979 B
Ruby
require 'resolv'
|
|
|
|
class BasicSocket
|
|
alias original_resolv_send send
|
|
def send(mesg, flags, *rest)
|
|
rest[0] = Resolv.getaddress(rest[0]).to_s if 0 < rest.length
|
|
original_resolv_send(mesg, flags, *rest)
|
|
end
|
|
end
|
|
|
|
class << IPSocket
|
|
alias original_resolv_getaddress getaddress
|
|
def getaddress(host)
|
|
return Resolv.getaddress(host).to_s
|
|
end
|
|
end
|
|
|
|
class << TCPSocket
|
|
alias original_resolv_new new
|
|
def new(host, service)
|
|
original_resolv_new(Resolv.getaddress(host).to_s, service)
|
|
end
|
|
|
|
alias original_resolv_open open
|
|
def open(host, service)
|
|
original_resolv_open(Resolv.getaddress(host).to_s, service)
|
|
end
|
|
end
|
|
|
|
class UDPSocket
|
|
alias original_resolv_connect connect
|
|
def connect(host, port)
|
|
original_resolv_connect(Resolv.getaddress(host).to_s, port)
|
|
end
|
|
|
|
alias original_resolv_send send
|
|
def send(mesg, flags, *rest)
|
|
rest[0] = Resolv.getaddress(rest[0]).to_s if 0 < rest.length
|
|
original_resolv_send(mesg, flags, *rest)
|
|
end
|
|
end
|