From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-a1-smtp.messagingengine.com (fout-a1-smtp.messagingengine.com [103.168.172.144]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A4CB04E3239 for ; Mon, 28 Sep 2026 15:01:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.144 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790607677; cv=none; b=GrBINcqnHIJWS/EMge90ukFMYszpMkcP6ML+/BYdTTyaLB7TR4NVoIC/BfJmm/plsRn3mOx1KM8BPQGebIG0VXrK8NFgB3kSPobLxdoLaJueT7rfoQUU5uyJeOu/HIbErWh8BzK9bipey15u9+x1CFjAO5UiNDh4FLKHKHh69mc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790607677; c=relaxed/simple; bh=nIqeZ1DgVM4bhFq1tw80Srze5Yx5kdPkarwyM+humZQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=sPGYB1PdOZG6L6DbMG14zLmkxklypcv19EHjg/PpRFCgjmlQ5+33AuxNRBG0s36z1E5SxER5vuQfHFipK/3yC/6pthxqzx2VgdyTBCs3B7c1q0ImvN35htujVvVbrAXqL0RmxVxblpux9vDXjRArv45fDkc3svqW2dlB9mI0sUI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b=qOdReZo0; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=WzKJyuU1; arc=none smtp.client-ip=103.168.172.144 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b="qOdReZo0"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="WzKJyuU1" Received: from phl-compute-07.internal (phl-compute-07.internal [10.202.2.47]) by mailfout.phl.internal (Postfix) with ESMTP id 7D7A6EC0183; Mon, 28 Sep 2026 11:01:14 -0400 (EDT) Received: from phl-frontend-02 ([10.202.2.161]) by phl-compute-07.internal (MEProxy); Mon, 28 Sep 2026 11:01:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1790607674; x=1790694074; bh=r/AmFP3roq edv3ygaatAGWhPTmG13TrKlj0umoO9hd0=; b=qOdReZo0k1wzYYz3tLgxiPwvz9 p2dKW7FXvTIrDyNv5GDSBNDNiJhYEXs42p+iDwfx5a+Rprm9HTz2Rij+EUNdNYKO jkZYAymGTP/Ltguy/A9SCoVlU+Exfh/iGxRKeU+8egTxXQiAd0JP1djWRfrvkXJF dQNjvEzvtSXHuOVdR2v7zHk9kLF+VO8NN96/VDp9Ssw6ggE07VI1g1ETTO77q71t /g1qAD3pObKYR7q4qVIueQnlM+whxxXZ+Z/N33Kdfp8Do6AOagjs5pmEJG4moBwI BLmTeiHeYMYYoH60y1wBHqDuHrmJDkvSx6GpzoscAcJ+Mgx+34pKfGFTxJiw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1790607674; x=1790694074; bh=r/AmFP3roqedv3ygaatAGWhPTmG13TrKlj0 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79bsA X-ME-Proxy: Feedback-ID: if26b431b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 28 Sep 2026 11:01:13 -0400 (EDT) From: Junio C Hamano To: Jeff King Cc: git@vger.kernel.org Subject: Re: [PATCH] http: handle curl stripping creds from effective url In-Reply-To: <20260928040149.GA498186@coredump.intra.peff.net> (Jeff King's message of "Mon, 28 Sep 2026 00:01:49 -0400") References: <20260928040149.GA498186@coredump.intra.peff.net> Date: Mon, 28 Sep 2026 08:01:12 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Jeff King writes: > I've used curl's curl_url() interface to do the stripping here, mostly > because its behavior should match the stripping it does internally. And > also, though we have code to parse a URL, we don't have any to > reconstruct it, making a single string comparison hard. > > One alternative would be to parse with url_parse() or similar, and > compare the individual fields (skipping username/password). I think that > would probably also work in practice, but it seemed to me that the > simplest change would be sticking with string comparisons. Very nice. > The curl_url() interface appeared in 7.62.0. We document that 7.61.0 is > still supported, so I've made it conditional here. Only new versions > strip the result from CURLINFO_EFFECTIVE_URL, so it's OK for very old > versions to skip the extra comparison. ;-) > We could probably declare 7.62.0 the oldest supported version of curl, > but it would really only save a few lines of #ifdef here. I'd prefer to > consider that question separately. That is very sensible. > +#ifndef GIT_CURL_HAVE_CURL_URL > +#define strip_url_credential(in) NULL > +#else > +static char *strip_url_credential(const char *in) > +{ > + char *ret = NULL; > + CURLU *url; > + > + url = curl_url(); > + if (!url) > + goto out; > + > + if (curl_url_set(url, CURLUPART_URL, in, 0)) > + goto out; > + > + curl_url_set(url, CURLUPART_USER, NULL, 0); > + curl_url_set(url, CURLUPART_PASSWORD, NULL, 0); > + curl_url_get(url, CURLUPART_URL, &ret, 0); > + > +out: > + curl_url_cleanup(url); > + return ret; > +} > +#endif