From: Eli Zaretskii <eliz@gnu.org>
To: Greg Minshall <minshall@umich.edu>
Cc: 72652@debbugs.gnu.org
Subject: bug#72652: 31.0.50; url-retrieve on non-existent domain gives no indication of error
Date: Fri, 16 Aug 2024 10:43:30 +0300 [thread overview]
Message-ID: <86wmkg6hgd.fsf@gnu.org> (raw)
In-Reply-To: <504501.1723782848@archlinux> (message from Greg Minshall on Fri, 16 Aug 2024 07:34:08 +0300)
> From: Greg Minshall <minshall@umich.edu>
> Date: Fri, 16 Aug 2024 07:34:08 +0300
>
> if url-retrieve is called with a url for a non-existent domain, it
> neither returns an error (it returns a buffer, as it is documented to
> do), nor does it seem to invoke the callback routine passed to it to
> report any error (or success, or anything else, for that matter).
>
> the following code uses example.com. calling
> - `(mytry 0)` should work, downloading "index.html"
> - `(mytry 1)` should give a 404 -- no such file "index99.html"
> - `(mytry 2)` doesn't give anything (but, the code ends after 5 seconds)
> as there is no such host "x.example.com".
>
> with 0 or 1, the callback routine is invoked, but with 2, it isn't.
> (after 5 seconds the code finishes, displays whatever might be in the
> buffer url-retrieve uses to return the results.)
On MS-Windows (mytry 2) signals an error:
Debugger entered--Lisp error: (error "x.example.com/443 No such host is known. ")
make-network-process(:name "x.example.com" :buffer #<buffer *url-http-temp*> :host "x.example.com" :service 443 :nowait (:nowait t) :noquery nil :tls-parameters (gnutls-x509pki :priority "NORMAL:%DUMBFW" :hostname "x.example.com" :loglevel 0 :min-prime-bits nil :trustfiles nil :crlfiles nil :keylist nil :verify-flags nil :verify-error nil :pass nil :flags nil :callbacks nil) :coding nil)
open-network-stream("x.example.com" #<buffer *url-http-temp*> "x.example.com" 443 :nowait (:nowait t) :tls-parameters (gnutls-x509pki :priority "NORMAL:%DUMBFW" :hostname "x.example.com" :loglevel 0 :min-prime-bits nil :trustfiles nil :crlfiles nil :keylist nil :verify-flags nil :verify-error nil :pass nil :flags nil :callbacks nil) :coding nil)
open-gnutls-stream("x.example.com" #<buffer *url-http-temp*> "x.example.com" 443 (:type tls :nowait (:nowait t)))
network-stream-open-tls("x.example.com" #<buffer *url-http-temp*> "x.example.com" 443 (:type tls :nowait (:nowait t)))
open-network-stream("x.example.com" #<buffer *url-http-temp*> "x.example.com" 443 :type tls :nowait (:nowait t))
url-open-stream("x.example.com" #<buffer *url-http-temp*> "x.example.com" 443 tls)
url-http-find-free-connection("x.example.com" 443 tls)
url-http(#s(url :type "https" :user nil :password nil :host "x.example.com" :portspec nil :filename "/index.html" :target nil :attributes nil :fullness t :silent nil :use-cookies t :asynchronous t) #f(lambda (&rest results) [t] (mysage "called back")) (nil) nil tls)
url-https(#s(url :type "https" :user nil :password nil :host "x.example.com" :portspec nil :filename "/index.html" :target nil :attributes nil :fullness t :silent nil :use-cookies t :asynchronous t) #f(lambda (&rest results) [t] (mysage "called back")) (nil))
url-retrieve-internal("https://x.example.com/index.html" #f(lambda (&rest results) [t] (mysage "called back")) (nil) nil nil)
url-retrieve("https://x.example.com/index.html" #f(lambda (&rest results) [t] (mysage "called back")) nil)
(let* ((urls '("https://example.com/index.html" "https://example.com/index99.html" "https://x.example.com/index.html")) (buffer (url-retrieve (nth n urls) #'(lambda (&rest results) (mysage "called back")) nil))) (mysage "url-retrieve returns %s" buffer) (sleep-for 5) (save-current-buffer (set-buffer buffer) (mysage "buffer %s contents: %s" buffer (buffer-substring (point-min) (point-max)))))
mytry(2)
eval((mytry 2) t)
#f(compiled-function () #<bytecode 0x127ffea33bfbce22>)()
#f(compiled-function () #<bytecode -0x5c06e1955cf31d1>)()
handler-bind-1(#f(compiled-function () #<bytecode -0x5c06e1955cf31d1>) (error) eval-expression--debug)
eval-expression((mytry 2) nil nil 127)
funcall-interactively(eval-expression (mytry 2) nil nil 127)
call-interactively(eval-expression nil nil)
command-execute(eval-expression)
On GNU/Linux, I get this in the echo-area after about 2 sec:
Contacting host: x.example.com:443
url-retrieve returns *http x.example.com:443*
buffer *http x.example.com:443* contents:
"buffer *http x.example.com:443* contents:
"
IOW, I get an empty buffer. Why is that behavior a problem?
next prev parent reply other threads:[~2024-08-16 7:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-16 4:34 bug#72652: 31.0.50; url-retrieve on non-existent domain gives no indication of error Greg Minshall
2024-08-16 6:11 ` bug#72652: sentinel Greg Minshall
2024-08-16 7:43 ` Eli Zaretskii [this message]
2024-08-16 19:39 ` bug#72652: 31.0.50; url-retrieve on non-existent domain gives no indication of error Greg Minshall
2024-08-17 5:50 ` Eli Zaretskii
2024-08-17 12:54 ` Greg Minshall
2024-09-13 1:50 ` Dmitry Gutov
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=86wmkg6hgd.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=72652@debbugs.gnu.org \
--cc=minshall@umich.edu \
/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.