summaryrefslogtreecommitdiff
path: root/ext/openssl/ossl_ssl.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-25 16:40:26 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-25 16:40:26 +0000
commit2b15bd05d3ec35390b07e1305a118040a4c320b3 (patch)
treec5d2ce933fd4d983fd195c215abd867b9329f3c3 /ext/openssl/ossl_ssl.c
parentec75bfe3646c00f20cab7c9c154318609b3cf41d (diff)
* ext/openssl/ossl_ssl.c (ossl_ssl_setup): need to pass the real
socket to SSL_get_fd on native win32 platforms. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/ossl_ssl.c')
-rw-r--r--ext/openssl/ossl_ssl.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c
index e4fb0bf..387b71c 100644
--- a/ext/openssl/ossl_ssl.c
+++ b/ext/openssl/ossl_ssl.c
@@ -19,6 +19,12 @@
#define numberof(ary) (sizeof(ary)/sizeof(ary[0]))
+#ifdef OPENSSL_SYS_WINDOWS
+# define TO_SOCKET(s) _get_osfhandle(s)
+#else
+# define TO_SOCKET(s) s
+#endif
+
VALUE mSSL;
VALUE eSSLError;
VALUE cSSLContext;
@@ -392,7 +398,7 @@ ossl_ssl_setup(VALUE self)
GetOpenFile(io, fptr);
rb_io_check_readable(fptr);
rb_io_check_writable(fptr);
- SSL_set_fd(ssl, fileno(fptr->f));
+ SSL_set_fd(ssl, TO_SOCKET(fileno(fptr->f)));
}
return Qtrue;