Opened 7 years ago
Closed 6 years 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: | ||
Platform: | All |
Description
since a few weeks, the cgit based RSS-atom stream https://cgit.haiku-os.org/haiku/atom redirects its articles to http://localhost/haiku/ instead of http://cgit.haiku-os.org/haiku/.
Change History (8)
comment:1 by , 7 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
follow-up: 3 comment:2 by , 7 years ago
comment:3 by , 6 years ago
Replying to kallisti5:
Looking through here... https://linux.die.net/man/5/cgitrc 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
host=cgit_hosturl();
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 git.haiku-os.org
should fix the hyperlinks. (nb:cgit.haiku-os.org
doesn't work anymore) however, I don't know where it should be defined !
does it help you ?
comment:4 by , 6 years ago
I added the HTTP_HOST env in https://github.com/haiku/infrastructure/commit/3db53e8cd2d0a0077fe874b9402c078c42114d7c but this does not seem to have helped.
comment:5 by , 6 years 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 , 6 years 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 , 6 years ago
At least SERVER_NAME and SERVER_PORT are part of the standard interface for CGI scripts: https://tools.ietf.org/html/rfc3875
And apparently so is HTTP_HOST even if I can't see it directly in the RFC: http://www.cgi101.com/book/ch3/text.html
Do we run cgit as a CGI script? If so, why isn't the webserver filling these in correctly?
comment:8 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Fixed in https://github.com/haiku/infrastructure/commit/3db53e8cd2d0a0077fe874b9402c078c42114d7c. Thanks for being so patient!
odd. Didn't even know about the atom rss feature :-)
Looking through here... https://linux.die.net/man/5/cgitrc 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.