Opened 21 months ago

Closed 5 months 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 by waddlesplash, 21 months ago

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

comment:2 by kallisti5, 21 months ago

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.

in reply to:  2 comment:3 by starsseed, 15 months ago

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 15 months ago by starsseed (previous) (diff)

comment:4 by waddlesplash, 7 months ago

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

comment:5 by starsseed, 6 months ago

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 by waddlesplash, 6 months ago

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 by pulkomandy, 6 months ago

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 by waddlesplash, 5 months ago

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