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

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

 



Is it escaping the %40 when passed down? I am getting an error 401  ,
and checking the server logs , it is passing the %40 to the server in
the username.
Running curl from command line , I can connect, but through git , the
username is getting mangled or I have something screwed up.
 I will look at http.c tonight after work, to see if I am messing something up.

Thanks,
Ben


On Tue, Sep 29, 2009 at 11:59 AM, Matthieu Moy
<Matthieu.Moy@xxxxxxxxxxxxxxx> wrote:
> Ben Bennett <benbennett@xxxxxxxxx> 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@xxxxxxxxx@server.com/path/
> * getaddrinfo(3) failed for email.com@xxxxxxxxxx:443
> * Couldn't resolve host 'email.com@xxxxxxxxxx'
> * Closing connection #0
> curl: (6) Couldn't resolve host 'email.com@xxxxxxxxxx'
>
> 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/
>
--
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]