On Tue, Jan 24, 2017 at 05:52:39PM -0000, Philip Oakley wrote: > From: "Patrick Steinhardt" <patrick.steinhardt@xxxxxxxx> > > a quick comment on the documentation part .. > > > The URL matching function computes for two URLs whether they match not. > > The match is performed by splitting up the URL into different parts and > > then doing an exact comparison with the to-be-matched URL. > > > > The main user of `urlmatch` is the configuration subsystem. It allows to > > set certain configurations based on the URL which is being connected to > > via keys like `http.<url>.*`. A common use case for this is to set > > proxies for only some remotes which match the given URL. Unfortunately, > > having exact matches for all parts of the URL can become quite tedious > > in some setups. Imagine for example a corporate network where there are > > dozens or even hundreds of subdomains, which would have to be configured > > individually. > > > > This commit introduces the ability to use globbing in the host-part of > > the URLs. A user can simply specify a `*` as part of the host name to > > match all subdomains at this level. For example adding a configuration > > key `http.https://*.example.com.proxy` will match all subdomains of > > `https://example.com`. > > > > Signed-off-by: Patrick Steinhardt <patrick.steinhardt@xxxxxxxx> > > --- > > Documentation/config.txt | 5 ++++- > > t/t1300-repo-config.sh | 36 ++++++++++++++++++++++++++++++++++++ > > urlmatch.c | 38 ++++++++++++++++++++++++++++++++++---- > > 3 files changed, 74 insertions(+), 5 deletions(-) > > > > diff --git a/Documentation/config.txt b/Documentation/config.txt > > index 506431267..a78921c2b 100644 > > --- a/Documentation/config.txt > > +++ b/Documentation/config.txt > > @@ -1914,7 +1914,10 @@ http.<url>.*:: > > must match exactly between the config key and the URL. > > > > . Host/domain name (e.g., `example.com` in `https://example.com/`). > > - This field must match exactly between the config key and the URL. > > + This field must match between the config key and the URL. It is > > + possible to use globs in the config key to match all subdomains, e.g. > > + `https://*.example.com/` to match all subdomains of `example.com`. Note > > + that a glob only every matches a single part of the hostname. > > [s/every/ever/ ?] > > the "match all subdomains" appears to contradict the "a glob only ever > matches a single part ". > > Maybe borrow the example from the 0/4 cover letter > "so for example `https://foo.bar.example.com` would not match in the case of > `http.https://*.example.com` " (If I understood it correctly. > > A simple example often clarifies much better than more words. Thanks! (Hopefully) improved this in v3. Regards Patrick
Attachment:
signature.asc
Description: PGP signature