diff options
author | Stefan Naewe <stefan.naewe@gmail.com> | 2011-11-04 08:03:08 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-11-04 09:47:18 -0700 |
commit | 986bbc0842334f0e07731fa37f2a55d2930a5b8c (patch) | |
tree | c8a0800c0793248745f2807658781168e635f750 /mergetools/defaults | |
parent | Merge branch 'jk/http-auth' (diff) | |
download | tgif-986bbc0842334f0e07731fa37f2a55d2930a5b8c.tar.xz |
http: don't always prompt for password
When a username is already specified at the beginning of any HTTP
transaction (e.g. "git push https://user@hosting.example.com/project.git"
or "git ls-remote https://user@hosting.example.com/project.git"), the code
interactively asks for a password before calling into the libcurl library.
It is very likely that the reason why user included the username in the
URL is because the user knows that it would require authentication to
access the resource. Asking for the password upfront would save one
roundtrip to get a 401 response, getting the password and then retrying
the request. This is a reasonable optimization.
HOWEVER.
This is done even when $HOME/.netrc might have a corresponding entry to
access the site, or the site does not require authentication to access the
resource after all. But neither condition can be determined until we call
into libcurl library (we do not read and parse $HOME/.netrc ourselves). In
these cases, the user is forced to respond to the password prompt, only to
give a password that is not used in the HTTP transaction. If the password
is in $HOME/.netrc, an empty input would later let the libcurl layer to
pick up the password from there, and if the resource does not require
authentication, any input would be taken and then discarded without
getting used. It is wasteful to ask this unused information to the end
user.
Reduce the confusion by not trying to optimize for this case and always
incur roundtrip penalty. An alternative might be to document this and keep
this round-trip optimization as-is.
Signed-off-by: Stefan Naewe <stefan.naewe@gmail.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'mergetools/defaults')
0 files changed, 0 insertions, 0 deletions