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 '