Function: url-http--insert-file-helper

url-http--insert-file-helper is a byte-compiled function defined in url-http.el.gz.

Signature

(url-http--insert-file-helper BUFFER URL &optional VISIT)

Source Code

;; Defined in /usr/src/emacs/lisp/url/url-http.el.gz
(defun url-http--insert-file-helper (buffer url &optional visit)
  (with-current-buffer buffer
    (when (bound-and-true-p url-http-response-status)
      ;; Don't signal an error if VISIT is non-nil, because
      ;; 'insert-file-contents' doesn't.  This is required to
      ;; support, e.g., 'browse-url-emacs', which is a fancy way of
      ;; visiting the HTML source of a URL: in that case, we want to
      ;; display a file buffer even if the URL does not exist and
      ;; 'url-retrieve-synchronously' returns 404 or whatever.
      (unless (or visit
                  (or (and (>= url-http-response-status 200)
                           (< url-http-response-status 300))
                      (= url-http-response-status 304))) ; "Not modified"
        (let ((desc (nth 2 (assq url-http-response-status url-http-codes))))
          (kill-buffer buffer)
          ;; Signal file-error per bug#16733.
          (signal 'file-error (list url desc)))))))