Kamil Dudka wrote:
> On Saturday, November 4, 2017 11:16:17 PM CET Felix Janda wrote:
> > Below is a hacky patch that makes elinks using gnutls load
> > https://tracker.debian.org/mlterm.
> > 
> > It would be cleaner to use gnutls_handshake_set_timeout().
> > 
> > diff --git a/src/network/ssl/socket.c b/src/network/ssl/socket.c
> > index 23273046..4627629b 100644
> > --- a/src/network/ssl/socket.c
> > +++ b/src/network/ssl/socket.c
> > @@ -553,8 +553,10 @@ ssl_read(struct socket *socket, unsigned char *data,
> > int len) #endif
> > 
> >  #ifdef CONFIG_GNUTLS
> > -           if (err == GNUTLS_E_REHANDSHAKE)
> > -                   return -1;
> > +           if (err == GNUTLS_E_REHANDSHAKE) {
> > +                   while (ssl_do_connect(socket) == SSL_ERROR_WANT_READ);
> > +                   return ssl_read(socket, data, len);
> > +           }
> >  #endif
> > 
> >             if (err == SSL_ERROR_WANT_READ ||
> 
> Not that I know gnutls API but the fix does not look correct...
> 
> Would not it busy loop until the needed data arrives over the network?

Essentially yes, which is why I called it a "hacky patch". Note that
ssl_do_connect is the same thing as gnutls_handshake and
SSL_ERROR_WANT_READ is GNUTLS_E_AGAIN. I am too inexperienced with
gnutls and elinks to fix this cleanly.

Felix
-- 
http://lists.linuxfromscratch.org/listinfo/elinks-dev
Unsubscribe: See the above information page

Reply via email to