From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Leo Liu Newsgroups: gmane.emacs.bugs Subject: bug#17549: 24.4.50; regression: url-insert-file-contents Date: Wed, 25 Jun 2014 08:58:49 +0800 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1403658026 27695 80.91.229.3 (25 Jun 2014 01:00:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 25 Jun 2014 01:00:26 +0000 (UTC) Cc: 17549@debbugs.gnu.org To: Juanma Barranquero Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jun 25 03:00:20 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WzbZT-0005DB-O4 for geb-bug-gnu-emacs@m.gmane.org; Wed, 25 Jun 2014 03:00:19 +0200 Original-Received: from localhost ([::1]:34472 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzbZT-00020C-GL for geb-bug-gnu-emacs@m.gmane.org; Tue, 24 Jun 2014 21:00:19 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57518) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzbZK-0001yt-Vo for bug-gnu-emacs@gnu.org; Tue, 24 Jun 2014 21:00:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WzbZF-0005Np-1V for bug-gnu-emacs@gnu.org; Tue, 24 Jun 2014 21:00:10 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40398) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WzbZE-0005Mg-VI for bug-gnu-emacs@gnu.org; Tue, 24 Jun 2014 21:00:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WzbZE-0003xN-3s for bug-gnu-emacs@gnu.org; Tue, 24 Jun 2014 21:00:04 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Leo Liu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 25 Jun 2014 01:00:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17549 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 17549-submit@debbugs.gnu.org id=B17549.140365794415081 (code B ref 17549); Wed, 25 Jun 2014 01:00:03 +0000 Original-Received: (at 17549) by debbugs.gnu.org; 25 Jun 2014 00:59:04 +0000 Original-Received: from localhost ([127.0.0.1]:59781 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WzbYE-0003v9-Vq for submit@debbugs.gnu.org; Tue, 24 Jun 2014 20:59:03 -0400 Original-Received: from mail-pd0-f177.google.com ([209.85.192.177]:43558) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WzbYC-0003ub-17 for 17549@debbugs.gnu.org; Tue, 24 Jun 2014 20:59:01 -0400 Original-Received: by mail-pd0-f177.google.com with SMTP id y10so920270pdj.22 for <17549@debbugs.gnu.org>; Tue, 24 Jun 2014 17:58:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:face:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=sBlTP+rvehrPzpG0w3PHUbIg1hoVgRPFQdq4Qsoh+ys=; b=YkGQogdMsj1P+l7elIc+mjQV/+beHiQBgUXukFdS2946u0cYtwafmzRTen7Hed9VYm nCzINr37jmxEvhXnnBBsFGdzwHbD6cvipAjoyTm7897gapWiQDH7Gl0cfVHECErfOubd HneQ2JVL7BaHz6GlvYeb82Dm52iac14i0hwuzaJ6HX/Xg5YUQwD3G3TekvAx9I5frdTJ V6CshJ+DCx+dP/Yhmgim+WBf8FDm4TmGryiv6wqO7rNNqc8jo/kbvSbjYobuRCQfvy0G 1lMnb8NfaBNzebPFqLU7uo3CFsW4sPPLWLWqaQZM+AngVPrvWaGOULcmnO4YoKCna2hL D8NQ== X-Received: by 10.66.148.70 with SMTP id tq6mr6615203pab.56.1403657933941; Tue, 24 Jun 2014 17:58:53 -0700 (PDT) Original-Received: from fortuna ([221.222.158.228]) by mx.google.com with ESMTPSA id z3sm9073782pas.15.2014.06.24.17.58.51 for (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Tue, 24 Jun 2014 17:58:53 -0700 (PDT) Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAGFBMVEUKDAg1NjRWV1V9fnyg op/DxcLk5uP8/voi63ReAAAACXBIWXMAAAWJAAAFiQFtaJ36AAAAB3RJTUUH1goZAgAz00bgXgAA AeVJREFUKM9lk0Fz2jAQhQXJD3CCO70CmcC1YMtcWyTZ14Bl69xats4N9r6/3zWQBlodNKNPu/s0 b1cCQFuZGpfVVh3vAvBJolIXRkapSuoRUtIdFyo1Y5xSdlAj7OtvD1XnXxmWRi+eWgcxyCed1lVV B1CrKyujMoi+eLA5kU1SsjoHlW+nQjTtFxk4MXgrOxvIqzoTZR8XgPaLl419zgsMaSGFPiUOZCIh thsx5Xy9NsK8Kwf/JoQgMxcVJ301HKkcSWaT0O7FY056J4U9xcYfnmVXG4801lW6lqwu2nKFZoHC HuzvaTVndZ+LaRQgZdthXw1cpynEkLEwyFHXk/aIxNQ6QeooJuzPMB+wn+D7JJNsiCcVA13/A3h/ xE9J+WidpAwoYNmRFwyvSRhNVtsdaAewzZZP5uw82QL9+tyNfocyP0McAzICUr5Mk9RdIjWasUNx aIIt6NK4ZtXIMdfMQt3nuMAyWbLI4DqZ4xPq/ag8jPond4XU/cLuOgw6XCFX/YCUfcDAMMH58fD4 G9kDchwfqVefkBwup2uZM+Q4WhJt5jN3AxXCsaS2yXEDuWgS8VOzW0gFjhEPmLyFMKBFaLb1HRwc DiaKwx0EeTMRYnYPQRW3PP4HApvlMv0PttX5v/D6Aws3IOSEwzmLAAAAAElFTkSuQmCC In-Reply-To: (Juanma Barranquero's message of "Tue, 24 Jun 2014 16:01:35 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (CentOS 6.5) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:90764 Archived-At: On 2014-06-24 16:01 +0200, Juanma Barranquero wrote: > Sorry. I keep trying to find time to fix this and a few other bugs, but I'm > very busy right now. No worries ;) > AFAIR, originally I wanted a small change, just throw an error in a > specific case, and Stefan pushed for a bigger (though, I suppose, cleaner) > fix; there was some back-and-forth and we finally settled on what's > installed. So perhaps you can go back, reread the bug thread and find > something in the proposed solutions that fixes the original problem and > does not cause the one you're reporting. OK, I read that thread quickly and now understood the decision. I propose the following solution for now. The patch introduces a compiler warning on url-http-codes. How best to suppress it? === modified file 'lisp/url/url-handlers.el' --- lisp/url/url-handlers.el 2014-05-12 06:59:30 +0000 +++ lisp/url/url-handlers.el 2014-06-25 00:41:33 +0000 @@ -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)) @@ -313,12 +312,12 @@ (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)))) + (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 +332,7 @@ ;; 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) === modified file 'lisp/url/url-http.el' --- lisp/url/url-http.el 2014-03-29 00:55:44 +0000 +++ lisp/url/url-http.el 2014-06-25 00:23:24 +0000 @@ -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)