GNU bug report logs - #70645
Reliable HTTPS networking

Previous Next

Package: guile;

Reported by: Christopher Baines <mail <at> cbaines.net>

Date: Mon, 29 Apr 2024 10:53:02 UTC

Severity: normal

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: Christopher Baines <mail <at> cbaines.net>
Cc: 70645 <at> debbugs.gnu.org
Subject: bug#70645: Reliable HTTPS networking
Date: Wed, 26 Feb 2025 16:15:05 +0100
Christopher Baines <mail <at> cbaines.net> skribis:

> As described in the GnuTLS documentation on Asynchronous operation,
> GNUTLS_NONBLOCK should be passed to gnutls_init, and the Guile
> equivalent is passing connection-flag/nonblock to make-session.
>
> Additionally, error/again or error/interrupted should lead to a retry of
> the handshake, after waiting for the appropriate I/O on the port.  As
> record-get-direction is new in Guile-GnuTLS, specifically check if this
> is defined.
>
> * module/web/client.scm (tls-wrap): Call make-session with
> connection-flag/nonblock if the port is non-blocking, and handle waiting
> for I/O when performing the handshake.

[...]

> +  (let ((session
> +         (apply
> +          make-session
> +          (cons connection-end/client
> +                (if (zero? (logand O_NONBLOCK (fcntl port F_GETFL)))
> +                    '()
> +                    ;; If the port is non-blocking, tell GnuTLS
> +                    (list connection-flag/nonblock)))))

You can avoid ‘cons’ here:

  (apply make-session connection-end/client
         (if … '() (list …)))

> +          (cond ((and
> +                  (or (eq? err error/again)
> +                      (eq? err error/interrupted))
> +                  (module-defined? (resolve-interface '(gnutls))
> +                                   'record-get-direction)) ; Guile-GnuTLS >= 4.0.0
> +                 (if (= 0 (record-get-direction session))
> +                     ((current-read-waiter) port)
> +                     ((current-write-waiter) port))

Should EINTR (error/interrupted) really be treated in the same way as
EAGAIN?  That looks fishy.

Also, this only addresses handshake, but what about ‘error/again’ raise
while transferring data over the session record port?

Thanks,
Ludo’ “better late than never”.




This bug report was last modified 107 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.