diff options
-rw-r--r-- | src/gmrequest.c | 9 | ||||
-rw-r--r-- | src/gmutil.c | 4 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/gmrequest.c b/src/gmrequest.c index 82c232e1..603975f0 100644 --- a/src/gmrequest.c +++ b/src/gmrequest.c | |||
@@ -593,6 +593,15 @@ void setUrl_GmRequest(iGmRequest *d, const iString *url) { | |||
593 | the web. */ | 593 | the web. */ |
594 | /* Encode everything except already-percent encoded characters. */ | 594 | /* Encode everything except already-percent encoded characters. */ |
595 | iString *enc = urlEncodeExclude_String(&d->url, "%" URL_RESERVED_CHARS); | 595 | iString *enc = urlEncodeExclude_String(&d->url, "%" URL_RESERVED_CHARS); |
596 | /* Normalize empty paths to /. */ { | ||
597 | iUrl parts; | ||
598 | init_Url(&parts, enc); | ||
599 | if (isEmpty_Range(&parts.path) && equalCase_Rangecc(parts.scheme, "gemini") && | ||
600 | parts.path.start) { | ||
601 | /* Normalize to "/" as per specification (November 2021 update). */ | ||
602 | insertData_Block(&enc->chars, parts.path.start - constBegin_String(enc), "/", 1); | ||
603 | } | ||
604 | } | ||
596 | set_String(&d->url, enc); | 605 | set_String(&d->url, enc); |
597 | delete_String(enc); | 606 | delete_String(enc); |
598 | d->identity = identityForUrl_GmCerts(d->certs, &d->url); | 607 | d->identity = identityForUrl_GmCerts(d->certs, &d->url); |
diff --git a/src/gmutil.c b/src/gmutil.c index e59e6649..ecfe2128 100644 --- a/src/gmutil.c +++ b/src/gmutil.c | |||
@@ -325,10 +325,6 @@ void urlEncodePath_String(iString *d) { | |||
325 | return; | 325 | return; |
326 | } | 326 | } |
327 | if (isEmpty_Range(&url.path)) { | 327 | if (isEmpty_Range(&url.path)) { |
328 | if (equalCase_Rangecc(url.scheme, "gemini") && url.path.start) { | ||
329 | /* Normalize to "/" as per specification (November 2021 update). */ | ||
330 | insertData_Block(&d->chars, url.path.start - constBegin_String(d), "/", 1); | ||
331 | } | ||
332 | return; | 328 | return; |
333 | } | 329 | } |
334 | iString *encoded = new_String(); | 330 | iString *encoded = new_String(); |