git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v5 2/5] http: handle proxy proactive authentication

From
Jeff King <peff@peff.net>
Date
Apr 12, 2012, 20:58 UTC
Message-ID
<20120412205836.GB21018@sigill.intra.peff.net>
In-Reply-To
<7vwr5leyj5.fsf@alter.siamese.dyndns.org>
On Thu, Apr 12, 2012 at 08:54:22AM -0700, Junio C Hamano wrote:
Show 16 quoted lines
> >> I haven't formed an opinion on what the proper solution should be, but
> >> either the credential_from_url() function needs to be updated to accept
> >> the scp style [user@]<host>:<port> argument, or this specific caller
> >> should take the responsibility to do special case the syntax.
> >
> > Well, calling the above "scp" style is a mistake (it is not scp style at
> > all), but the patch to teach the credentail_from_url() to handle the proxy
> > specification may look like this:
> 
> Jeff, do you have an opinion on this?  I briefly wondered if we also want
> to teach the traditional [user@]host:/path/to/repo to this function (it is
> not a URL in RFC1738 sense, but it is in the remote.$name.url sense), but
> because SSH does its own thing interacting with agents, perhaps it may not
> help to teach our credential layer to store and supply cached passphrases
> (or passwords, if the authentication is done by merely sending password
> over the encrypted channel).

My first instinct was "that is not a URL, and should be handled outside this function". In particular, it has no protocol field, and that is an important part of the credential-matching process. It would be up to the caller to supply something sane in the protocol portion. In this case, it would probably be "http" (unless we want to distinguish http proxies from http end-points in the credential store, but I doubt that is useful). But for an ssh-style URL, it would be "ssh". So already the abstraction is a little bit leaky.

As far as parsing ssh goes, I'm not sure that is unambiguous with the proxy syntax. If you see "127.0.0.1:1234", is that short for "http://127.0.0.1:1234/" (what the proxy code wants), or for "ssh://127.0.0.1/1234" (what ssh code would want)? The former seems less odd to me, as it really is just a URL missing some components. The latter is a true alternative syntax.

Like you said, I don't think we will ever want to handle ssh credentials, though. There is already a solution for people who don't want to input ssh passwords, and it is much more advanced and well-supported within the community than what we would provide.

> A safer approach might be to keep externally visible API to this function
> as before, but add another function only for the use of http_proxy and
> friends (whose kosher format is "host:address" without the "<scheme>://"
> part), and call it from the codepath broken by the patch.

I think that would be cleaner conceptually, but it also means reimplementing the user/password-parsing logic. And given that I don't think we want to handle ssh, and that the semantics in your patch are the only sane ones to me, it is not so bad. The caller just needs to be aware of filling in the "protocol" field. Perhaps we could have an alternate version that supplies a "default protocol" parameter. The presence of that parameter would activate this code-path and automatically fill in the protocol field.

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 13 in “http: handle proxy proactive authentication”
  1. 2/5 http: handle proxy proactive authenticationNelson Benitez Leon, Mar 13, 2012
  2. Junio C HamanoApr 9, 2012
  3. Junio C HamanoApr 10, 2012
  4. Junio C HamanoApr 12, 2012
  5. Jeff KingApr 12, 2012
  6. Junio C HamanoApr 12, 2012
  7. Jeff KingApr 12, 2012
  8. Junio C HamanoApr 12, 2012
  9. Jeff KingApr 12, 2012
  10. Junio C HamanoApr 13, 2012
  11. Jeff KingApr 13, 2012
  12. Jeff KingApr 13, 2012
  13. Junio C HamanoApr 19, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.