Skip to content

clean up 'url_host()' mess #856

@jsmeix

Description

@jsmeix

Current rear master.

While I am trying to implement #845
I get totally confused by what 'url_host()' means.

The current url_host() function in global-functions.sh
does not result the hostname in an URL but
it results simply the part after the scheme.

E.g. for

scheme://foo@bar/something/else

url_host() results 'foo@bar' and not only 'foo'
as the name of that function indicates.

I tried to 'fix' that so that the url_host() function
results what its name tells but that lead into mess.

The really bad thing is that some places rely on
this obscure behaviour e.g. in global-functions.sh

        (sshfs)
            mount_cmd="sshfs $(url_host $url):$(url_path $url) $mountpoint -o $options"

because sshfs can be called as

sshfs [user@]host:[dir] mountpoint [options] 

Accordingly as a precondition before implementing #845
I have to first clean up the current 'url_host()' mess.

I think I will do the following to avoid regression:

First I rename the current 'url_host()' function into 'url_user_at_host()'
and replace all calls of that function as needed.

Then I add two new functions 'url_host()' and 'url_user()'
that result what their name tells.

Finally I can use the new functions 'url_host()' and 'url_user()'
to implement #845 (comment) properly.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions