summaryrefslogtreecommitdiff
path: root/src/gmrequest.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-12-11 20:40:32 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-12-11 20:40:32 +0200
commit7f8f6f3305161706d44884cccd4961ba4f0490bf (patch)
tree4b0dc4b492119b7d15c5abb72cc01aa8f3de9a03 /src/gmrequest.c
parent413f8b95e62a33671e166badd8789a1bbf1248ef (diff)
GmRequest: Punycode for domain names
To support Internationalized Domain Names, we need to encode domain names using Punycode. IssueID #73
Diffstat (limited to 'src/gmrequest.c')
-rw-r--r--src/gmrequest.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gmrequest.c b/src/gmrequest.c
index 884486b3..41b97620 100644
--- a/src/gmrequest.c
+++ b/src/gmrequest.c
@@ -491,6 +491,9 @@ void deinit_GmRequest(iGmRequest *d) {
491 491
492void setUrl_GmRequest(iGmRequest *d, const iString *url) { 492void setUrl_GmRequest(iGmRequest *d, const iString *url) {
493 set_String(&d->url, url); 493 set_String(&d->url, url);
494 /* Encode hostname to Punycode here because we want to submit the Punycode domain name
495 in the request. (TODO: Pending possible Gemini spec change.) */
496 punyEncodeUrlHost_String(&d->url);
494 urlEncodeSpaces_String(&d->url); 497 urlEncodeSpaces_String(&d->url);
495} 498}
496 499
@@ -646,7 +649,7 @@ void submit_GmRequest(iGmRequest *d) {
646 if (port == 0) { 649 if (port == 0) {
647 port = 1965; /* default Gemini port */ 650 port = 1965; /* default Gemini port */
648 } 651 }
649 setUrl_TlsRequest(d->req, host, port); 652 setHost_TlsRequest(d->req, host, port);
650 setContent_TlsRequest(d->req, 653 setContent_TlsRequest(d->req,
651 utf8_String(collectNewFormat_String("%s\r\n", cstr_String(&d->url)))); 654 utf8_String(collectNewFormat_String("%s\r\n", cstr_String(&d->url))));
652 submit_TlsRequest(d->req); 655 submit_TlsRequest(d->req);