X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=http.c;h=9e767723ed1045445e91e79489cb8ec8bb861965;hb=2f633f41d69527cdd9ff5b8e04a752f1774fc3df;hp=17bcf19c5001d309bdbf524e7d3817cf3482a3c3;hpb=6aa6a92fb61f0ba295b349222b8966c46ef0ba58;p=git.git diff --git a/http.c b/http.c index 17bcf19c5..9e767723e 100644 --- a/http.c +++ b/http.c @@ -2,6 +2,7 @@ #include "pack.h" #include "sideband.h" #include "run-command.h" +#include "url.h" int data_received; int active_requests; @@ -302,7 +303,7 @@ static CURL *get_curl_handle(void) static void http_auth_init(const char *url) { - char *at, *colon, *cp, *slash; + char *at, *colon, *cp, *slash, *decoded; int len; cp = strstr(url, "://"); @@ -327,16 +328,25 @@ static void http_auth_init(const char *url) user_name = xmalloc(len + 1); memcpy(user_name, cp, len); user_name[len] = '\0'; + decoded = url_decode(user_name); + free(user_name); + user_name = decoded; user_pass = NULL; } else { len = colon - cp; user_name = xmalloc(len + 1); memcpy(user_name, cp, len); user_name[len] = '\0'; + decoded = url_decode(user_name); + free(user_name); + user_name = decoded; len = at - (colon + 1); user_pass = xmalloc(len + 1); memcpy(user_pass, colon + 1, len); user_pass[len] = '\0'; + decoded = url_decode(user_pass); + free(user_pass); + user_pass = decoded; } } @@ -733,13 +743,6 @@ static inline int hex(int v) return 'A' + v - 10; } -void end_url_with_slash(struct strbuf *buf, const char *url) -{ - strbuf_addstr(buf, url); - if (buf->len && buf->buf[buf->len - 1] != '/') - strbuf_addstr(buf, "/"); -} - static char *quote_ref_url(const char *base, const char *ref) { struct strbuf buf = STRBUF_INIT;