From 7f8f6f3305161706d44884cccd4961ba4f0490bf Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Fri, 11 Dec 2020 20:40:32 +0200 Subject: GmRequest: Punycode for domain names To support Internationalized Domain Names, we need to encode domain names using Punycode. IssueID #73 --- src/gmrequest.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/gmrequest.c') 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) { void setUrl_GmRequest(iGmRequest *d, const iString *url) { set_String(&d->url, url); + /* Encode hostname to Punycode here because we want to submit the Punycode domain name + in the request. (TODO: Pending possible Gemini spec change.) */ + punyEncodeUrlHost_String(&d->url); urlEncodeSpaces_String(&d->url); } @@ -646,7 +649,7 @@ void submit_GmRequest(iGmRequest *d) { if (port == 0) { port = 1965; /* default Gemini port */ } - setUrl_TlsRequest(d->req, host, port); + setHost_TlsRequest(d->req, host, port); setContent_TlsRequest(d->req, utf8_String(collectNewFormat_String("%s\r\n", cstr_String(&d->url)))); submit_TlsRequest(d->req); -- cgit v1.2.3