summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-01-03 15:44:54 +0100
committerLudovic Courtès <ludo@gnu.org>2020-01-03 15:44:54 +0100
commitfb7b873afa29f707d74c47ac41153b18cf165737 (patch)
treed57dbc3d864b6682e27fd39d706d0726df713cdb
parentedf5aea7ac852db2356ef36cba4a119eb0c81ea9 (diff)
web: Update comment regarding the 'tls-wrap' port wrapper.
* module/web/client.scm (tls-wrap): Update comment.
-rw-r--r--module/web/client.scm17
1 files changed, 10 insertions, 7 deletions
diff --git a/module/web/client.scm b/module/web/client.scm
index 6c542f981..c777a8d21 100644
--- a/module/web/client.scm
+++ b/module/web/client.scm
@@ -1,6 +1,6 @@
;;; Web client
-;; Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2020 Free Software Foundation, Inc.
;; This library is free software; you can redistribute it and/or
;; modify it under the terms of the GNU Lesser General Public
@@ -131,12 +131,7 @@ host name without trailing dot."
;;(set-log-procedure! log)
(handshake session)
- ;; FIXME: It appears that session-record-port is entirely
- ;; sufficient; it's already a port. The only value of this code is
- ;; to keep a reference on "port", to keep it alive! To fix this we
- ;; need to arrange to either hand GnuTLS its own fd to close, or to
- ;; arrange a reference from the session-record-port to the
- ;; underlying socket.
+
(let ((record (session-record-port session)))
(define (read! bv start count)
(define read-bv (get-bytevector-some record))
@@ -160,7 +155,15 @@ host name without trailing dot."
(close-port port))
(unless (port-closed? record)
(close-port record)))
+
(setvbuf record 'block)
+
+ ;; Return a port that wraps RECORD to ensure that closing it also
+ ;; closes PORT, the actual socket port, and its file descriptor.
+ ;; XXX: This wrapper would be unnecessary if GnuTLS could
+ ;; automatically close SESSION's file descriptor when RECORD is
+ ;; closed, but that doesn't seem to be possible currently (as of
+ ;; 3.6.9).
(make-custom-binary-input/output-port "gnutls wrapped port" read! write!
get-position set-position!
close))))