Gopher hURL functionality

Viatrix via Lynx-dev <[email protected]>
Newsgroups gmane.comp.web.lynx.devel
Message-ID <20231112140112.035a0f17@lm-Satellite-Pro-C70-B>
Hello Lynx-dev,
I have made a patch to add support for Gopher's "hURL" functionality.
The patch is attached and applies to "src/LYGetFile.c". I'm not
well-versed in the C language so forgive me if I've made any errors.

See also: The thread "[Lynx-dev] Extend gopher client functionality to
support URL scheme" from May 2016 on this very mailing list.

-- 
Viatrix she|they https://viatrix.is-hella.gay
LYGetFile.diff (text/x-patch, 628 B)
--- LYGetFile.c	2018-04-01 08:27:18.000000000 -0700
+++ LYGetFile2.c	2023-11-12 13:40:20.170392644 -0800
@@ -741,6 +741,19 @@
 		FREE(tmp);
 		url_type = HTTP_URL_TYPE;
 	    }
+	    else if ((cp = StrChr(doc->address + 9, '/')) != NULL &&
+		0 == StrNCmp(++cp, "hURL", 4)) {
+			StrAllocCopy(tmp, cp + 4);
+			HTUnEscape(tmp);
+			if (*tmp == ':') {
+				CTRACE((tfp, "getfile: URL '%s'\n", doc->address));
+				StrAllocCopy(doc->address,tmp + 1);
+				FREE(tmp);
+				CTRACE((tfp, "  changed to '%s'\n", doc->address));
+				return getfile(doc, target);
+			}
+			else FREE(tmp);
+		}
 	}
 
 	if (url_type == HTTP_URL_TYPE ||
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEECRScMMLqbawFEVXLbbTQGyXkVXUFAmVRTv8ACgkQbbTQGyXk
VXXUgAf/aVVcJsk8yN6CAKXSGe5MAgAuBZpUeet/ImvEWeNDGEAS8gryDidEjl51
0/1aroX2xj1FDNDjqGaGZGB3LKGqarvqWn6RR6729gS2QBPWHpTxgHMDrXlQaAt8
cZKHFPg5HAF6Yfo6iXuftyLe6tyHZBKz1B06kN+BDCuGqS+VUfAglfxEaEmlemLo
lr8zLxKC+eDPGsYOvRYaLdo6xpDHvgMg8z0lzTtHcKhKJsvig2dScD8+4GaHIB8I
ScD8icWFOoY09vi4opg7Vq32fcTmjo0Cajf0jCnZ26uzmbJAA83o110TPh4xqTX0
rFw0SyWiguG769Xdk7mng4Rm3JBteA==
=2+vY
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.