GNU bug report logs - #50511
27.2; url-http-handle-authentication should not raise error

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Jonas Bernoulli <jonas@HIDDEN>; Keywords: patch; Done: Lars Ingebrigtsen <larsi@HIDDEN>; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
bug marked as fixed in version 28.1, send any further explanations to 50511 <at> debbugs.gnu.org and Jonas Bernoulli <jonas@HIDDEN> Request was from Lars Ingebrigtsen <larsi@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 50511 <at> debbugs.gnu.org:


Received: (at 50511) by debbugs.gnu.org; 20 Sep 2021 19:24:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 20 15:24:27 2021
Received: from localhost ([127.0.0.1]:44060 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mSOtv-0001BU-Gs
	for submit <at> debbugs.gnu.org; Mon, 20 Sep 2021 15:24:27 -0400
Received: from quimby.gnus.org ([95.216.78.240]:35704)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1mSOtq-0001B6-HU
 for 50511 <at> debbugs.gnu.org; Mon, 20 Sep 2021 15:24:26 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=k5liPjqrYhPCT8vkzSDJ33p1051LzPUXX9pIcwHz++8=; b=TyprCoYlMRaOuAHaz2buKnuaHk
 S/jsg/SQKkNmRKSggqqmPzyZj/cxxobT0yDshml7pf1Kuy0O1sf7rUrhYhpWCEG92vCJAbtvilIPs
 zYYi42dmhpX6bNx5x7yaO2YBxizeYdtaX/Aj8XDABz/fq1/OgPE+QL8HRa0Ab6uXvYQY=;
Received: from [84.212.220.105] (helo=elva)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1mSOth-00048z-F8; Mon, 20 Sep 2021 21:24:16 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Jonas Bernoulli <jonas@HIDDEN>
Subject: Re: bug#50511: [PATCH] No longer raise error when authentication
 failed
References: <id:87k0jnl0ts.fsf@HIDDEN>
 <20210916183211.5669-1-jonas@HIDDEN> <87fsu3xopg.fsf@HIDDEN>
 <877dfbvyug.fsf@HIDDEN>
X-Now-Playing: Laurel Halo's _Quarantine_: "Light + Space"
Date: Mon, 20 Sep 2021 21:24:12 +0200
In-Reply-To: <877dfbvyug.fsf@HIDDEN> (Jonas Bernoulli's message of "Mon,
 20 Sep 2021 21:19:51 +0200")
Message-ID: <871r5jhwyr.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Jonas Bernoulli <jonas@HIDDEN> writes: >> Looks good to
 me; please go ahead and push. > > Done. Please close. OK; done. 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 50511
Cc: 50511 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Jonas Bernoulli <jonas@HIDDEN> writes:

>> Looks good to me; please go ahead and push.
>
> Done. Please close.

OK; done.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50511; Package emacs. Full text available.

Message received at 50511 <at> debbugs.gnu.org:


Received: (at 50511) by debbugs.gnu.org; 20 Sep 2021 19:19:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 20 15:19:59 2021
Received: from localhost ([127.0.0.1]:44055 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mSOpb-00012K-22
	for submit <at> debbugs.gnu.org; Mon, 20 Sep 2021 15:19:59 -0400
Received: from mail.hostpark.net ([212.243.197.30]:34500)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jonas@HIDDEN>) id 1mSOpZ-000129-2d
 for 50511 <at> debbugs.gnu.org; Mon, 20 Sep 2021 15:19:57 -0400
Received: from localhost (localhost [127.0.0.1])
 by mail.hostpark.net (Postfix) with ESMTP id 72239165E2;
 Mon, 20 Sep 2021 21:19:55 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h=
 content-type:content-type:mime-version:message-id:date:date
 :references:in-reply-to:subject:subject:from:from:received
 :received; s=sel2011a; t=1632165593; bh=rmkIjPzL2p2A63bSWFRusr2O
 5oLnkDJ+GUDVEpqlMlQ=; b=rBThbpLM+ZFb5RcW9ss5Lm0p2otjhAnG6Ms7LB2A
 kCIagET1DoGFkUYJ3o1fkOVFiBhQNw/DBKzrHiKo+cwtdag63gKNydwTiw1Wd1El
 UTmkNx8c2Rh0F9A6UV+Jb0TqLleYqmbXD/UA9sGQKmTawzS8d+ElfJVujkjUJcc2
 8Qo=
X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net
Received: from mail.hostpark.net ([127.0.0.1])
 by localhost (mail0.hostpark.net [127.0.0.1]) (amavisd-new, port 10224)
 with ESMTP id DnVVQoe07p_H; Mon, 20 Sep 2021 21:19:53 +0200 (CEST)
Received: from customer (localhost [127.0.0.1])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest
 SHA256) (No client certificate requested)
 by mail.hostpark.net (Postfix) with ESMTPSA id 42603165DD;
 Mon, 20 Sep 2021 21:19:53 +0200 (CEST)
From: Jonas Bernoulli <jonas@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#50511: [PATCH] No longer raise error when authentication
 failed
In-Reply-To: <87fsu3xopg.fsf@HIDDEN>
References: <id:87k0jnl0ts.fsf@HIDDEN>
 <20210916183211.5669-1-jonas@HIDDEN> <87fsu3xopg.fsf@HIDDEN>
Date: Mon, 20 Sep 2021 21:19:51 +0200
Message-ID: <877dfbvyug.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 50511
Cc: 50511 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> Looks good to me; please go ahead and push.

Done. Please close.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50511; Package emacs. Full text available.
Added tag(s) patch. Request was from Stefan Kangas <stefan@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 50511 <at> debbugs.gnu.org:


Received: (at 50511) by debbugs.gnu.org; 17 Sep 2021 14:27:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 17 10:27:04 2021
Received: from localhost ([127.0.0.1]:60844 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mREpU-0005FV-LI
	for submit <at> debbugs.gnu.org; Fri, 17 Sep 2021 10:27:04 -0400
Received: from quimby.gnus.org ([95.216.78.240]:47412)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1mREpR-0005Ez-9z
 for 50511 <at> debbugs.gnu.org; Fri, 17 Sep 2021 10:27:03 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=JtitrTKtIKldBpI2EBYXKOvjT8v+ghZJU9mH+bxRF7A=; b=t6IYCoThl1nKXRXDpqNXKDxnYU
 PZwL+pHBwkimmE1prCgjGwGNglOGeKqfECFqozNiYPcI6BwP+0NdwzP7cmBEIy23kJTxOn5XMkUed
 RtFa25cV4I0qhrnLtoFMpcASNOpsJeb4UT/bXZbXVU0m1XxD+Bw99QftvgYkWZLoAp1k=;
Received: from [84.212.220.105] (helo=elva)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1mREpH-0000dv-Uq; Fri, 17 Sep 2021 16:26:54 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Jonas Bernoulli <jonas@HIDDEN>
Subject: Re: bug#50511: [PATCH] No longer raise error when authentication
 failed
References: <id:87k0jnl0ts.fsf@HIDDEN>
 <20210916183211.5669-1-jonas@HIDDEN>
Date: Fri, 17 Sep 2021 16:26:51 +0200
In-Reply-To: <20210916183211.5669-1-jonas@HIDDEN> (Jonas Bernoulli's
 message of "Thu, 16 Sep 2021 20:32:11 +0200")
Message-ID: <87fsu3xopg.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Jonas Bernoulli <jonas@HIDDEN> writes: > *
 lisp/url/url-http.el
 (url-http-handle-authentication): Return t > instead of raising an error,
 instructing the caller to invoke the > request specific error handler
 (bug#50511).
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 50511
Cc: 50511 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Jonas Bernoulli <jonas@HIDDEN> writes:

> * lisp/url/url-http.el (url-http-handle-authentication): Return t
> instead of raising an error, instructing the caller to invoke the
> request specific error handler (bug#50511).

Looks good to me; please go ahead and push.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50511; Package emacs. Full text available.

Message received at 50511 <at> debbugs.gnu.org:


Received: (at 50511) by debbugs.gnu.org; 16 Sep 2021 18:32:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 16 14:32:20 2021
Received: from localhost ([127.0.0.1]:56546 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mQwBI-0002iy-9Q
	for submit <at> debbugs.gnu.org; Thu, 16 Sep 2021 14:32:20 -0400
Received: from mail.hostpark.net ([212.243.197.30]:50682)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jonas@HIDDEN>) id 1mQwBG-0002in-Hi
 for 50511 <at> debbugs.gnu.org; Thu, 16 Sep 2021 14:32:19 -0400
Received: from localhost (localhost [127.0.0.1])
 by mail.hostpark.net (Postfix) with ESMTP id C8C7E165C9;
 Thu, 16 Sep 2021 20:32:16 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h=
 content-transfer-encoding:mime-version:references:in-reply-to
 :x-mailer:message-id:date:date:subject:subject:from:from
 :received:received; s=sel2011a; t=1631817134; bh=s1TCh/ow5v+yXrn
 jVH9kNvJ4VM0u0R+IcCUXUliTMQM=; b=NHbfbQafUgJbObrY+UxgAdxjNTwVxxf
 uhBz+ehiXVJIf1tLLpIkPhjqdv5WTYEqiEU8FyL3+wnmtCceRZJHEEDPgvcHiCb3
 VWhRLIXQAs4ZEXNpiZclgcEsekq1t2cjdLsef1wq88/ZhU019BLljPPPrDYSIktz
 ZeRLvxJr5uCE=
X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net
Received: from mail.hostpark.net ([127.0.0.1])
 by localhost (mail0.hostpark.net [127.0.0.1]) (amavisd-new, port 10224)
 with ESMTP id D96Gqn7KJxeW; Thu, 16 Sep 2021 20:32:14 +0200 (CEST)
Received: from customer (localhost [127.0.0.1])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by mail.hostpark.net (Postfix) with ESMTPSA id 948D1165C1;
 Thu, 16 Sep 2021 20:32:11 +0200 (CEST)
From: Jonas Bernoulli <jonas@HIDDEN>
To: 50511 <at> debbugs.gnu.org
Subject: [PATCH] No longer raise error when authentication failed
Date: Thu, 16 Sep 2021 20:32:11 +0200
Message-Id: <20210916183211.5669-1-jonas@HIDDEN>
X-Mailer: git-send-email 2.33.0
In-Reply-To: <id:87k0jnl0ts.fsf@HIDDEN>
References: <id:87k0jnl0ts.fsf@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 50511
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

* lisp/url/url-http.el (url-http-handle-authentication): Return t
instead of raising an error, instructing the caller to invoke the
request specific error handler (bug#50511).
---
 lisp/url/url-http.el | 94 ++++++++++++++++++++++----------------------
 1 file changed, 47 insertions(+), 47 deletions(-)

diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
index ba13a17a8f..1530016397 100644
--- a/lisp/url/url-http.el
+++ b/lisp/url/url-http.el
@@ -462,53 +462,53 @@ url-http-handle-authentication
     ;; credentials to the server, and they were wrong, so just give
     ;; up.
     (let ((authorization (assoc "Authorization" url-http-extra-headers)))
-      (when (and authorization
-		 (not (string-match "^NTLM " (cdr authorization))))
-	(error "Wrong authorization used for %s" url)))
-
-    ;; find strongest supported auth
-    (dolist (this-auth auths)
-      (setq this-auth (url-eat-trailing-space
-		       (url-strip-leading-spaces
-			this-auth)))
-      (let* ((this-type
-	      (downcase (if (string-match "[ \t]" this-auth)
-                            (substring this-auth 0 (match-beginning 0))
-                          this-auth)))
-	     (registered (url-auth-registered this-type))
-	     (this-strength (cddr registered)))
-	(when (and registered (> this-strength strength))
-	  (setq auth this-auth
-		type this-type
-		strength this-strength))))
-
-    (if (not (url-auth-registered type))
-	(progn
-	  (widen)
-	  (goto-char (point-max))
-	  (insert "<hr>Sorry, but I do not know how to handle " (or type auth url "")
-		  " authentication.  If you'd like to write it,"
-		  " please use M-x report-emacs-bug RET.<hr>")
-          ;; We used to set a `status' var (declared "special") but I can't
-          ;; find the corresponding let-binding, so it's probably an error.
-          ;; FIXME: Maybe it was supposed to set `success', i.e. to return t?
-          ;; (setq status t)
-          nil) ;; Not success yet.
-
-      (let* ((args (url-parse-args (subst-char-in-string ?, ?\; auth)))
-	     (auth (url-get-authentication auth-url
-					   (cdr-safe (assoc "realm" args))
-					   type t args)))
-	(if (not auth)
-            t                           ;Success.
-	  (push (cons (if proxy "Proxy-Authorization" "Authorization") auth)
-		url-http-extra-headers)
-	  (let ((url-request-method url-http-method)
-		(url-request-data url-http-data)
-		(url-request-extra-headers url-http-extra-headers))
-	    (url-retrieve-internal url url-callback-function
-				   url-callback-arguments))
-          nil))))) ;; Not success yet.
+      (if (and authorization
+               (not (string-match "^NTLM " (cdr authorization)))) ;Bug#43566
+          t ;; Instruct caller to signal an error.  Bug#50511
+        ;; Find strongest supported auth.
+        (dolist (this-auth auths)
+          (setq this-auth (url-eat-trailing-space
+                           (url-strip-leading-spaces
+                            this-auth)))
+          (let* ((this-type
+                  (downcase (if (string-match "[ \t]" this-auth)
+                                (substring this-auth 0 (match-beginning 0))
+                              this-auth)))
+                 (registered (url-auth-registered this-type))
+                 (this-strength (cddr registered)))
+            (when (and registered (> this-strength strength))
+              (setq auth this-auth
+                    type this-type
+                    strength this-strength))))
+
+        (if (not (url-auth-registered type))
+            (progn
+              (widen)
+              (goto-char (point-max))
+              (insert "<hr>Sorry, but I do not know how to handle "
+                      (or type auth url "")
+                      " authentication.  If you'd like to write it,"
+                      " please use M-x report-emacs-bug RET.<hr>")
+              ;; We used to set a `status' var (declared "special") but I can't
+              ;; find the corresponding let-binding, so it's probably an error.
+              ;; FIXME: Maybe it was supposed to set `success', i.e. to return t?
+              ;; (setq status t)
+              nil) ;; Not success yet.
+
+          (let* ((args (url-parse-args (subst-char-in-string ?, ?\; auth)))
+                 (auth (url-get-authentication auth-url
+                                               (cdr-safe (assoc "realm" args))
+                                               type t args)))
+            (if (not auth)
+                t                           ;Success.
+              (push (cons (if proxy "Proxy-Authorization" "Authorization") auth)
+                    url-http-extra-headers)
+              (let ((url-request-method url-http-method)
+                    (url-request-data url-http-data)
+                    (url-request-extra-headers url-http-extra-headers))
+                (url-retrieve-internal url url-callback-function
+                                       url-callback-arguments))
+              nil))))))) ;; Not success yet.
 
 (defun url-http-parse-response ()
   "Parse just the response code."
-- 
2.33.0





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50511; Package emacs. Full text available.

Message received at 50511 <at> debbugs.gnu.org:


Received: (at 50511) by debbugs.gnu.org; 11 Sep 2021 13:05:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 11 09:05:30 2021
Received: from localhost ([127.0.0.1]:39763 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mP2hG-00037p-36
	for submit <at> debbugs.gnu.org; Sat, 11 Sep 2021 09:05:30 -0400
Received: from quimby.gnus.org ([95.216.78.240]:36912)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1mP2hE-00037b-Db
 for 50511 <at> debbugs.gnu.org; Sat, 11 Sep 2021 09:05:28 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Cc3UvXXD2Q895VQTV/4uzu9kp/M5gCvUyLEvPpFjQ/0=; b=fxxLrhViH+nOeedV/Z5mf89nzU
 kWem3grc/HM1C/QCQtM910hwlMTcs3P0H4lnappfr4KLhTEipdKSuoZgzcugjG0JNOD+qeVkKaUEi
 v2sFr67rQsCoPuRBLXzaDTY+Iil2wuxExQm1tpWZRZdk/GHZ/KoenwLqzoI7Pgi8lUXM=;
Received: from [84.212.220.105] (helo=elva)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1mP2h5-0000LK-U8; Sat, 11 Sep 2021 15:05:22 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Jonas Bernoulli <jonas@HIDDEN>
Subject: Re: bug#50511: 27.2; url-http-handle-authentication should not
 raise error
References: <87y284l85d.fsf@HIDDEN>
Date: Sat, 11 Sep 2021 15:05:19 +0200
In-Reply-To: <87y284l85d.fsf@HIDDEN> (Jonas Bernoulli's message of "Fri,
 10 Sep 2021 18:14:54 +0200")
Message-ID: <87k0jnl0ts.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Jonas Bernoulli <jonas@HIDDEN> writes: > Since [1:
 64b469f6ae]
 url-http-handle-authentication raises an error > when it detects that we
 already tried to make an authenticated request. > > 1: 2019-07-26
 64b469f6ae8173116ec948ac43cd44efe4b5a [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 50511
Cc: 50511 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Jonas Bernoulli <jonas@HIDDEN> writes:

> Since [1: 64b469f6ae] url-http-handle-authentication raises an error
> when it detects that we already tried to make an authenticated request.
>
> 1: 2019-07-26 64b469f6ae8173116ec948ac43cd44efe4b5a221
>    Don't infloop in url.el when sending invalid basic auth
>
> Instead of signaling an error using `error', it should simply return t
> to indicate that no further requests should be made and the response
> data (in this case error data) should be passed to the handler, i.e. to
> indicate that the request "successfully failed".  Then the error handler
> can inspect the response and decide how to react.
>
> This is how it is done for all other https response codes, including all
> other error codes.  This approach also solves the infloop issue but also
> makes it possible to use an error handler as intended.

Makes sense.  Can you propose a patch for this (since you can reproduce
the problem and verify that the patch fixes it)?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#50511; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 10 Sep 2021 16:15:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 10 12:15:09 2021
Received: from localhost ([127.0.0.1]:39030 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mOjBE-0005No-P6
	for submit <at> debbugs.gnu.org; Fri, 10 Sep 2021 12:15:08 -0400
Received: from lists.gnu.org ([209.51.188.17]:37872)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jonas@HIDDEN>) id 1mOjBD-0005Nh-1D
 for submit <at> debbugs.gnu.org; Fri, 10 Sep 2021 12:15:07 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:35092)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <jonas@HIDDEN>) id 1mOjBC-0001Jn-RX
 for bug-gnu-emacs@HIDDEN; Fri, 10 Sep 2021 12:15:06 -0400
Received: from mail.hostpark.net ([212.243.197.30]:39862)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <jonas@HIDDEN>) id 1mOjBA-00085x-Lw
 for bug-gnu-emacs@HIDDEN; Fri, 10 Sep 2021 12:15:06 -0400
Received: from localhost (localhost [127.0.0.1])
 by mail.hostpark.net (Postfix) with ESMTP id D9BE6163FC;
 Fri, 10 Sep 2021 18:14:58 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bernoul.li; h=
 content-type:content-type:mime-version:message-id:date:date
 :subject:subject:from:from:received:received; s=sel2011a; t=
 1631290496; bh=RO/EyGPe30nqlhIW/AKyqhkgOpRakTFXt3Rwzh/YKM8=; b=3
 p0YNJ9qV0p2fDLWy4QSupt+146eHrpAyJqcdpGwWXsDOR40ZnV/X4NF32T0Fqa/J
 /N91dAShBfUPbK8GowmXdfM5OhRb79v/qWat6a19qyq5F1fG7S4fMxK5pdktdPO+
 cJTdY1HhjtpgPAQOgjme7ExIaZDP61Kp6onalOz64M=
X-Virus-Scanned: by Hostpark/NetZone Mailprotection at hostpark.net
Received: from mail.hostpark.net ([127.0.0.1])
 by localhost (mail1.hostpark.net [127.0.0.1]) (amavisd-new, port 10224)
 with ESMTP id s6dwBFQxLMGP; Fri, 10 Sep 2021 18:14:56 +0200 (CEST)
Received: from customer (localhost [127.0.0.1])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest
 SHA256) (No client certificate requested)
 by mail.hostpark.net (Postfix) with ESMTPSA id AD1E81647F;
 Fri, 10 Sep 2021 18:14:56 +0200 (CEST)
From: Jonas Bernoulli <jonas@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 27.2; url-http-handle-authentication should not raise error
Date: Fri, 10 Sep 2021 18:14:54 +0200
Message-ID: <87y284l85d.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: none client-ip=212.243.197.30; envelope-from=jonas@HIDDEN;
 helo=mail.hostpark.net
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001,
 SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: submit
Cc: Lars Ingebrigtsen <larsi@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Since [1: 64b469f6ae] url-http-handle-authentication raises an error
when it detects that we already tried to make an authenticated request.

1: 2019-07-26 64b469f6ae8173116ec948ac43cd44efe4b5a221
   Don't infloop in url.el when sending invalid basic auth

Instead of signaling an error using `error', it should simply return t
to indicate that no further requests should be made and the response
data (in this case error data) should be passed to the handler, i.e. to
indicate that the request "successfully failed".  Then the error handler
can inspect the response and decide how to react.

This is how it is done for all other https response codes, including all
other error codes.  This approach also solves the infloop issue but also
makes it possible to use an error handler as intended.

     Jonas




Acknowledgement sent to Jonas Bernoulli <jonas@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#50511; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 20 Sep 2021 19:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.