about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--CHANGES5
-rw-r--r--src/tidy_tls.c22
2 files changed, 24 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index cd207d29..09a4ce64 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,9 +1,10 @@
--- $LynxId: CHANGES,v 1.1047 2020/03/01 13:59:22 tom Exp $
+-- $LynxId: CHANGES,v 1.1048 2020/03/03 11:46:07 tom Exp $
 ===============================================================================
 Changes since Lynx 2.8 release
 ===============================================================================
 
-2020-02-27 (2.9.0dev.6)
+2020-03-03 (2.9.0dev.6)
+* add Windows-specific initialization in tidy_tls.c -GV
 * update eo.po from
     http://translationproject.org/latest/lynx
 
diff --git a/src/tidy_tls.c b/src/tidy_tls.c
index c9d78e45..b0288fb8 100644
--- a/src/tidy_tls.c
+++ b/src/tidy_tls.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: tidy_tls.c,v 1.40 2020/01/21 22:26:43 tom Exp $
+ * $LynxId: tidy_tls.c,v 1.41 2020/03/03 11:46:07 Gisle.Vanem Exp $
  * Copyright 2008-2019,2020 Thomas E. Dickey
  * with fix Copyright 2008 by Thomas Viehmann
  *
@@ -499,12 +499,32 @@ int SSL_read(SSL * ssl, void *buffer, int length)
     return rc;
 }
 
+#ifdef _WINDOWS
+static int Lynx_gtls_push(void *s, const void *buf, size_t len)
+{
+    return NETWRITE((SOCKET) s, buf, len);
+}
+
+/* This calls 'recv()' in a thread for every GnuTls pull. Maybe too much overhead?
+ */
+static int Lynx_gtls_pull(void *s, void *buf, size_t len)
+{
+    return NETREAD((SOCKET) s, buf, len);
+}
+#endif
+
 /*
  * Connect the SSL object with a file descriptor.
  * This always returns 1 (success) since GNU TLS does not check for errors.
  */
 int SSL_set_fd(SSL * ssl, int fd)
 {
+#ifdef _WINDOWS
+    /* register callback functions to send and receive data. */
+    gnutls_transport_set_push_function(ssl->gnutls_state, Lynx_gtls_push);
+    gnutls_transport_set_pull_function(ssl->gnutls_state, Lynx_gtls_pull);
+#endif
+
     gnutls_transport_set_ptr(ssl->gnutls_state,
 			     (gnutls_transport_ptr_t) (intptr_t) (fd));
     return 1;