mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-27 07:37:33 +00:00
Add :coding support to open-network-stream and open-gnutls-stream
* doc/lispref/processes.texi (Network): Describe :coding keyword support. * doc/misc/emacs-gnutls.texi (Help For Developers): Describe :coding keyword support. * etc/NEWS: Announce change to open-network-stream and open-gnutls-stream. * lisp/net/gnutls.el (open-gnutls-stream): Add support for :coding, pass it down to open-network-stream. * lisp/net/network-stream.el (open-network-stream) (network-stream-open-plain, network-stream-open-starttls): Add support for :coding, pass it down to make-network-process. (network-stream-open-shell): Add support-for :coding, use set-process-coding-system to set it after process creation.
This commit is contained in:
parent
23b04ef0e7
commit
6382e13308
@ -2463,6 +2463,12 @@ that are mainly relevant to encrypted connections:
|
||||
@item :nowait @var{boolean}
|
||||
If non-@code{nil}, try to make an asynchronous connection.
|
||||
|
||||
@item :coding @var{coding}
|
||||
Use this to set the coding systems used by the network process, in
|
||||
preference to binding @code{coding-system-for-read} or
|
||||
@code{coding-system-for-write}. @xref{Network Processes} for
|
||||
details.
|
||||
|
||||
@item :type @var{type}
|
||||
The type of connection. Options are:
|
||||
|
||||
|
@ -190,7 +190,7 @@ the connection process.
|
||||
|
||||
The optional @var{parameters} argument is a list of keywords and
|
||||
values. The only keywords which currently have any effect are
|
||||
@code{:client-certificate} and @code{:nowait}.
|
||||
@code{:client-certificate}, @code{:nowait}, and @code{:coding}.
|
||||
|
||||
Passing @w{@code{:client certificate t}} triggers looking up of client
|
||||
certificates matching @var{host} and @var{service} using the
|
||||
|
9
etc/NEWS
9
etc/NEWS
@ -339,6 +339,15 @@ Emacs depended on the previous behavior; if you really want the
|
||||
process' coding-system to be nil, use 'set-process-coding-system'
|
||||
after the process has been created, or pass in ":coding '(nil nil)".
|
||||
|
||||
+++
|
||||
** 'open-network-stream' now accepts a :coding argument.
|
||||
This allows specifying the coding systems used by a network process
|
||||
for encoding and decoding without having to bind
|
||||
coding-system-for-{read,write} or call 'set-process-coding-system'.
|
||||
|
||||
+++
|
||||
** 'open-gnutls-stream' now also accepts a :coding argument.
|
||||
|
||||
|
||||
* Changes in Emacs 28.1 on Non-Free Operating Systems
|
||||
|
||||
|
@ -169,8 +169,9 @@ Third arg HOST is the name of the host to connect to, or its IP address.
|
||||
Fourth arg SERVICE is the name of the service desired, or an integer
|
||||
specifying a port number to connect to.
|
||||
Fifth arg PARAMETERS is an optional list of keyword/value pairs.
|
||||
Only :client-certificate and :nowait keywords are recognized, and
|
||||
have the same meaning as for `open-network-stream'.
|
||||
Only :client-certificate, :nowait, and :coding keywords are
|
||||
recognized, and have the same meaning as for
|
||||
`open-network-stream'.
|
||||
For historical reasons PARAMETERS can also be a symbol, which is
|
||||
interpreted the same as passing a list containing :nowait and the
|
||||
value of that symbol.
|
||||
@ -208,7 +209,8 @@ trust and key files, and priority string."
|
||||
(gnutls-boot-parameters
|
||||
:type 'gnutls-x509pki
|
||||
:keylist keylist
|
||||
:hostname (puny-encode-domain host)))))))
|
||||
:hostname (puny-encode-domain host))))
|
||||
:coding (plist-get parameters :coding))))
|
||||
(if nowait
|
||||
process
|
||||
(gnutls-negotiate :process process
|
||||
|
@ -113,6 +113,10 @@ values:
|
||||
`ssl' -- Equivalent to `tls'.
|
||||
`shell' -- A shell connection.
|
||||
|
||||
:coding is a symbol or a cons used to specify the coding systems
|
||||
used to decode and encode the data which the process reads and
|
||||
writes. See `make-network-process' for details.
|
||||
|
||||
:return-list specifies this function's return value.
|
||||
If omitted or nil, return a process object. A non-nil means to
|
||||
return (PROC . PROPS), where PROC is a process object and PROPS
|
||||
@ -189,7 +193,8 @@ gnutls-boot (as returned by `gnutls-boot-parameters')."
|
||||
:host (puny-encode-domain host) :service service
|
||||
:nowait (plist-get parameters :nowait)
|
||||
:tls-parameters
|
||||
(plist-get parameters :tls-parameters))
|
||||
(plist-get parameters :tls-parameters)
|
||||
:coding (plist-get parameters :coding))
|
||||
(let ((work-buffer (or buffer
|
||||
(generate-new-buffer " *stream buffer*")))
|
||||
(fun (cond ((and (eq type 'plain)
|
||||
@ -249,7 +254,8 @@ gnutls-boot (as returned by `gnutls-boot-parameters')."
|
||||
(stream (make-network-process :name name :buffer buffer
|
||||
:host (puny-encode-domain host)
|
||||
:service service
|
||||
:nowait (plist-get parameters :nowait))))
|
||||
:nowait (plist-get parameters :nowait)
|
||||
:coding (plist-get parameters :coding))))
|
||||
(when (plist-get parameters :warn-unless-encrypted)
|
||||
(setq stream (nsm-verify-connection stream host service nil t)))
|
||||
(list stream
|
||||
@ -270,7 +276,8 @@ gnutls-boot (as returned by `gnutls-boot-parameters')."
|
||||
;; Return (STREAM GREETING CAPABILITIES RESULTING-TYPE)
|
||||
(stream (make-network-process :name name :buffer buffer
|
||||
:host (puny-encode-domain host)
|
||||
:service service))
|
||||
:service service
|
||||
:coding (plist-get parameters :coding)))
|
||||
(greeting (and (not (plist-get parameters :nogreeting))
|
||||
(network-stream-get-response stream start eoc)))
|
||||
(capabilities (network-stream-command stream capability-command
|
||||
@ -350,7 +357,8 @@ gnutls-boot (as returned by `gnutls-boot-parameters')."
|
||||
(setq stream
|
||||
(make-network-process :name name :buffer buffer
|
||||
:host (puny-encode-domain host)
|
||||
:service service))
|
||||
:service service
|
||||
:coding (plist-get parameters :coding)))
|
||||
(network-stream-get-response stream start eoc)))
|
||||
(unless (process-live-p stream)
|
||||
(error "Unable to negotiate a TLS connection with %s/%s"
|
||||
@ -453,6 +461,7 @@ gnutls-boot (as returned by `gnutls-boot-parameters')."
|
||||
(let* ((capability-command (plist-get parameters :capability-command))
|
||||
(eoc (plist-get parameters :end-of-command))
|
||||
(start (with-current-buffer buffer (point)))
|
||||
(coding (plist-get parameters :coding))
|
||||
(stream (let ((process-connection-type nil))
|
||||
(start-process name buffer shell-file-name
|
||||
shell-command-switch
|
||||
@ -461,6 +470,13 @@ gnutls-boot (as returned by `gnutls-boot-parameters')."
|
||||
(format-spec-make
|
||||
?s host
|
||||
?p service))))))
|
||||
(when coding (if (consp coding)
|
||||
(set-process-coding-system stream
|
||||
(car coding)
|
||||
(cdr coding))
|
||||
(set-process-coding-system stream
|
||||
coding
|
||||
coding)))
|
||||
(list stream
|
||||
(network-stream-get-response stream start eoc)
|
||||
(network-stream-command stream capability-command
|
||||
|
Loading…
Reference in New Issue
Block a user