sfeed

simple feed reader - forked from git.codemadness.org/sfeed
git clone git://src.gearsix.net/sfeed
Log | Files | Refs | Atom | README | LICENSE

commit 5c243a8c506ba3cf21d8258cc56f5cd8e00c710f
parent 7dc9d08969c61ea0e187f54bba58f3d98af63135
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Sat, 22 Aug 2015 14:58:44 +0200

util: absuri handle port separately

Diffstat:
Mutil.c | 13++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/util.c b/util.c @@ -105,7 +105,7 @@ int absuri(const char *link, const char *base, char *buf, size_t bufsiz) { struct uri ulink, ubase; - char tmp[4096] = "", *p; + char tmp[4096] = "", *p, *port; int r = -1, c; size_t i; @@ -117,13 +117,20 @@ absuri(const char *link, const char *base, char *buf, size_t bufsiz) if (!ulink.host[0] && !ubase.host[0]) return -1; - r = snprintf(tmp, sizeof(tmp), "%s://%s", + if (!strncmp(link, "//", 2)) + port = ""; + else + port = ulink.port[0] ? ulink.port : ubase.port[0] ? ubase.port : ""; + + r = snprintf(tmp, sizeof(tmp), "%s://%s%s%s", ulink.proto[0] ? ulink.proto : (ubase.proto[0] ? ubase.proto : "http"), !strncmp(link, "//", 2) ? ulink.host : - (ulink.host[0] ? ulink.host : ubase.host)); + (ulink.host[0] ? ulink.host : ubase.host), + port[0] ? ":" : "", + port); if (r == -1 || (size_t)r >= sizeof(tmp)) return -1;