From 496122b446d2084f6117e2b8704d7c9ec6706422 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Sat, 8 Aug 2020 22:02:14 +0300 Subject: Handling "about:home"; GmRequest decoupling GmRequest is given a pointer to the GmCerts to use. Also, timeouts are handled via a posted command so they get processed in the main thread. --- src/gmutil.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/gmutil.c') diff --git a/src/gmutil.c b/src/gmutil.c index 0caadd32..4b49e1d0 100644 --- a/src/gmutil.c +++ b/src/gmutil.c @@ -2,6 +2,7 @@ #include #include +#include void init_Url(iUrl *d, const iString *text) { iRegExp *absPat = @@ -142,6 +143,13 @@ const iString *absoluteUrl_String(const iString *d, const iString *urlMaybeRelat return absolute; } +iString *makeFileUrl_String(const iString *localFilePath) { + iString *url = cleaned_Path(localFilePath); + replace_Block(&url->chars, '\\', '/'); /* in case it's a Windows path */ + prependCStr_String(url, "file://"); + return url; +} + void urlEncodeSpaces_String(iString *d) { for (;;) { const size_t pos = indexOfCStr_String(d, " "); @@ -166,6 +174,10 @@ static const struct { "Failed to Open File", "The requested file does not exist or is inaccessible. " "Please check the file path." } }, + { invalidLocalResource_GmStatusCode, + { 0, + "Invalid Resource", + "The requested resource does not exist." } }, { unsupportedMimeType_GmStatusCode, { 0x1f47d, /* alien */ "Unsupported MIME Type", @@ -178,7 +190,7 @@ static const struct { "Perhaps the server is malfunctioning or you tried to contact a " "non-Gemini server." } }, { invalidRedirect_GmStatusCode, - { 0, /* */ + { 0x27a0, /* dashed arrow */ "Invalid Redirect", "The server responded with a redirect but did not provide a valid destination URL. " "Perhaps the server is malfunctioning." } }, @@ -226,7 +238,7 @@ static const struct { { 0x1f44e, /* thumbs down */ "Bad Request", "The server was unable to parse your request, presumably due to the " - "request being malformed. Likely a bug in Lagrange." } }, + "request being malformed." } }, { clientCertificateRequired_GmStatusCode, { 0x1f511, /* key */ "Certificate Required", -- cgit v1.2.3