Opened 16 months ago

Closed 7 days ago

#13970 closed bug (fixed)

[cgit] impossible to open an article from the RSS commit feed because of a bad ATOM homepage

Reported by: starsseed Owned by: kallisti5
Priority: normal Milestone:
Component: Website Version:
Keywords: cgit configuration Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All


since a few weeks, the cgit based RSS-atom stream redirects its articles to http://localhost/haiku/ instead of

Change History (8)

comment:1 Changed 16 months ago by waddlesplash

Owner: changed from haiku-web to kallisti5
Status: newassigned

comment:2 Changed 16 months ago by kallisti5

odd. Didn't even know about the atom rss feature :-)

Looking through here... I don't see a flag to adjust. I'll have to check cgit internally to see if we can adjust.

I'll be WFK for the next few days.. if someone else wants to take a crack, feel free. Otherwise i'll take a peek in a few days.

comment:3 in reply to:  2 Changed 10 months ago by starsseed

Replying to kallisti5:

Looking through here... I don't see a flag to adjust. I'll have to check cgit internally to see if we can adjust.

For an ATOM stream, unlike other outputs, CGIT have to build hyperlinks as an absolute URLs (ie with an explicit host domain name). It seems CGIT read the domain name from 3 environment variable : HTTP_HOST or SERVER_NAME and SERVER_PORT using the getenv() function.

After some research in the CGIT source code, here is what I found:

In ui-atom.c, void cgit_print_atom(char *tip, char *path, int max_count) calls
In ui-shared.c: cgit_hosturl() compose the host string from a struct cgit_environment object.

this object is initialised in cgit.c:static void prepare_context(void)
ctx.env.http_host = getenv("HTTP_HOST");
ctx.env.server_name = getenv("SERVER_NAME");
ctx.env.server_name = getenv("SERVER_PORT");

So, defining HTTP_HOST with should fix the hyperlinks. ( doesn't work anymore) however, I don't know where it should be defined !

does it help you ?

Last edited 10 months ago by starsseed (previous) (diff)

comment:4 Changed 7 weeks ago by waddlesplash

I added the HTTP_HOST env in but this does not seem to have helped.

comment:5 Changed 5 weeks ago by starsseed

I had a look on the infrastucture repository (I've never heard about it before your previous post...)

HTTP_HOST and server_name seems be redefined in docker/cgit/assets/default.conf

have a look at line 3

server_name localhost;

and line 16

fastcgi_param HTTP_HOST $server_name;

comment:6 Changed 5 weeks ago by waddlesplash

Ah, right. It's pretty annoying this must be passed in via an env; why can't I pass it via the configuration file? :/

comment:7 Changed 4 weeks ago by pulkomandy

At least SERVER_NAME and SERVER_PORT are part of the standard interface for CGI scripts:

And apparently so is HTTP_HOST even if I can't see it directly in the RFC:

Do we run cgit as a CGI script? If so, why isn't the webserver filling these in correctly?

comment:8 Changed 7 days ago by waddlesplash

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.