From: Tao Fang <fangtao0901@gmail.com>
To: joaotavora@gmail.com (João Távora)
Cc: Alexis <flexibeast@gmail.com>, 23225@debbugs.gnu.org
Subject: bug#23225: 25.1.50; url-retrieve-synchronously having trouble with some https URLs
Date: Sun, 05 Jun 2016 00:17:54 +0800 [thread overview]
Message-ID: <8737otyll9.fsf@gmail.com> (raw)
In-Reply-To: <m2bn5nc3ij.fsf@gmail.com> ("João Távora"'s message of "Tue, 05 Apr 2016 19:30:12 +0100")
[-- Attachment #1: Type: text/plain, Size: 669 bytes --]
joaotavora@gmail.com (João Távora) writes:
> The misbehaving propagated silently and I came across this using M-x
> package-install RET ... RET, which magically compiles a 0-byte package.
I had same problem when using package-install with restricted network
connection (or bad network conditions), sometimes I got empty buffer
without any error where as it should fail.
> I think the protocol for url-retrieve-synchornously could be
> revised. Its users seem to expect it to return nil or at least a
> non-buffer if something went wrong, but that's clearly not what happened
> here. Perhaps it should error.
I agree.
So I proposed a patch for this:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-url-retrieve-synchronously-signal-error-when-fail.patch --]
[-- Type: text/x-diff, Size: 1632 bytes --]
From ff85fd2a421f751626d61b73d6f268d0cc42d702 Mon Sep 17 00:00:00 2001
From: Tao Fang <fangtao0901@gmail.com>
Date: Sat, 4 Jun 2016 23:27:55 +0800
Subject: [PATCH] url-retrieve-synchronously signal error when fail
---
lisp/url/url.el | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/lisp/url/url.el b/lisp/url/url.el
index 6d710e0..1d49b10 100644
--- a/lisp/url/url.el
+++ b/lisp/url/url.el
@@ -235,12 +235,14 @@ how long to wait for a response before giving up."
(let ((retrieval-done nil)
(start-time (current-time))
- (asynch-buffer nil))
+ (asynch-buffer nil)
+ err)
(setq asynch-buffer
- (url-retrieve url (lambda (&rest ignored)
+ (url-retrieve url (lambda (status &rest ignored)
(url-debug 'retrieval "Synchronous fetching done (%S)" (current-buffer))
(setq retrieval-done t
- asynch-buffer (current-buffer)))
+ asynch-buffer (current-buffer)
+ err (plist-get status :error)))
nil silent inhibit-cookies))
(if (null asynch-buffer)
;; We do not need to do anything, it was a mailto or something
@@ -300,6 +302,12 @@ how long to wait for a response before giving up."
(delete-process proc))
(setq proc (and (not quit-flag)
(get-buffer-process asynch-buffer)))))))
+
+ ;; Before we return, check for error except 'http
+ (when (and err
+ (not (eq (cadr err) 'http)))
+ (signal (car err) (cdr err)))
+
asynch-buffer)))
;; url-mm-callback called from url-mm, which requires mm-decode.
--
2.8.3
next prev parent reply other threads:[~2016-06-04 16:17 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-05 18:30 bug#23225: 25.1.50; url-retrieve-synchronously having trouble with some https URLs João Távora
2016-04-10 23:45 ` Alexis
2016-06-04 16:17 ` Tao Fang [this message]
2016-06-04 16:23 ` Noam Postavsky
2016-06-11 4:00 ` Chunyang Xu
2016-06-11 12:47 ` Noam Postavsky
2016-06-11 12:54 ` Chunyang Xu
2016-06-11 13:36 ` Noam Postavsky
2016-06-11 13:59 ` Chunyang Xu
2016-07-30 16:44 ` Tao Fang
2016-08-06 23:56 ` Tao Fang
2016-08-09 12:57 ` Noam Postavsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8737otyll9.fsf@gmail.com \
--to=fangtao0901@gmail.com \
--cc=23225@debbugs.gnu.org \
--cc=flexibeast@gmail.com \
--cc=joaotavora@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.