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: Lars Ingebrigtsen
Subject: bug#22789: 25.1.50; In last master build https connections stop working
Date: Fri, 26 Feb 2016 12:59:39 +1030
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

> It stays "connect" forever.  But "netstat" doesn't show any
> connections to that server, AFAICT.  I think the connection simply
> doesn't begin.

Hm...  when you mentioned that the Windows GnuTLS functions used our own
functions for the actual pull/push, I thought that perhaps the problem
was there (and was about to suggest the patch below), but this must mean
that the socket isn't even created.

`make-network-socket' ends with

#ifdef HAVE_GETADDRINFO_A
  /* If we're doing async address resolution, the list of addresses
     here will be nil, so we postpone connecting to the server. */
  if (!p->is_server && NILP (ip_addresses))
    {
      p->dns_request = dns_request;
      p->status = Qconnect;
    }
  else
    {
      connect_network_socket (proc, ip_addresses);
    }
#else /* HAVE_GETADDRINFO_A */
  connect_network_socket (proc, ip_addresses);
#endif

so that should happen unconditionally on Windows.

Let's see...

Oh!  This code in connect_network_socket looks suspect, perhaps.  If it
fails, then the socket will never actually be created...  hm...  but it
may be caught later...  and it doesn't explain why non-blocking non-TLS
sockets still work...  so it can't be that...

#ifdef NON_BLOCKING_CONNECT
      if (p->is_non_blocking_client)
        {
          ret = fcntl (s, F_SETFL, O_NONBLOCK);
          if (ret < 0)
            {
              xerrno = errno;
              emacs_close (s);
              s = -1;
              continue;
            }
        }
#endif

So perhaps it's in the TLS code anyway.  Could you try the following
code?  It'll make TLS negotiation blocking on WINDOWSNT again.

> Btw, one other difference of the Windows build, this time wrt GnuTLS,
> is that on Windows we instruct GnuTLS to use our own pull and push
> functions, see gnutls.c around line 450.  The functions themselves are
> defined in w32.c, at the end.

diff --git a/src/gnutls.c b/src/gnutls.c
index d1b34c5..00d0e56 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -410,12 +410,17 @@ gnutls_try_handshake (struct Lisp_Process *proc)
       QUIT;
     }
   while (ret < 0 && gnutls_error_is_fatal (ret) == 0
-        && ! proc->is_non_blocking_client);
+#ifndef WINDOWSNT
+        && ! proc->is_non_blocking_client
+#endif
+        );
 
   proc->gnutls_initstage = GNUTLS_STAGE_HANDSHAKE_TRIED;
 
+#ifndef WINDOWSNT
   if (proc->is_non_blocking_client)
     proc->gnutls_p = true;
+#endif
 
   if (ret == GNUTLS_E_SUCCESS)
     {

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

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