[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
url-basic-auth -- default user/password prompt to values from URL
From: |
Edward O'Connor |
Subject: |
url-basic-auth -- default user/password prompt to values from URL |
Date: |
Fri, 03 Aug 2007 23:30:22 -0400 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/22.1 (berkeley-unix) |
Hi all,
I've been hacking a bit on some code that uses url.el to talk to a
website which uses HTTP Basic authentication. I'm specifying the
username/password combination in the URL itself, and yet
`url-basic-auth' prompts me for my username and password.
Fixing that looks potentially complicated, so I thought an incremental
improvement would be for the prompts to pre-populate with the URL's
username/password combo. A patch is attached that does just that. It
would be great if this made it in before 22.2.
Here's a ChangeLog entry:
2007-08-04 Edward O'Connor <address@hidden>
* url/url-auth.el (url-basic-auth): When prompting for username
and password, default to the username and password in the URL.
cvs diff: Diffing .
Index: url-auth.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/url/url-auth.el,v
retrieving revision 1.14
diff -u -r1.14 url-auth.el
--- url-auth.el 26 Jul 2007 05:27:36 -0000 1.14
+++ url-auth.el 4 Aug 2007 03:18:35 -0000
@@ -68,7 +68,9 @@
(server (url-host href))
(port (url-port href))
(path (url-filename href))
- user pass byserv retval data)
+ (user (url-user href))
+ (pass (url-password href))
+ byserv retval data)
(setq server (format "%s:%d" server port)
path (cond
(realm realm)
@@ -79,8 +81,8 @@
(cond
((and prompt (not byserv))
(setq user (read-string (url-auth-user-prompt url realm)
- (user-real-login-name))
- pass (read-passwd "Password: "))
+ (or user (user-real-login-name)))
+ pass (read-passwd "Password: " nil (or pass "")))
(set url-basic-auth-storage
(cons (list server
(cons path
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- url-basic-auth -- default user/password prompt to values from URL,
Edward O'Connor <=