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

Re: clone from url with email address as username?(escaping @ symbol)

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Sep 29, 2009, 16:59 UTC
Message-ID
<vpq63b1u1p6.fsf@bauges.imag.fr>
In-Reply-To
<970bc7c80909290831l59b7fc4at4ec0082f42f3ef87@mail.gmail.com>
Ben Bennett <benbennett@gmail.com> writes:
> I am attempting to do a https clone. The username is an email address
> but when I do a clone here is what happens.
Hmm, right, it works with ssh, but not http.
I tried a quick fix like this:
diff --git a/http.c b/http.c
index 23b2a19..361a6be 100644
--- a/http.c
+++ b/http.c
@@ -281,9 +281,10 @@ static void http_auth_init(const char *url)
         * "proto://<host>/..."?
         */
        cp += 3;
-       at = strchr(cp, '@');
        colon = strchr(cp, ':');
        slash = strchrnul(cp, '/');
+       for(at = slash-1; *at != '@' && *at != '/'; at--)
+               continue;
        if (!at || slash <= at)
                return; /* No credentials */
        if (!colon || at <= colon) {

Unfortunately, it seems the complete URL is passed to curl, and curl
is the one doing it wrong. Indeed:

$ curl -v https://user@email.com@server.com/path/                                          
* getaddrinfo(3) failed for email.com@server.com:443
* Couldn't resolve host 'email.com@server.com'
* Closing connection #0
curl: (6) Couldn't resolve host 'email.com@server.com'

Now for the good news:

http://curl.haxx.se/mail/lib-2006-02/0134.html
http://sourceforge.net/tracker/index.php?func=detail&aid=2826621&group_id=976&atid=100976

In short, you have to use %40 to escape the @, and curl does it this
way because the RFC doesn't allow @ in usernames.
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Ben BennettNext: Matthieu Moy
Message 6 of 15 in “clone from url with email address as username?(escaping @ symbol)”
  1. Ben BennettSep 29, 2009
  2. Sverre RabbelierSep 29, 2009
  3. Matthieu MoySep 29, 2009
  4. Sverre RabbelierSep 29, 2009
  5. Ben BennettSep 29, 2009
  6. Matthieu MoySep 29, 2009
  7. Matthieu MoySep 29, 2009
  8. Daniel StenbergSep 29, 2009
  9. Matthieu MoySep 29, 2009
  10. Daniel StenbergSep 29, 2009
  11. Matthieu MoySep 29, 2009
  12. Ben BennettSep 29, 2009
  13. Matthieu MoySep 29, 2009
  14. Matthieu MoySep 29, 2009
  15. Ben BennettSep 29, 2009

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.