Re: [PATCH] Prompt for a username when an HTTP request 401s

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Scott Chacon <schacon@xxxxxxxxx> writes:

> When an HTTP request returns a 401, Git will currently fail with a
> confusing message saying that it got a 401, which is not very
> descriptive.
>
> Currently if a user wants to use Git over HTTP, they have to use one
> URL with the username in the URL (e.g. "http://user@xxxxxxxx/repo.git";)
> for write access and another without the username for unauthenticated
> read access (unless they want to be prompted for the password each
> time). However, since the HTTP servers will return a 401 if an action
> requires authentication, we can prompt for username and password if we
> see this, allowing us to use a single URL for both purposes.

Thanks; this illustrates the issue you are trying to solve much easier to
see, don't you agree?

An obvious enhancement could be to make "http://user@xxxxxxxx/repo.git";
ask for password lazily.  Then such a URL can be used even for an access
that does not need authentication and the user does not have to prompted
for the password each time, which was what you wanted to really solve, no?

Actually that could not just be an enhancement, but might be a better
alternative solution to the problem, but I haven't thought things
through.

> Signed-off-by: Scott Chacon <schacon@xxxxxxxxx>
> ---
>
> Updated the comments style and the commit message for Junio.

Heh, Message update is never _for_ me.  It is to clarify the problem you
are trying to solve, so that we can be certain that the proposed patch is
the best approach to solve it.

> diff --git a/http.c b/http.c
> index 4814217..51253e1 100644
> --- a/http.c
> +++ b/http.c
> @@ -815,7 +815,21 @@ static int http_request(const char *url, void
> *result, int target, int options)

I fixed this up when I queued the previous version, and you have the same
line wrapping problem in this version, which I have fixed, too, before
replacing what was queued to 'pu'.

I mention this not as a complaint (but I would appreciate if you try to be
careful next time, especially if you plan to post more patches and to
become a regular contributor), but primarily because it is curious that
only the hunk headers are wrapped but not these long lines we see below:

> ...
> +			} else {
> +				/*
> +				 * git_getpass is needed here because its very likely stdin/stdout are
> ...

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]