summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-09-22 04:30:11 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-09-22 04:30:11 +0000
commit8aad024e3ac6524f8bc09d839a331f926eab30ec (patch)
tree826107ddf61a637dcb32d60f334bf56c27d72dc1 /ext
parent70a444b0cc703a2fd3e05045cd1e36266221149e (diff)
19990922
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/socket/extconf.rb4
-rw-r--r--ext/socket/socket.c9
2 files changed, 11 insertions, 2 deletions
diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb
index 191abf09a6d..f2eddc0bba7 100644
--- a/ext/socket/extconf.rb
+++ b/ext/socket/extconf.rb
@@ -271,7 +271,9 @@ if have_func(test_func)
have_func("uname")
end
if ENV["SOCKS_SERVER"] or enable_config("socks", false)
- if have_library("socks", "Rconnect")
+ if have_library("socks5", "SOCKSinit")
+ $CFLAGS="-DSOCKS5 -DSOCKS"
+ elsif have_library("socks", "Rconnect")
$CFLAGS="-DSOCKS"
end
end
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 4c0934a87bd..3ff6af441e2 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -63,9 +63,13 @@ static VALUE rb_eSocket;
#ifdef SOCKS
VALUE rb_cSOCKSSocket;
+#ifdef SOCKS5
+#include <socks.h>
+#else
void SOCKSinit();
int Rconnect();
#endif
+#endif
#define INET_CLIENT 0
#define INET_SERVER 1
@@ -631,11 +635,14 @@ ruby_connect(fd, sockaddr, len, socks)
# define NONBLOCKING O_NONBLOCK
#endif
#endif
+#ifdef SOCKS5
+ if (!socks)
+#endif
fcntl(fd, F_SETFL, mode|NONBLOCKING);
#endif /* HAVE_FCNTL */
for (;;) {
-#ifdef SOCKS
+#if defined(SOCKS) && !defined(SOCKS5)
if (socks) {
status = Rconnect(fd, sockaddr, len);
}