Re: [PATCH v1 0/2] urlmatch: allow regexp-based matches
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 23, 2017, 19:53 UTC
- Message-ID
- <xmqqsho9r1rs.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20170123130635.29577-1-patrick.steinhardt@elego.de>
Patrick Steinhardt <patrick.steinhardt@elego.de> writes:
Show 8 quoted lines
> This patch is mostly a request for comments. The use case is to > be able to configure an HTTP proxy for all subdomains of a > certain domain where there are hundreds of subdomains. The most > flexible way I could imagine was by using regular expressions for > the matching, which is how I implemented it for now. So users can > now create a configuration key like > `http.?http://.*\\.example\\.com.*` to apply settings for all > subdomains of `example.com`.
While reading 2/2, I got an impression that this is "too" flexible and possibly operates at a wrong level. I would have expected that the wildcarding to be limited to the host part only and hook into match_urls(), allowing the users of the new feature to still take advantage of the existing support of "http://me@example.com" that limits the match to the case that the connection is authenticated for a user, for example, by newly allowing "http://me@*.example.com" or something like that.
Because you cannot have a literal '*' in your hostname, I would imagine that supporting a match pattern "http://me@*.example.com" would be already backward compatible without requiring a leading question-mark.
I also personally would prefer these textual matching to be done with glob not with regexp, by the way, as the above description of mine shows.
Thanks.