How does emacs url package handle authentication? -


I have not seen a really good example on the Web How can I add authentication for a request like this?

  (login login-show-post) (interactive) (but (url-request-method "GET") (url-request -extra-header '(("content-type". "Application /) ") (URL-Get" http: // localhost: 3000 / essay / 1.xml "(lambda (status) (switch-to-buffer (current-buffer))))  

for example, a The user and the administrator have: admin?

I have a belief that url.el is designed for most interactive operations That is, you do a call without authorization, the server responds with a 403 status of "authorization required" (correct code?) And the url.el user's name and password To ask the user.

You can see your code, where I try to make the program work.

Actually, I'll create an HTTP authorization header (base64 encoding is adding the correct headers to the correctly formatted string and D url-request-extra-headers ) then a In the second step I need to add advice to url-http-handle-authentication so that the credentials passed to the user are not acceptable.

This seems like a lot like the url.el but it works for me and this is the only way I can do it.


Your code looks like this: Flag to block Url.el's normal interactive authorization process. (Defyvar xyz-user-name "admin") (defyvar xyz-password "admin") (defyvar xyz-block-authorization void) "(Xyz-block-authorization ad-do- Until it (ad-activate 'url-http-handle-authentication) (defunvice url-http-handle- authentication (almost xyz-fix) (defun login-show-post () (interactive) (let xyz-block -authorization t (URL-request-method "GET") (url-request-extra-header` ((("content-type". "App / XML") ("authorization"., (Concat "Basic" ( Base64-encode-string (concat xyz-user-name ":" xyz-password)))))) (URL-Recover "http: // localhost: 3000 / essay / 1.xml" (lambda (status) ( Switch-to-buffer (current-b Fur))))))


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -