diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-12-08 11:24:14 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-12-08 11:24:14 -0800 |
commit | 16c06fcb39eec5505c383b412ca2254bccf354a5 (patch) | |
tree | 8309090ba4e62e14766621ababaed91def3cba3d /http.c | |
parent | 09a8fbd59cb18c222db732e053c17583f7f06840 (diff) | |
parent | f39f72d8cf03b61407f64460eba3357ec532280e (diff) | |
download | git-16c06fcb39eec5505c383b412ca2254bccf354a5.tar.gz |
Merge branch 'gc/http-with-non-ascii-username-url'
* gc/http-with-non-ascii-username-url:
Fix username and password extraction from HTTP URLs
t5550: test HTTP authentication and userinfo decoding
Conflicts:
t/lib-httpd/apache.conf
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; @@ -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; } } |