- (let ((name buffer-file-name))
- (prog1
- (url-insert-file-contents url)
- (setq buffer-file-name name)))))
-
+ (let ((name buffer-file-name)
+ (url-request-extra-headers
+ ;; ISTM setting a Connection header was a workaround for
+ ;; older versions of url included with w3, but it does more
+ ;; harm than good with the one shipped with Emacs. --ansel
+ (if (not (and (boundp 'url-version)
+ (equal url-version "Emacs")))
+ (list (cons "Connection" "Close"))))
+ (url-package-name (or mm-url-package-name
+ url-package-name))
+ (url-package-version (or mm-url-package-version
+ url-package-version))
+ result)
+ (setq result (url-insert-file-contents url))
+ (save-excursion
+ (goto-char (point-min))
+ (while (re-search-forward "\r 1000\r ?" nil t)
+ (replace-match "")))
+ (setq buffer-file-name name)
+ (if (and (fboundp 'url-generic-parse-url)
+ (listp result))
+ (setq url-current-object (url-generic-parse-url
+ (car result))))
+ result)))
+
+;;;###autoload