]> code.delx.au - gnu-emacs/blobdiff - lisp/gnus/mm-url.el
Allow reading Gnus reports from an offline cache
[gnu-emacs] / lisp / gnus / mm-url.el
index 6d5f2a34c799628bd84f83ce46081fe1f75da548..6919266794859d310bea3153691ab16f39b648d3 100644 (file)
@@ -1,6 +1,6 @@
 ;;; mm-url.el --- a wrapper of url functions/commands for Gnus
 
-;; Copyright (C) 2001-2015 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2016 Free Software Foundation, Inc.
 
 ;; Author: Shenghuo Zhu <zsh@cs.rochester.edu>
 
@@ -276,19 +276,10 @@ If `mm-url-use-external' is non-nil, use `mm-url-program'."
            (insert-file-contents (substring url (1- (match-end 0))))
          (mm-url-insert-file-contents-external url))
        (goto-char (point-min))
-       (if (fboundp 'url-generic-parse-url)
-           (setq url-current-object
-                 (url-generic-parse-url url)))
+       (setq url-current-object (url-generic-parse-url url))
        (list url (buffer-size)))
     (mm-url-load-url)
     (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"))))
          result)
       (setq result (url-insert-file-contents url))
       (save-excursion
@@ -296,10 +287,9 @@ If `mm-url-use-external' is non-nil, use `mm-url-program'."
        (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))))
+      (when (listp result)
+       (setq url-current-object
+             (url-generic-parse-url (car result))))
       result)))
 
 ;;;###autoload
@@ -364,7 +354,7 @@ If FOLLOW-REFRESH is non-nil, redirect refresh url in META."
                              (string-to-number (substring entity 1)))))
                       (setq c (or (cdr (assq c mm-extra-numeric-entities))
                                   (mm-ucs-to-char c)))
-                      (if (mm-char-or-char-int-p c) c ?#))
+                      (if (characterp c) c ?#))
                   (or (cdr (assq (intern entity)
                                  mm-url-html-entities))
                       ?#))))
@@ -392,17 +382,15 @@ spaces.  Die Die Die."
   (if (consp chunk)
       (setq chunk (cdr chunk)))
 
-  (mapconcat
-   (lambda (char)
-     (cond
-      ((= char ?  ) "+")
-      ((memq char mm-url-unreserved-chars) (char-to-string char))
-      (t (upcase (format "%%%02x" char)))))
-   (mm-encode-coding-string chunk
-                           (if (fboundp 'find-coding-systems-string)
-                               (car (find-coding-systems-string chunk))
-                             buffer-file-coding-system))
-   ""))
+  (if chunk
+      (mapconcat
+       (lambda (char)
+        (cond
+         ((= char ?  ) "+")
+         ((memq char mm-url-unreserved-chars) (char-to-string char))
+         (t (upcase (format "%%%02x" char)))))
+       (encode-coding-string chunk (car (find-coding-systems-string chunk)))
+       "")))
 
 (defun mm-url-encode-www-form-urlencoded (pairs)
   "Return PAIRS encoded for forms."