- (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))))