all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Edward O'Connor <hober0@gmail.com>
To: emacs-devel@gnu.org
Subject: url-basic-auth -- default user/password prompt to values from URL
Date: Fri, 03 Aug 2007 23:30:22 -0400	[thread overview]
Message-ID: <86fy30yo1d.fsf@rakim.cfhp.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 735 bytes --]

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  <hober0@gmail.com>

        * url/url-auth.el (url-basic-auth): When prompting for username
          and password, default to the username and password in the URL.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: default user/password prompt to values from URL --]
[-- Type: text/x-patch, Size: 996 bytes --]

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

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

                 reply	other threads:[~2007-08-04  3:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86fy30yo1d.fsf@rakim.cfhp.org \
    --to=hober0@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.