comparison lisp/net/tls.el @ 80351:ce20bc1998a8

(open-tls-stream): Reindent.
author Reiner Steib <Reiner.Steib@gmx.de>
date Wed, 19 Mar 2008 21:29:41 +0000
parents af4d6ac258a1
children
comparison
equal deleted inserted replaced
80350:af4d6ac258a1 80351:ce20bc1998a8
153 process cmd done) 153 process cmd done)
154 (if use-temp-buffer 154 (if use-temp-buffer
155 (setq buffer (generate-new-buffer " TLS"))) 155 (setq buffer (generate-new-buffer " TLS")))
156 (with-current-buffer buffer 156 (with-current-buffer buffer
157 (message "Opening TLS connection to `%s'..." host) 157 (message "Opening TLS connection to `%s'..." host)
158 (while (and (not done) (setq cmd (pop cmds))) 158 (while (and (not done) (setq cmd (pop cmds)))
159 (message "Opening TLS connection with `%s'..." cmd) 159 (message "Opening TLS connection with `%s'..." cmd)
160 (let ((process-connection-type tls-process-connection-type) 160 (let ((process-connection-type tls-process-connection-type)
161 response) 161 response)
162 (setq process (start-process 162 (setq process (start-process
163 name buffer shell-file-name shell-command-switch 163 name buffer shell-file-name shell-command-switch
164 (format-spec 164 (format-spec
165 cmd 165 cmd
166 (format-spec-make 166 (format-spec-make
167 ?h host 167 ?h host
168 ?p (if (integerp port) 168 ?p (if (integerp port)
169 (int-to-string port) 169 (int-to-string port)
170 port))))) 170 port)))))
171 (while (and process 171 (while (and process
172 (memq (process-status process) '(open run)) 172 (memq (process-status process) '(open run))
173 (progn 173 (progn
174 (goto-char (point-min)) 174 (goto-char (point-min))
175 (not (setq done (re-search-forward tls-success nil t))))) 175 (not (setq done (re-search-forward tls-success nil t)))))
176 (unless (accept-process-output process 1) 176 (unless (accept-process-output process 1)
177 (sit-for 1))) 177 (sit-for 1)))
178 (message "Opening TLS connection with `%s'...%s" cmd 178 (message "Opening TLS connection with `%s'...%s" cmd
179 (if done "done" "failed")) 179 (if done "done" "failed"))
180 (if (not done) 180 (if (not done)
181 (delete-process process) 181 (delete-process process)
182 ;; advance point to after all informational messages that 182 ;; advance point to after all informational messages that
183 ;; `openssl s_client' and `gnutls' print 183 ;; `openssl s_client' and `gnutls' print
184 (let ((start-of-data nil)) 184 (let ((start-of-data nil))
185 (while 185 (while
186 (not (setq start-of-data 186 (not (setq start-of-data
187 ;; the string matching `tls-end-of-info' 187 ;; the string matching `tls-end-of-info'
188 ;; might come in separate chunks from 188 ;; might come in separate chunks from
189 ;; `accept-process-output', so start the 189 ;; `accept-process-output', so start the
190 ;; search where `tls-success' ended 190 ;; search where `tls-success' ended
191 (save-excursion 191 (save-excursion
192 (if (re-search-forward tls-end-of-info nil t) 192 (if (re-search-forward tls-end-of-info nil t)
193 (match-end 0))))) 193 (match-end 0)))))
194 (accept-process-output process 1)) 194 (accept-process-output process 1))
195 (if start-of-data 195 (if start-of-data
196 ;; move point to start of client data 196 ;; move point to start of client data
197 (goto-char start-of-data))) 197 (goto-char start-of-data)))
198 (setq done process)))) 198 (setq done process))))
199 (message "Opening TLS connection to `%s'...%s" 199 (message "Opening TLS connection to `%s'...%s"
200 host (if done "done" "failed"))) 200 host (if done "done" "failed")))
201 (when use-temp-buffer 201 (when use-temp-buffer
202 (if done (set-process-buffer process nil)) 202 (if done (set-process-buffer process nil))
203 (kill-buffer buffer)) 203 (kill-buffer buffer))
204 done)) 204 done))
205 205