All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Mike Hommey <mh@glandium.org>
Cc: git@vger.kernel.org, tboegi@web.de
Subject: Re: [PATCH v5 4/9] connect: make parse_connect_url() return separated host and port
Date: Mon, 16 May 2016 15:39:08 -0700	[thread overview]
Message-ID: <xmqqr3d1zkz7.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20160516000740.19042-5-mh@glandium.org> (Mike Hommey's message of "Mon, 16 May 2016 09:07:35 +0900")

Mike Hommey <mh@glandium.org> writes:

> +	get_host_and_port(&host, &port);
> +
> +	if (*host && !port) {
> +		/* The host might contain a user:password string, ignore it
> +		 * when searching for the port again */
> +		char *end_user = strrchr(host, '@');
> +		port = get_port(end_user ? end_user : host);

Scanning from the right because host part would never have '@', but
there could be an invalid URL with an unquoted '@' in userinfo part?
Then this makes sense.

> diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
> index 91a69fc..9acba2b 100755
> --- a/t/t5500-fetch-pack.sh
> +++ b/t/t5500-fetch-pack.sh
> @@ -553,7 +553,7 @@ check_prot_path () {
>  	Diag: protocol=$2
>  	Diag: path=$3
>  	EOF
> -	git fetch-pack --diag-url "$1" | grep -v hostandport= >actual &&
> +	git fetch-pack --diag-url "$1" | grep -v host= | grep -v port= >actual &&

A single process:

	... | grep -v -e '^host=' -e '^port='

perhaps?

> @@ -562,22 +562,17 @@ check_prot_host_port_path () {
>  	case "$2" in
>  		*ssh*)
>  		pp=ssh
> -		uah=userandhost
> -		ehost=$(echo $3 | tr -d "[]")
> -		diagport="Diag: port=$4"
>  		;;
>  		*)
> -		pp=$p
> -		uah=hostandport
> -		ehost=$(echo $3$4 | sed -e "s/22$/:22/" -e "s/NONE//")
> -		diagport=""
> +		pp=$2
>  		;;
>  	esac
> +	ehost=$(echo $3 | tr -d "[]")
>  	cat >exp <<-EOF &&
>  	Diag: url=$1
>  	Diag: protocol=$pp
> -	Diag: $uah=$ehost
> -	$diagport
> +	Diag: userandhost=$ehost
> +	Diag: port=$4
>  	Diag: path=$5
>  	EOF

This makes the diag output simpler and allows the caller to expect
the same set of variables, which is good.

  reply	other threads:[~2016-05-16 22:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-16  0:07 [PATCH v5 0/9] connect: various cleanups Mike Hommey
2016-05-16  0:07 ` [PATCH v5 1/9] connect: call get_host_and_port() earlier Mike Hommey
2016-05-16  0:07 ` [PATCH v5 2/9] connect: only match the host with core.gitProxy Mike Hommey
2016-05-16 22:30   ` Junio C Hamano
2016-05-16 22:36     ` Mike Hommey
2016-05-16 22:54       ` Junio C Hamano
2016-05-16  0:07 ` [PATCH v5 3/9] connect: fill the host header in the git protocol with the host and port variables Mike Hommey
2016-05-16  0:07 ` [PATCH v5 4/9] connect: make parse_connect_url() return separated host and port Mike Hommey
2016-05-16 22:39   ` Junio C Hamano [this message]
2016-05-16 22:53     ` Mike Hommey
2016-05-16  0:07 ` [PATCH v5 5/9] connect: group CONNECT_DIAG_URL handling code Mike Hommey
2016-05-16  0:07 ` [PATCH v5 6/9] connect: make parse_connect_url() return the user part of the url as a separate value Mike Hommey
2016-05-16  0:07 ` [PATCH v5 7/9] connect: change the --diag-url output to separate user and host Mike Hommey
2016-05-16  0:07 ` [PATCH v5 8/9] connect: actively reject git:// urls with a user part Mike Hommey
2016-05-16 22:41   ` Junio C Hamano
2016-05-16  0:07 ` [PATCH v5 9/9] connect: move ssh command line preparation to a separate function Mike Hommey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqr3d1zkz7.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=mh@glandium.org \
    --cc=tboegi@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.