emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/url-http-ntlm 5c47391 13/42: url-http-ntlm.el (url-ntlm


From: Stefan Monnier
Subject: [elpa] externals/url-http-ntlm 5c47391 13/42: url-http-ntlm.el (url-ntlm-auth): Move defun near end of file
Date: Sat, 28 Nov 2020 17:19:44 -0500 (EST)

branch: externals/url-http-ntlm
commit 5c47391579dce3257c45a23b6386f59861d0e17f
Author: Thomas Fitzsimmons <fitzsim@fitzsim.org>
Commit: Thomas Fitzsimmons <fitzsim@fitzsim.org>

    url-http-ntlm.el (url-ntlm-auth): Move defun near end of file
---
 url-http-ntlm.el | 70 ++++++++++++++++++++++++++++----------------------------
 1 file changed, 35 insertions(+), 35 deletions(-)

diff --git a/url-http-ntlm.el b/url-http-ntlm.el
index 86649a6..302915f 100644
--- a/url-http-ntlm.el
+++ b/url-http-ntlm.el
@@ -53,41 +53,6 @@ The username can contain the domain name, in the form 
\"user@domain\".
 
 Note that for any server, only one user and password is ever stored.")
 
-(defun url-ntlm-auth (url &optional prompt overwrite realm args)
-  "Return an NTLM HTTP authorization header.
-Get the contents of the Authorization header for a HTTP response
-using NTLM authentication, to access URL.  Because NTLM is a
-two-step process, this function expects to be called twice, first
-to generate the NTLM type 1 message (request), then to respond to
-the server's type 2 message (challenge) with a suitable response.
-
-PROMPT, OVERWRITE, and REALM are ignored.
-
-ARGS is expected to contain the WWW-Authentication header from
-the server's last response.  These are used by
-`url-http-get-stage' to determine what stage we are at."
-  (url-http-ntlm-ensure-keepalive)
-  (let ((stage (url-http-ntlm-get-stage args)))
-    (case stage
-      ;; NTLM Type 1 message: the request
-      (:request
-       (destructuring-bind (&optional server user hash)
-          (url-http-ntlm-authorisation url)
-        (when server
-          (url-http-ntlm-string
-           (ntlm-build-auth-request user server)))))
-      ;; NTLM Type 3 message: the response
-      (:response
-       (let ((challenge (url-http-ntlm-get-challenge)))
-        (destructuring-bind (server user hash)
-            (url-http-ntlm-authorisation url)
-          (url-http-ntlm-string
-           (ntlm-build-auth-response challenge
-                                     user
-                                     hash)))))
-      (:error
-       (url-http-ntlm-authorisation url :clear)))))
-
 (defun url-http-ntlm-ensure-keepalive ()
   "Report an error if `url-http-attempt-keepalives' is not set."
   (assert url-http-attempt-keepalives
@@ -204,6 +169,41 @@ stored."
   "Return DATA encoded as an NTLM string."
   (concat "NTLM " (base64-encode-string data :nobreak)))
 
+(defun url-ntlm-auth (url &optional prompt overwrite realm args)
+  "Return an NTLM HTTP authorization header.
+Get the contents of the Authorization header for a HTTP response
+using NTLM authentication, to access URL.  Because NTLM is a
+two-step process, this function expects to be called twice, first
+to generate the NTLM type 1 message (request), then to respond to
+the server's type 2 message (challenge) with a suitable response.
+
+PROMPT, OVERWRITE, and REALM are ignored.
+
+ARGS is expected to contain the WWW-Authentication header from
+the server's last response.  These are used by
+`url-http-get-stage' to determine what stage we are at."
+  (url-http-ntlm-ensure-keepalive)
+  (let ((stage (url-http-ntlm-get-stage args)))
+    (case stage
+      ;; NTLM Type 1 message: the request
+      (:request
+       (destructuring-bind (&optional server user hash)
+          (url-http-ntlm-authorisation url)
+        (when server
+          (url-http-ntlm-string
+           (ntlm-build-auth-request user server)))))
+      ;; NTLM Type 3 message: the response
+      (:response
+       (let ((challenge (url-http-ntlm-get-challenge)))
+        (destructuring-bind (server user hash)
+            (url-http-ntlm-authorisation url)
+          (url-http-ntlm-string
+           (ntlm-build-auth-response challenge
+                                     user
+                                     hash)))))
+      (:error
+       (url-http-ntlm-authorisation url :clear)))))
+
 (url-register-auth-scheme "ntlm" nil 8)
 
 (provide 'url-http-ntlm)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]