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

Re: [PATCH v2 4/4] urlmatch: allow globbing for the URL host part

From
Patrick Steinhardt <patrick.steinhardt@elego.de>
Date
Jan 25, 2017, 09:57 UTC
Message-ID
<20170125095754.GA4096@pks-pc>
In-Reply-To
<5BF60E6DF2C04DF081466BC3BD3F954F@PhilipOakley>
On Tue, Jan 24, 2017 at 05:52:39PM -0000, Philip Oakley wrote:
Show 54 quoted lines
> From: "Patrick Steinhardt" <patrick.steinhardt@elego.de>
> 
> 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@elego.de>
> > ---
> > 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

Previous: Philip Oakley
Message 12 of 12 in “urlmatch: allow regexp-based matches”
  1. 0/2 urlmatch: allow regexp-based matchesPatrick Steinhardt, Jan 23, 2017
  2. 2/2 urlmatch: allow regex-based URL matchingPatrick Steinhardt, Jan 23, 2017
  3. 1/2 mailmap: add Patrick Steinhardt's work addressPatrick Steinhardt, Jan 23, 2017
  4. Junio C HamanoJan 23, 2017
  5. Patrick SteinhardtJan 24, 2017
  6. 0/4 urlmatch: allow regexp-based matchesPatrick Steinhardt, Jan 24, 2017
  7. 1/4 mailmap: add Patrick Steinhardt's work addressPatrick Steinhardt, Jan 24, 2017
  8. 2/4 urlmatch: enable normalization of URLs with globsPatrick Steinhardt, Jan 24, 2017
  9. 3/4 urlmatch: split host and port fields in `struct url_info`Patrick Steinhardt, Jan 24, 2017
  10. 4/4 urlmatch: allow globbing for the URL host partPatrick Steinhardt, Jan 24, 2017
  11. Philip OakleyJan 24, 2017
  12. Patrick SteinhardtJan 25, 2017

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.