]> code.delx.au - gnu-emacs-elpa/commitdiff
url-http-ntlm.el (url-ntlm-auth): Move defun near end of file
authorThomas Fitzsimmons <fitzsim@fitzsim.org>
Tue, 27 Oct 2015 02:15:01 +0000 (22:15 -0400)
committerThomas Fitzsimmons <fitzsim@fitzsim.org>
Thu, 18 Feb 2016 03:19:53 +0000 (22:19 -0500)
packages/url-http-ntlm/url-http-ntlm.el

index 86649a67ddd43ae008694e8cdd3ee9f0a647d764..302915f9dd7c2c94a44966135c63c3d55be592c3 100644 (file)
@@ -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)