bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#22789: 25.1.50; In last master build https connections stop working


From: Alain Schneble
Subject: bug#22789: 25.1.50; In last master build https connections stop working
Date: Mon, 7 Mar 2016 00:24:35 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (windows-nt)

Alain Schneble <a.s@realize.ch> writes:

> I'll send a patch for further discussions shortly.

And here it is.  The fix is quite simple.  It ensures that sys_write
exits before touching the socket if it is not connected yet.
Unfortunately I didn't find any documentation on winsock ioctlsocket
that would prove that this is indeed required.  But it seems not wrong
to me anyway.  (I'll try to search the wisock documentation tomorrow to
find some hints that lead in this direction, or maybe you know?)

>From 01a475ea41265929951e6d14f6dd216671b63331 Mon Sep 17 00:00:00 2001
From: Alain Schneble <a.s@realize.ch>
Date: Mon, 7 Mar 2016 00:00:57 +0100
Subject: [PATCH] Solve async GnuTLS handshake issue on w32

* src/w32.c (sys_write): For non-blocking sockets, return immediately
with EWOULDBLOCK.  This ensures we do not temporarily turn the socket
into blocking mode for the pfn_send call if the socket is not (yet)
connected.  It turned out that doing so causes arbitrary GnuTLS
handshake failures on MS-Windows.  (bug#22789)
---
 src/w32.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/w32.c b/src/w32.c
index 998f696..ee8cf6c 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -8647,6 +8647,12 @@ sys_write (int fd, const void * buffer, unsigned int 
count)
       unsigned long nblock = 0;
       if (winsock_lib == NULL) emacs_abort ();
 
+      if ((fd_info[fd].flags & FILE_CONNECT) != 0)
+       {
+         errno = EWOULDBLOCK;
+         return -1;
+       }
+
       /* TODO: implement select() properly so non-blocking I/O works. */
       /* For now, make sure the write blocks.  */
       if (fd_info[fd].flags & FILE_NDELAY)
-- 
2.6.2.windows.1


reply via email to

[Prev in Thread] Current Thread [Next in Thread]