summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-04-17 11:07:30 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-04-17 11:07:30 +0300
commit6a4a7ae9fbbcdb3210702ca0e818c79144df6989 (patch)
tree157aaad70b4af89952b9921bec66eed00766b909 /src
parent927a64c9c50f3ce5cf8285ce3ee1dc9f2985d746 (diff)
Composing an URL with an IPv6 host
The brackets that were removed must be put back if needed.
Diffstat (limited to 'src')
-rw-r--r--src/gmutil.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gmutil.c b/src/gmutil.c
index 34132015..c0eda099 100644
--- a/src/gmutil.c
+++ b/src/gmutil.c
@@ -290,8 +290,15 @@ const iString *absoluteUrl_String(const iString *d, const iString *urlMaybeRelat
290 appendCStr_String(absolute, "://"); 290 appendCStr_String(absolute, "://");
291 /* Authority. */ { 291 /* Authority. */ {
292 const iUrl *selHost = isDef_(rel.host) ? &rel : &orig; 292 const iUrl *selHost = isDef_(rel.host) ? &rel : &orig;
293 const iBool isIPv6 = iStrStrN(selHost->host.start, ":", size_Range(&selHost->host)) != NULL;
293 iString *decHost = punyDecodeHost_(selHost->host); 294 iString *decHost = punyDecodeHost_(selHost->host);
295 if (isIPv6) {
296 appendCStr_String(absolute, "[");
297 }
294 append_String(absolute, decHost); 298 append_String(absolute, decHost);
299 if (isIPv6) {
300 appendCStr_String(absolute, "]");
301 }
295 delete_String(decHost); 302 delete_String(decHost);
296 /* Default Gemini port is removed as redundant; normalization. */ 303 /* Default Gemini port is removed as redundant; normalization. */
297 if (!isEmpty_Range(&selHost->port) && (!equalCase_Rangecc(scheme, "gemini") 304 if (!isEmpty_Range(&selHost->port) && (!equalCase_Rangecc(scheme, "gemini")