unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#50511: [PATCH] No longer raise error when authentication failed
       [not found] <id:87k0jnl0ts.fsf@gnus.org>
@ 2021-09-16 18:32 ` Jonas Bernoulli
  2021-09-17 14:26   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Jonas Bernoulli @ 2021-09-16 18:32 UTC (permalink / raw)
  To: 50511

* 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






^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#50511: [PATCH] No longer raise error when authentication failed
  2021-09-16 18:32 ` bug#50511: [PATCH] No longer raise error when authentication failed Jonas Bernoulli
@ 2021-09-17 14:26   ` Lars Ingebrigtsen
  2021-09-20 19:19     ` Jonas Bernoulli
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-17 14:26 UTC (permalink / raw)
  To: Jonas Bernoulli; +Cc: 50511

Jonas Bernoulli <jonas@bernoul.li> 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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#50511: [PATCH] No longer raise error when authentication failed
  2021-09-17 14:26   ` Lars Ingebrigtsen
@ 2021-09-20 19:19     ` Jonas Bernoulli
  2021-09-20 19:24       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Jonas Bernoulli @ 2021-09-20 19:19 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 50511

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

Done. Please close.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#50511: [PATCH] No longer raise error when authentication failed
  2021-09-20 19:19     ` Jonas Bernoulli
@ 2021-09-20 19:24       ` Lars Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-20 19:24 UTC (permalink / raw)
  To: Jonas Bernoulli; +Cc: 50511

Jonas Bernoulli <jonas@bernoul.li> 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





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-09-20 19:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <id:87k0jnl0ts.fsf@gnus.org>
2021-09-16 18:32 ` bug#50511: [PATCH] No longer raise error when authentication failed Jonas Bernoulli
2021-09-17 14:26   ` Lars Ingebrigtsen
2021-09-20 19:19     ` Jonas Bernoulli
2021-09-20 19:24       ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).