mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/resolv-replace.rb: 1.8 compliance. [ruby-talk:82946]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
13391b4047
commit
dfe0aab04f
3 changed files with 25 additions and 12 deletions
|
@ -1,3 +1,7 @@
|
|||
Fri Sep 26 18:35:40 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* lib/resolv-replace.rb: 1.8 compliance. [ruby-talk:82946]
|
||||
|
||||
Mon Sep 26 17:39:27 2003 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
|
||||
|
||||
* test/ruby/test_marshal.rb: add test for ruby's objects.
|
||||
|
|
|
@ -144,7 +144,7 @@ flush_register_windows(void)
|
|||
volatile
|
||||
#endif
|
||||
# if defined(__sparc_v9__) || defined(__sparcv9) || defined(__arch64__)
|
||||
("flushw" : :)
|
||||
("flushw")
|
||||
# elif defined(linux) || defined(__linux__)
|
||||
("ta 0x83")
|
||||
# else /* Solaris, OpenBSD, NetBSD, etc. */
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
require 'socket'
|
||||
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
|
||||
rest[0] = Resolv.getaddress(rest[0]).to_s unless rest.empty?
|
||||
original_resolv_send(mesg, flags, *rest)
|
||||
end
|
||||
end
|
||||
|
@ -15,19 +16,20 @@ class << IPSocket
|
|||
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)
|
||||
class TCPSocket
|
||||
alias original_resolv_initialize initialize
|
||||
def initialize(host, serv, *rest)
|
||||
rest[0] = Resolv.getaddress(rest[0]).to_s unless rest.empty?
|
||||
original_resolv_initialize(Resolv.getaddress(host).to_s, serv, *rest)
|
||||
end
|
||||
end
|
||||
|
||||
class UDPSocket
|
||||
alias original_resolv_bind bind
|
||||
def bind(host, port)
|
||||
original_resolv_bind(Resolv.getaddress(host).to_s, port)
|
||||
end
|
||||
|
||||
alias original_resolv_connect connect
|
||||
def connect(host, port)
|
||||
original_resolv_connect(Resolv.getaddress(host).to_s, port)
|
||||
|
@ -35,7 +37,14 @@ class UDPSocket
|
|||
|
||||
alias original_resolv_send send
|
||||
def send(mesg, flags, *rest)
|
||||
rest[0] = Resolv.getaddress(rest[0]).to_s if 0 < rest.length
|
||||
rest[0] = Resolv.getaddress(rest[0]).to_s unless rest.empty?
|
||||
original_resolv_send(mesg, flags, *rest)
|
||||
end
|
||||
end
|
||||
|
||||
class SOCKSSocket
|
||||
alias original_resolv_initialize initialize
|
||||
def initialize(host, serv)
|
||||
original_resolv_initialize(Resolv.getaddress(host).to_s, port)
|
||||
end
|
||||
end if defined? SOCKSSocket
|
||||
|
|
Loading…
Reference in a new issue