aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevon Sean McCullough2012-03-11 17:43:01 +0800
committerChong Yidong2012-03-11 17:43:01 +0800
commit179f69112df62a6ed2aeefb53d900c4dc9cd0e81 (patch)
tree0819f0237efa92716c45ba8b1a3a47941de8f021
parentdbf6c5a160bd52f5025c45a6babbb7ca33d4bda3 (diff)
downloademacs-179f69112df62a6ed2aeefb53d900c4dc9cd0e81.tar.gz
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
-rw-r--r--lisp/url/ChangeLog5
-rw-r--r--lisp/url/url-http.el48
2 files changed, 30 insertions, 23 deletions
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog
index 55aa9194904..6f65ab57fe6 100644
--- a/lisp/url/ChangeLog
+++ b/lisp/url/ChangeLog
@@ -1,3 +1,8 @@
12012-03-11 Devon Sean McCullough <emacs-hacker2012@jovi.net>
2
3 * url-http.el (url-http-find-free-connection): Don't pass a nil
4 argument to url-http-mark-connection-as-busy (bug#10891).
5
12012-02-20 Lars Ingebrigtsen <larsi@gnus.org> 62012-02-20 Lars Ingebrigtsen <larsi@gnus.org>
2 7
3 * url-queue.el (url-queue-kill-job): Delete the process sentinel 8 * url-queue.el (url-queue-kill-job): Delete the process sentinel
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.")
153 153
154(defun url-http-find-free-connection (host port) 154(defun url-http-find-free-connection (host port)
155 (let ((conns (gethash (cons host port) url-http-open-connections)) 155 (let ((conns (gethash (cons host port) url-http-open-connections))
156 (found nil)) 156 (connection nil))
157 (while (and conns (not found)) 157 (while (and conns (not connection))
158 (if (not (memq (process-status (car conns)) '(run open connect))) 158 (if (not (memq (process-status (car conns)) '(run open connect)))
159 (progn 159 (progn
160 (url-http-debug "Cleaning up dead process: %s:%d %S" 160 (url-http-debug "Cleaning up dead process: %s:%d %S"
161 host port (car conns)) 161 host port (car conns))
162 (url-http-idle-sentinel (car conns) nil)) 162 (url-http-idle-sentinel (car conns) nil))
163 (setq found (car conns)) 163 (setq connection (car conns))
164 (url-http-debug "Found existing connection: %s:%d %S" host port found)) 164 (url-http-debug "Found existing connection: %s:%d %S" host port connection))
165 (pop conns)) 165 (pop conns))
166 (if found 166 (if connection
167 (url-http-debug "Reusing existing connection: %s:%d" host port) 167 (url-http-debug "Reusing existing connection: %s:%d" host port)
168 (url-http-debug "Contacting host: %s:%d" host port)) 168 (url-http-debug "Contacting host: %s:%d" host port))
169 (url-lazy-message "Contacting host: %s:%d" host port) 169 (url-lazy-message "Contacting host: %s:%d" host port)
170 (url-http-mark-connection-as-busy 170
171 host port 171 (unless connection
172 (or found 172 (let ((buf (generate-new-buffer " *url-http-temp*")))
173 (let ((buf (generate-new-buffer " *url-http-temp*"))) 173 ;; `url-open-stream' needs a buffer in which to do things
174 ;; `url-open-stream' needs a buffer in which to do things 174 ;; like authentication. But we use another buffer afterwards.
175 ;; like authentication. But we use another buffer afterwards. 175 (unwind-protect
176 (unwind-protect 176 (let ((proc (url-open-stream host buf host port)))
177 (let ((proc (url-open-stream host buf host port))) 177 ;; url-open-stream might return nil.
178 ;; url-open-stream might return nil. 178 (when (processp proc)
179 (when (processp proc) 179 ;; Drop the temp buffer link before killing the buffer.
180 ;; Drop the temp buffer link before killing the buffer. 180 (set-process-buffer proc nil)
181 (set-process-buffer proc nil)) 181 (setq connection proc)))
182 proc) 182 ;; If there was an error on connect, make sure we don't
183 ;; If there was an error on connect, make sure we don't 183 ;; get queried.
184 ;; get queried. 184 (when (get-buffer-process buf)
185 (when (get-buffer-process buf) 185 (set-process-query-on-exit-flag (get-buffer-process buf) nil))
186 (set-process-query-on-exit-flag (get-buffer-process buf) nil)) 186 (kill-buffer buf))))
187 (kill-buffer buf))))))) 187
188 (if connection
189 (url-http-mark-connection-as-busy host port connection))))
188 190
189;; Building an HTTP request 191;; Building an HTTP request
190(defun url-http-user-agent-string () 192(defun url-http-user-agent-string ()