From dad8534f864120bb47dce6e7e6a6d523144f5216 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Mon, 18 Jul 2011 03:52:32 -0400 Subject: [PATCH] http: use hostname in credential description Until now, a request for an http password looked like: Username: Password: Now it will look like: Username for 'example.com': Password for 'example.com': Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- http.c | 7 +++---- t/t5550-http-fetch.sh | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/http.c b/http.c index 4c047be802..d6b2d783ff 100644 --- a/http.c +++ b/http.c @@ -310,7 +310,6 @@ static CURL *get_curl_handle(void) static void http_auth_init(const char *url) { const char *at, *colon, *cp, *slash, *host, *proto_end; - char *decoded; struct strbuf unique = STRBUF_INIT; proto_end = strstr(url, "://"); @@ -342,11 +341,11 @@ static void http_auth_init(const char *url) host = at + 1; } + http_auth.description = url_decode_mem(host, slash - host); + strbuf_add(&unique, url, proto_end - url); strbuf_addch(&unique, ':'); - decoded = url_decode_mem(host, slash - host); - strbuf_addstr(&unique, decoded); - free(decoded); + strbuf_addstr(&unique, http_auth.description); http_auth.unique = strbuf_detach(&unique, NULL); } diff --git a/t/t5550-http-fetch.sh b/t/t5550-http-fetch.sh index 407e1cb3c6..b04261cfb5 100755 --- a/t/t5550-http-fetch.sh +++ b/t/t5550-http-fetch.sh @@ -51,8 +51,8 @@ test_expect_success 'setup askpass helpers' ' GIT_ASKPASS="$PWD/askpass" && export GIT_ASKPASS && >askpass-expect-none && - echo "askpass: Password: " >askpass-expect-pass && - { echo "askpass: Username: " && + echo "askpass: Password for '\''$HTTPD_DEST'\'': " >askpass-expect-pass && + { echo "askpass: Username for '\''$HTTPD_DEST'\'': " && cat askpass-expect-pass } >askpass-expect-both '