aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Liu2014-06-26 12:00:56 +0800
committerLeo Liu2014-06-26 12:00:56 +0800
commit1d8bea62832ea227d154995d2d52bd2093d4d722 (patch)
tree42fb1c174359cc10e83760726927a569f86ac606
parentd2301b5d805d603547b36d96e3a09e6d8124a6d7 (diff)
downloademacs-1d8bea62832ea227d154995d2d52bd2093d4d722.tar.gz
emacs-1d8bea62832ea227d154995d2d52bd2093d4d722.zip
* lisp/url/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. * lisp/url/url-http.el (url-http-end-of-headers): Remove duplicate defvar. Fixes: debbugs:17549
-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 408f659681f..4880bfea30b 100644
--- a/lisp/url/ChangeLog
+++ b/lisp/url/ChangeLog
@@ -1,3 +1,11 @@
12014-06-26 Leo Liu <sdl.web@gmail.com>
2
3 * url-http.el (url-http-end-of-headers): Remove duplicate defvar.
4
5 * url-handlers.el (url-http-parse-response): Remove unused autoload.
6 (url-insert-file-contents): Condition on url-http-response-status
7 for the HTTP/S specific part. (Bug#17549)
8
12014-05-09 Michael Albinus <michael.albinus@gmx.de> 92014-05-09 Michael Albinus <michael.albinus@gmx.de>
2 10
3 * url-handlers.el (url-file-handler-load-in-progress): New defvar. 11 * url-handlers.el (url-file-handler-load-in-progress): New defvar.
diff --git a/lisp/url/url-handlers.el b/lisp/url/url-handlers.el
index b0f01123bbb..5a274c12e31 100644
--- a/lisp/url/url-handlers.el
+++ b/lisp/url/url-handlers.el
@@ -33,7 +33,6 @@
33(autoload 'url-expand-file-name "url-expand" "Convert url to a fully specified url, and canonicalize it.") 33(autoload 'url-expand-file-name "url-expand" "Convert url to a fully specified url, and canonicalize it.")
34(autoload 'mm-dissect-buffer "mm-decode" "Dissect the current buffer and return a list of MIME handles.") 34(autoload 'mm-dissect-buffer "mm-decode" "Dissect the current buffer and return a list of MIME handles.")
35(autoload 'url-scheme-get-property "url-methods" "Get property of a URL SCHEME.") 35(autoload 'url-scheme-get-property "url-methods" "Get property of a URL SCHEME.")
36(autoload 'url-http-parse-response "url-http" "Parse just the response code.")
37 36
38;; Always used after mm-dissect-buffer and defined in the same file. 37;; Always used after mm-dissect-buffer and defined in the same file.
39(declare-function mm-save-part-to-file "mm-decode" (handle file)) 38(declare-function mm-save-part-to-file "mm-decode" (handle file))
@@ -298,17 +297,21 @@ They count bytes from the beginning of the body."
298 (insert data)) 297 (insert data))
299 (list (length data) charset))) 298 (list (length data) charset)))
300 299
300(defconst url-http-codes)
301
301;;;###autoload 302;;;###autoload
302(defun url-insert-file-contents (url &optional visit beg end replace) 303(defun url-insert-file-contents (url &optional visit beg end replace)
303 (let ((buffer (url-retrieve-synchronously url))) 304 (let ((buffer (url-retrieve-synchronously url)))
304 (unless buffer (signal 'file-error (list url "No Data"))) 305 (unless buffer (signal 'file-error (list url "No Data")))
305 (with-current-buffer buffer 306 (with-current-buffer buffer
306 (let ((response (url-http-parse-response))) 307 ;; XXX: This is HTTP/S specific and should be moved to url-http
307 (if (and (>= response 200) (< response 300)) 308 ;; instead. See http://debbugs.gnu.org/17549.
308 (goto-char (point-min)) 309 (when (bound-and-true-p url-http-response-status)
309 (let ((desc (buffer-substring-no-properties (1+ (point)) 310 (unless (and (>= url-http-response-status 200)
310 (line-end-position)))) 311 (< url-http-response-status 300))
312 (let ((desc (nth 2 (assq url-http-response-status url-http-codes))))
311 (kill-buffer buffer) 313 (kill-buffer buffer)
314 ;; Signal file-error per http://debbugs.gnu.org/16733.
312 (signal 'file-error (list url desc)))))) 315 (signal 'file-error (list url desc))))))
313 (if visit (setq buffer-file-name url)) 316 (if visit (setq buffer-file-name url))
314 (save-excursion 317 (save-excursion
@@ -323,6 +326,7 @@ They count bytes from the beginning of the body."
323 ;; usual heuristic/rules that we apply to files. 326 ;; usual heuristic/rules that we apply to files.
324 (decode-coding-inserted-region start (point) url visit beg end replace)) 327 (decode-coding-inserted-region start (point) url visit beg end replace))
325 (list url (car size-and-charset)))))) 328 (list url (car size-and-charset))))))
329
326(put 'insert-file-contents 'url-file-handlers 'url-insert-file-contents) 330(put 'insert-file-contents 'url-file-handlers 'url-insert-file-contents)
327 331
328(defun url-file-name-completion (url directory &optional predicate) 332(defun url-file-name-completion (url directory &optional predicate)
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
index ac2e1403d03..dcb86689ca9 100644
--- a/lisp/url/url-http.el
+++ b/lisp/url/url-http.el
@@ -47,7 +47,6 @@
47(defvar url-http-response-version) 47(defvar url-http-response-version)
48(defvar url-http-target-url) 48(defvar url-http-target-url)
49(defvar url-http-transfer-encoding) 49(defvar url-http-transfer-encoding)
50(defvar url-http-end-of-headers)
51(defvar url-show-status) 50(defvar url-show-status)
52 51
53(require 'url-gw) 52(require 'url-gw)