Fossil

View Ticket
Login

View Ticket

Ticket Hash: e4d8a23d1fbd79c01e0ed75584d43bb9862f26a3
Title: Duplicate slashes from base URL in repolist
Status: Fixed Type: Code_Defect
Severity: Important Priority: Immediate
Subsystem: Resolution: Fixed
Last Modified: 2020-10-13 20:49:31
Version Found In: trunk
User Comments:
ivz_hh added on 2020-10-12 07:06:26:
  • What do I see:

Run fossil serve in repolist mode with a reverse proxy:

fossil serve --nossl --baseurl http://fossil.host.xyz/ --repolist ./

Click a repo wj to open and login, the URL is:

http://fossil.host.xyz//fossil-repos/wj/login?g=/fossil-repos/wj/home

At setup page, the URL is:

http://fossil.host.xyz//fossil-repos/wj/setup_ulist

The double // returns a valid page.

  • What do I expect:

There is no // in the URL.

  • Analysis:

The reason is fossil expects at least three / in the URL (set_base_url() in main.c), e.g. http://host/path. However, if the URL is http://host.path.domain, the code that checks for three / fails.

Later code that constructs URL assumes no ending /. e.g. repo_list_page() in repolist.c:

@ <base href="%s(g.zBaseURL)/" />
  • Solution

Add a special check for two / and no ending /.

I have a patch and would you mind to review it?

Thank you!