aboutsummaryrefslogtreecommitdiff
path: root/http.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-12-14 07:35:18 -0800
committerJunio C Hamano <gitster@pobox.com>2010-12-14 07:35:18 -0800
commit187b259dce5c5db17ef4cac09b163753e85e62cc (patch)
tree84e0f571b0754e84bf7f6dccf5e2c2966e163421 /http.c
parentc6d059bbccb8460959b9aedfeefbb4d6aac6e842 (diff)
parentf39f72d8cf03b61407f64460eba3357ec532280e (diff)
downloadgit-187b259dce5c5db17ef4cac09b163753e85e62cc.tar.gz
git-187b259dce5c5db17ef4cac09b163753e85e62cc.tar.xz
Merge branch 'gc/http-with-non-ascii-username-url' into maint
* 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.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/http.c b/http.c
index 17bcf19c5..f582b13b9 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;
}
}