diff options
author | Devon Sean McCullough <emacs-hacker2012@jovi.net> | 2012-03-11 17:43:01 +0800 |
---|---|---|
committer | Chong Yidong <cyd@gnu.org> | 2012-03-11 17:43:01 +0800 |
commit | 179f69112df62a6ed2aeefb53d900c4dc9cd0e81 (patch) | |
tree | 0819f0237efa92716c45ba8b1a3a47941de8f021 /lisp/url/url-http.el | |
parent | dbf6c5a160bd52f5025c45a6babbb7ca33d4bda3 (diff) | |
download | emacs-179f69112df62a6ed2aeefb53d900c4dc9cd0e81.tar.gz emacs-179f69112df62a6ed2aeefb53d900c4dc9cd0e81.tar.bz2 emacs-179f69112df62a6ed2aeefb53d900c4dc9cd0e81.zip |
Bugfix for url-http-find-free-connection.
* lisp/url/url-http.el (url-http-find-free-connection): Don't pass a nil
argument to url-http-mark-connection-as-busy.
Fixes: debbugs:10891
Diffstat (limited to 'lisp/url/url-http.el')
-rw-r--r-- | lisp/url/url-http.el | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index 0c911260ca5..36e35593385 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el @@ -153,38 +153,40 @@ request.") (defun url-http-find-free-connection (host port) (let ((conns (gethash (cons host port) url-http-open-connections)) - (found nil)) - (while (and conns (not found)) + (connection nil)) + (while (and conns (not connection)) (if (not (memq (process-status (car conns)) '(run open connect))) (progn (url-http-debug "Cleaning up dead process: %s:%d %S" host port (car conns)) (url-http-idle-sentinel (car conns) nil)) - (setq found (car conns)) - (url-http-debug "Found existing connection: %s:%d %S" host port found)) + (setq connection (car conns)) + (url-http-debug "Found existing connection: %s:%d %S" host port connection)) (pop conns)) - (if found + (if connection (url-http-debug "Reusing existing connection: %s:%d" host port) (url-http-debug "Contacting host: %s:%d" host port)) (url-lazy-message "Contacting host: %s:%d" host port) - (url-http-mark-connection-as-busy - host port - (or found - (let ((buf (generate-new-buffer " *url-http-temp*"))) - ;; `url-open-stream' needs a buffer in which to do things - ;; like authentication. But we use another buffer afterwards. - (unwind-protect - (let ((proc (url-open-stream host buf host port))) - ;; url-open-stream might return nil. - (when (processp proc) - ;; Drop the temp buffer link before killing the buffer. - (set-process-buffer proc nil)) - proc) - ;; If there was an error on connect, make sure we don't - ;; get queried. - (when (get-buffer-process buf) - (set-process-query-on-exit-flag (get-buffer-process buf) nil)) - (kill-buffer buf))))))) + + (unless connection + (let ((buf (generate-new-buffer " *url-http-temp*"))) + ;; `url-open-stream' needs a buffer in which to do things + ;; like authentication. But we use another buffer afterwards. + (unwind-protect + (let ((proc (url-open-stream host buf host port))) + ;; url-open-stream might return nil. + (when (processp proc) + ;; Drop the temp buffer link before killing the buffer. + (set-process-buffer proc nil) + (setq connection proc))) + ;; If there was an error on connect, make sure we don't + ;; get queried. + (when (get-buffer-process buf) + (set-process-query-on-exit-flag (get-buffer-process buf) nil)) + (kill-buffer buf)))) + + (if connection + (url-http-mark-connection-as-busy host port connection)))) ;; Building an HTTP request (defun url-http-user-agent-string () |