From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Greg Minshall Newsgroups: gmane.emacs.bugs Subject: bug#72652: 31.0.50; url-retrieve on non-existent domain gives no indication of error Date: Fri, 16 Aug 2024 22:39:11 +0300 Message-ID: <515941.1723837151@archlinux> References: <504501.1723782848@archlinux> <86wmkg6hgd.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37689"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 72652@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Aug 16 21:40:41 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sf2oT-0009cE-CL for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 16 Aug 2024 21:40:41 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sf2oE-0001cW-2m; Fri, 16 Aug 2024 15:40:26 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sf2oC-0001cD-Fv for bug-gnu-emacs@gnu.org; Fri, 16 Aug 2024 15:40:24 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sf2oC-000359-6f for bug-gnu-emacs@gnu.org; Fri, 16 Aug 2024 15:40:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=Date:MIME-Version:References:In-reply-to:From:To:Subject; bh=wxwG5Nsr6qA9HMwRGJgn5nPjAXWOUeYgZQOU+VRZFP4=; b=EC+5/KTkj0Ve6+fzQO2FuYUVWfDZ7BwlIKwedjqhn1VwkKTD8UeBJfknbSLHKLR0Jk0/TaIUl5blLsTs3g6IHJ+G/RX6a8k6EAdNSIiIpbLwmOPPaMLruSBKmPdn5JHkCFhRdqJA3YpJmuvcJgCwOmKF5Wm88YPb6c6m45sdCNF2qXqaQt43H8ydPWekC45/pICkPE0rPwLAcC5Mln1AgFE/U1nHmnMgoBRMDUX8fpkthWee8Rn1iqMNElIYxeQ9oLZ9QDJqGXQatEaXjfgwyj91rSOost7LUXol+FxVo/KAHyOSABeeBOQglBR8zo/Tm5S11KU45cIzkfNjkbAWjQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sf2on-00058u-R5 for bug-gnu-emacs@gnu.org; Fri, 16 Aug 2024 15:41:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Greg Minshall Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 16 Aug 2024 19:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72652 X-GNU-PR-Package: emacs Original-Received: via spool by 72652-submit@debbugs.gnu.org id=B72652.172383720719687 (code B ref 72652); Fri, 16 Aug 2024 19:41:01 +0000 Original-Received: (at 72652) by debbugs.gnu.org; 16 Aug 2024 19:40:07 +0000 Original-Received: from localhost ([127.0.0.1]:52943 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sf2nu-00057S-H7 for submit@debbugs.gnu.org; Fri, 16 Aug 2024 15:40:06 -0400 Original-Received: from relay-egress-host.us-east-2.a.mail.umich.edu ([13.59.128.245]:52778 helo=luxuriant-pwyll.relay-egress.a.mail.umich.edu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sf2nr-00056q-9G for 72652@debbugs.gnu.org; Fri, 16 Aug 2024 15:40:04 -0400 Original-Received: from fortified-griffin.authn-relay.a.mail.umich.edu (ip-10-0-73-105.us-east-2.compute.internal [10.0.73.105]) by luxuriant-pwyll.relay-egress.a.mail.umich.edu with ESMTPS id 66BFAAE6.28D62AFB.7E0E18B9.533158; Fri, 16 Aug 2024 15:39:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umich.edu; s=relay-0; t=1723837158; bh=wxwG5Nsr6qA9HMwRGJgn5nPjAXWOUeYgZQOU+VRZFP4=; h=To:cc:From:Subject:In-reply-to:References:Date; b=jxYuxBOKBOCJxy4nAbDwxBCwPwmRZf15pBREeM2K0mvJwyP/kxEIWi/FnzFxxE1QT iIHDFlvIk+wCr771NvkmQlHzYeO9n4pCJy0zTBzBnWFLDIG4zoo1GTylheuXA1SwxO Z5AopJ4s3MRva3tlFo/xVDOZxdyai7G2grz7F9euJxucoxGkHsSS1LnsmTn78CkY+K EgQxUU8a6ekgf57w1voHZkSFRMVrpUwwaQJ7cd2cPS7HgHEv5vW3OAUh1yihvaR2yg tyCWSs6S2NyAZH9/Fu71entBmpmUzcc7HX/1jJJUT9Zd/SWjDMB4bXFbR2WV9uW0nk 0rGaxPlIzANSw== Authentication-Results: fortified-griffin.authn-relay.a.mail.umich.edu; iprev=fail policy.iprev=85.108.143.146 (Mismatch); auth=pass smtp.auth=minshall Original-Received: from localhost (Mismatch [85.108.143.146]) by fortified-griffin.authn-relay.a.mail.umich.edu with ESMTPSA id 66BFAAE5.B5B00C0.60864BA6.2034240; Fri, 16 Aug 2024 15:39:17 -0400 In-reply-to: <86wmkg6hgd.fsf@gnu.org> Comments: In-reply-to Eli Zaretskii message dated "Fri, 16 Aug 2024 10:43:30 +0300." X-Mailer: MH-E 8.6+git; nmh 1.8; Emacs 31.0.50 Content-ID: <515940.1723837151.1@archlinux> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:290206 Archived-At: hi, Eli, > On MS-Windows (mytry 2) signals an error: i see. possibly the Emacs on windows is using a synchronous DNS resolver (possibly not). but, an error is better than nothing. > 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? the problem is that there's no indication from url-retrieve that the requested transfer has failed (or has in any way finished). the only reason the message about the buffer was printed out was because the mytry script times out after 5 seconds, prints out whatever might be in the buffer. so, a program that calls url-retrieve for an unknown host is never notified that anything happened. if some sort of error is detected synchronous with the call to url-retrieve (i.e., before url-retrieve returns to its caller), signaling an error seems fine. in the case where the error is detected later, then i think (if possible) url-retrieve should cause a callback to happen, with the `:error` data in the status parameter specifying something like "unknown host". in the case of (mytry 1), there is a callback (to the callback routine specified in the invocation of url-retrieve) which passes an error indication: ---- called back: ((:error (error http 500) ---- (one can modify mytry to print out the status given to the callback routine -- see below.) hth. cheers, Greg ---- modified mytry: prints out status parameter to callback: ---- ;;; ... -*- lexical-binding: t -*- (defun mysage (&rest args) "Like (message), but send ARGS to stdout, even in batch mode. \(In batch mode, (message) sends to stderr; the prin1, etc., send to stdout." (princ (format "%s\n" (apply 'format args)))) (defun mytry (n) "Try url-retrieve on a URL. N is 0, 1, or 2." (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: %s" results)) nil))) (mysage "url-retrieve returns %s" buffer) (sleep-for 5) (with-current-buffer buffer (mysage "buffer %s contents: %s" buffer (buffer-substring (point-min= ) (point-max))))))