diff options
author | Gabriel Corona <gabriel.corona@enst-bretagne.fr> | 2010-11-14 02:51:15 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-11-17 13:07:43 -0800 |
commit | f39f72d8cf03b61407f64460eba3357ec532280e (patch) | |
tree | 5b529f01b42a0ba2755dc37c09eec1d2ab187375 /http.c | |
parent | 3cf8fe1d26edd7c4cce6593d70212970f8b0bbc0 (diff) | |
download | git-f39f72d8cf03b61407f64460eba3357ec532280e.tar.gz |
Fix username and password extraction from HTTP URLs
Change the authentification initialisation to percent-decode username
and password for HTTP URLs.
Signed-off-by: Gabriel Corona <gabriel.corona@enst-bretagne.fr>
Acked-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'http.c')
-rw-r--r-- | http.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -2,6 +2,7 @@ #include "pack.h" #include "sideband.h" #include "run-command.h" +#include "url.h" int data_received; int active_requests; @@ -297,7 +298,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, "://"); @@ -322,16 +323,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; } } |