Join parts of a URL - joinpath?

For my use case joinpath is enough but you are right @sirex URL joining is more complicated. Unfortunately I haven’t find a Julia package which provides such a function.

With Python

$ ipython
Python 3.6.6 | packaged by conda-forge | (default, Jul 26 2018, 09:55:02)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.0.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from urllib.parse import urljoin as joinurl

In [2]: joinurl("https://example.com/", "http://foo.bar/")
Out[2]: 'http://foo.bar/'

In [3]: joinurl("https://example.com/a/b", "..")
Out[3]: 'https://example.com/'

In [4]: joinurl("https://example.com/a/b", "c")
Out[4]: 'https://example.com/a/c'

In [5]: joinurl("https://example.com/a/b", "/c")
Out[5]: 'https://example.com/c'

In [6]: joinurl("https://example.com/a/b?x=1", "c")
Out[6]: 'https://example.com/a/c'

In [7]: joinurl("a/b/c", "d/e")
Out[7]: 'a/b/d/e'