Function: starttls-open-stream-gnutls

starttls-open-stream-gnutls is a byte-compiled function defined in starttls.el.gz.

Signature

(starttls-open-stream-gnutls NAME BUFFER HOST PORT)

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/starttls.el.gz
(defun starttls-open-stream-gnutls (name buffer host port)
  (message "Opening STARTTLS connection to `%s:%s'..." host port)
  (let* (done
	 (old-max (with-current-buffer buffer (point-max)))
	 (process-connection-type starttls-process-connection-type)
	 (process (apply #'start-process name buffer
			 starttls-gnutls-program "-s" host
			 "-p" (if (integerp port)
				  (int-to-string port)
				port)
			 starttls-extra-arguments)))
    (set-process-query-on-exit-flag process nil)
    (while (and (processp process)
		(eq (process-status process) 'run)
		(with-current-buffer buffer
		  (goto-char old-max)
		  (not (setq done (re-search-forward
				   starttls-connect nil t)))))
      (accept-process-output process 0.1)
      (sit-for 0.1))
    (if done
	(with-current-buffer buffer
	  (delete-region old-max done))
      (delete-process process)
      (setq process nil))
    (message "Opening STARTTLS connection to `%s:%s'...%s"
	     host port (if done "done" "failed"))
    process))