summaryrefslogtreecommitdiff
path: root/lisp/url
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2014-06-25 23:55:15 -0700
committerGlenn Morris <rgm@gnu.org>2014-06-25 23:55:15 -0700
commit9ac6d28ab8c29547d9f9365dc8f7cea13c32ef7a (patch)
tree026dc1d5a858b27086c4f9d8e0f4a60b7907eb80 /lisp/url
parenta0e2175a9055f2ea8ae03744d495e5179885029d (diff)
parent436550da1bf8d2cdd92a60f6ce84f131a8045062 (diff)
downloademacs-9ac6d28ab8c29547d9f9365dc8f7cea13c32ef7a.tar.gz
Merge from emacs-24; up to 2014-06-11T19:33:14Z!rgm@gnu.org
Diffstat (limited to 'lisp/url')
-rw-r--r--lisp/url/ChangeLog8
-rw-r--r--lisp/url/url-handlers.el16
-rw-r--r--lisp/url/url-http.el1
3 files changed, 18 insertions, 7 deletions
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog
index b445ff6d1f1..b8e34ea65c4 100644
--- a/lisp/url/ChangeLog
+++ b/lisp/url/ChangeLog
@@ -1,3 +1,11 @@
+2014-06-26 Leo Liu <sdl.web@gmail.com>
+
+ * url-http.el (url-http-end-of-headers): Remove duplicate defvar.
+
+ * url-handlers.el (url-http-parse-response): Remove unused autoload.
+ (url-insert-file-contents): Condition on url-http-response-status
+ for the HTTP/S specific part. (Bug#17549)
+
2014-05-14 Glenn Morris <rgm@gnu.org>
* url-util.el (url-make-private-file): Use with-file-modes.
diff --git a/lisp/url/url-handlers.el b/lisp/url/url-handlers.el
index c86acb680d0..704c743bfcd 100644
--- a/lisp/url/url-handlers.el
+++ b/lisp/url/url-handlers.el
@@ -33,7 +33,6 @@
(autoload 'url-expand-file-name "url-expand" "Convert url to a fully specified url, and canonicalize it.")
(autoload 'mm-dissect-buffer "mm-decode" "Dissect the current buffer and return a list of MIME handles.")
(autoload 'url-scheme-get-property "url-methods" "Get property of a URL SCHEME.")
-(autoload 'url-http-parse-response "url-http" "Parse just the response code.")
;; Always used after mm-dissect-buffer and defined in the same file.
(declare-function mm-save-part-to-file "mm-decode" (handle file))
@@ -308,17 +307,21 @@ They count bytes from the beginning of the body."
(insert data))
(list (length data) charset)))
+(defvar url-http-codes)
+
;;;###autoload
(defun url-insert-file-contents (url &optional visit beg end replace)
(let ((buffer (url-retrieve-synchronously url)))
(unless buffer (signal 'file-error (list url "No Data")))
(with-current-buffer buffer
- (let ((response (url-http-parse-response)))
- (if (and (>= response 200) (< response 300))
- (goto-char (point-min))
- (let ((desc (buffer-substring-no-properties (1+ (point))
- (line-end-position))))
+ ;; XXX: This is HTTP/S specific and should be moved to url-http
+ ;; instead. See http://debbugs.gnu.org/17549.
+ (when (bound-and-true-p url-http-response-status)
+ (unless (and (>= url-http-response-status 200)
+ (< url-http-response-status 300))
+ (let ((desc (nth 2 (assq url-http-response-status url-http-codes))))
(kill-buffer buffer)
+ ;; Signal file-error per http://debbugs.gnu.org/16733.
(signal 'file-error (list url desc))))))
(if visit (setq buffer-file-name url))
(save-excursion
@@ -333,6 +336,7 @@ They count bytes from the beginning of the body."
;; usual heuristic/rules that we apply to files.
(decode-coding-inserted-region start (point) url visit beg end replace))
(list url (car size-and-charset))))))
+
(put 'insert-file-contents 'url-file-handlers 'url-insert-file-contents)
(defun url-file-name-completion (url directory &optional predicate)
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
index 23e7d4b6074..608a865be7b 100644
--- a/lisp/url/url-http.el
+++ b/lisp/url/url-http.el
@@ -48,7 +48,6 @@
(defvar url-http-response-version)
(defvar url-http-target-url)
(defvar url-http-transfer-encoding)
-(defvar url-http-end-of-headers)
(defvar url-show-status)
(require 'url-gw)