Fossil SCM

Duplicate slashes from base URL in repolist

Fixed

e4d8a23d1fbd79c… · opened 5 years, 5 months ago

Type
Code_Defect
Priority
Immediate
Severity
Important
Resolution
Fixed
Subsystem
Created
Oct. 12, 2020 7:06 a.m.
  • 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!

Comments (1)

ivz_hh 5 years, 5 months ago
  • 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!

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button