git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/3] urlmatch: normalize ssh and ftp default ports

From
Ben Knoble <ben.knoble@gmail.com>
Date
Jul 24, 2026, 11:35 UTC
Message-ID
<DE62DFBE-ED4C-4EF5-8F4D-FAAB3519F86A@gmail.com>
In-Reply-To
<20260724004011.41795-2-fpottbaecker+git@mailbox.org>
Show 12 quoted lines
> Le 24 juil. 2026 à 09:41, Fabian Pottbäcker <fpottbaecker+git@mailbox.org> a écrit :
> 
> These protocols are still supported by git and have well known
> default ports. This leaves FTPS, which does not have one default
> port.
> 
> Signed-off-by: Fabian Pottbäcker <fpottbaecker+git@mailbox.org>
> ---
> t/unit-tests/u-urlmatch-normalization.c |  9 +++++++++
> urlmatch.c                              | 16 ++++++++++++----
> 2 files changed, 21 insertions(+), 4 deletions(-)
> 
[snip]
Show 31 quoted lines
> diff --git a/urlmatch.c b/urlmatch.c
> index 20bc2d009c..0c2ddf2e40 100644
> --- a/urlmatch.c
> +++ b/urlmatch.c
> @@ -274,12 +274,20 @@ static char *url_normalize_1(const char *url, struct url_info *out_info, bool al
>        if (url == slash_ptr) {
>            /* Skip ":" port with no number, it's same as default */
>        } else if (slash_ptr - url == 2 &&
> -               starts_with(norm.buf, "http:") &&
> -               !strncmp(url, "80", 2)) {
> +                starts_with(norm.buf, "ftp:") &&
> +                !strncmp(url, "21", 2)) {
> +            /* Skip http :21 as it's the default */
> +        } else if (slash_ptr - url == 2 &&
> +                starts_with(norm.buf, "ssh:") &&
> +                !strncmp(url, "22", 2)) {
> +            /* Skip http :22 as it's the default */
> +        } else if (slash_ptr - url == 2 &&
> +                starts_with(norm.buf, "http:") &&
> +                !strncmp(url, "80", 2)) {
>            /* Skip http :80 as it's the default */
>        } else if (slash_ptr - url == 3 &&
> -               starts_with(norm.buf, "https:") &&
> -               !strncmp(url, "443", 3)) {
> +                starts_with(norm.buf, "https:") &&
> +                !strncmp(url, "443", 3)) {
>            /* Skip https :443 as it's the default */
>        } else {
>            /*
> --
> 2.50.1 (Apple Git-155)
Just offhand, not commenting on the rest of the series : the comments look wrong for ftp, ssh to me. 
Previous: Fabian PottbäckerNext: Fabian Pottbäcker
Message 3 of 6 in “config: support scp-style --url”
  1. 0/3 config: support scp-style --urlFabian Pottbäcker, Jul 24, 2026
  2. 1/3 urlmatch: normalize ssh and ftp default portsFabian Pottbäcker, Jul 24, 2026
  3. Ben KnobleJul 24, 2026
  4. Fabian PottbäckerJul 28, 2026
  5. 2/3 t1300: cover --url for some --get-urlmatch testsFabian Pottbäcker, Jul 24, 2026
  6. 3/3 config: use url_parse for --urlFabian Pottbäcker, Jul 24, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.