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

Re: [PATCH ALTERNATIVE v6.v3 4/6] config: parse http.<url>.<variable> using urlmatch

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 5, 2013, 22:56 UTC
Message-ID
<7vsiyniw63.fsf@alter.siamese.dyndns.org>
In-Reply-To
<5acf57129e37a87611ed03648f7b368@f74d39fa044aa309eaea14b9f57fe79>
"Kyle J. McKay" <mackyle@gmail.com> writes:
Show 9 quoted lines
> Use the urlmatch_config_entry() to wrap the underlying
> http_options() two-level variable parser in order to set
> http.<variable> to the value with the most specific URL in the
> configuration.
>
> Signed-off-by: Jeff King <peff@peff.net>
> Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
Oops, what did we sign-off?
Show 9 quoted lines
> This version of 4/6 moves the tests to t0110 since urlmatch is now global.
> The config tests are removed since part 6/6 already has those and they no
> longer belong with the urlmatch normalization tests.
>
> The Makefile rule has been removed since it's no longer needed to build
> correctly as the test program no longer includes http.c.
>
> Other than those changes (and a minor rename to reflect the new location),
> this patch is identical to the previous v6.v2 4/6.
Ahh, figures.  Thanks.
Peff, any comments?
Show 15 quoted lines
> diff --git a/t/t0110-urlmatch-normalization.sh b/t/t0110-urlmatch-normalization.sh
> new file mode 100755
> index 00000000..8d6096d4
> --- /dev/null
> +++ b/t/t0110-urlmatch-normalization.sh
> @@ -0,0 +1,177 @@
> +#!/bin/sh
> +
> +test_description='urlmatch URL normalization'
> +. ./test-lib.sh
> +
> +# The base name of the test url files
> +tu="$TEST_DIRECTORY/t0110/url"
> +
> +# Note that only file: URLs should be allowed without a host

It is somewhat unfortunate that the form most commonly used for pushing is not supported at all, i.e.

	host:path

Current configuration set may not have anything interesting to affect the git-over-ssh push codepath, so in practice it may not matter, though.

> +test_expect_success 'url authority' '

"authority" refers to the host part? (not a complaint, but is a question)

> +test_expect_success 'url port checks' '
> +	test-urlmatch-normalization "xyz://q@some.host:" &&

This is presumably replaced by a default port for xyz:// scheme, whatever the default port is, in other words, it is as if no colon is given at the end?

> +	test-urlmatch-normalization "xyz://q@some.host:456/" &&
> +	! test-urlmatch-normalization "xyz://q@some.host:0" &&
> +	! test-urlmatch-normalization "xyz://q@some.host:0000000" &&
Port #0 is disallowed?
> +	test-urlmatch-normalization "xyz://q@some.host:0000001?" &&

Is it the same as specifying "xyz://q@some.host:1?" and does it match "xyz://q@some.host:1"?

> +	test-urlmatch-normalization "xyz://q@some.host:065535#" &&
Ditto, for 65535 and without #-fragment at the end?
Show 13 quoted lines
> +test_expect_success 'url port normalization' '
> +	test "$(test-urlmatch-normalization -p "http://x:800")" = "http://x:800/" &&
> +	test "$(test-urlmatch-normalization -p "http://x:0800")" = "http://x:800/" &&
> +	test "$(test-urlmatch-normalization -p "http://x:00000800")" = "http://x:800/" &&
> +	test "$(test-urlmatch-normalization -p "http://x:065535")" = "http://x:65535/" &&
> +	test "$(test-urlmatch-normalization -p "http://x:1")" = "http://x:1/" &&
> +	test "$(test-urlmatch-normalization -p "http://x:80")" = "http://x/" &&
> +	test "$(test-urlmatch-normalization -p "http://x:080")" = "http://x/" &&
> +	test "$(test-urlmatch-normalization -p "http://x:000000080")" = "http://x/" &&
> +	test "$(test-urlmatch-normalization -p "https://x:443")" = "https://x/" &&
> +	test "$(test-urlmatch-normalization -p "https://x:0443")" = "https://x/" &&
> +	test "$(test-urlmatch-normalization -p "https://x:000000443")" = "https://x/"
> +'
OK, these answer most of the previous questions.
Show 7 quoted lines
> +# http://@foo specifies an empty user name but does not specify a password
> +# http://foo  specifies neither a user name nor a password
> +# So they should not be equivalent
> +test_expect_success 'url equivalents' '
> +	test-urlmatch-normalization "httP://x" "Http://X/" &&
> +	test-urlmatch-normalization "Http://%4d%65:%4d^%70@The.Host" "hTTP://Me:%4D^p@the.HOST:80/" &&
> +	! test-urlmatch-normalization "https://@x.y/^" "httpS://x.y:443/^" &&

The comment is about this test, which seems to make sense. What is "^"? Just a random valid character that can appear in the path? (not a complaint, but is a question).

Previous: Kyle J. McKayNext: Kyle J. McKay
Message 21 of 23 in “http.<url>.<key> and friends”
  1. 0/6 http.<url>.<key> and friendsJunio C Hamano, Jul 31, 2013
  2. 1/6 http.c: fix parsing of http.sslCertPasswordProtected variableJunio C Hamano, Jul 31, 2013
  3. 2/6 config: add helper to normalize and match URLsJunio C Hamano, Jul 31, 2013
  4. Kyle J. McKayJul 31, 2013
  5. 0/2 http.<url>.<key> and friendsKyle J. McKay, Jul 31, 2013
  6. 2/4 config: add helper to normalize and match URLsKyle J. McKay, Jul 31, 2013
  7. 4/4 config: parse http.<url>.<variable> using urlmatchKyle J. McKay, Jul 31, 2013
  8. Junio C HamanoJul 31, 2013
  9. 4/6 config: parse http.<url>.<variable> using urlmatchKyle J. McKay, Jul 31, 2013
  10. 3/6 config: add generic callback wrapper to parse section.<url>.keyJunio C Hamano, Jul 31, 2013
  11. 4/6 config: parse http.<url>.<variable> using urlmatchJunio C Hamano, Jul 31, 2013
  12. Kyle J. McKayJul 31, 2013
  13. 5/6 builtin/config: refactor collect_config()Junio C Hamano, Jul 31, 2013
  14. 6/6 config: "git config --get-urlmatch" parses section.<url>.keyJunio C Hamano, Jul 31, 2013
  15. Jeff KingJul 31, 2013
  16. Kyle J. McKayJul 31, 2013
  17. Jeff KingJul 31, 2013
  18. Junio C HamanoAug 1, 2013
  19. Jeff KingAug 1, 2013
  20. 4/6 config: parse http.<url>.<variable> using urlmatchKyle J. McKay, Aug 5, 2013
  21. Junio C HamanoAug 5, 2013
  22. Kyle J. McKayAug 5, 2013
  23. Junio C HamanoJul 31, 2013

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.