slackbuilds_ponce/network/elinks/patches/0020-gopher-html-links.patch
Dave Woodfall 4b6c4b9509
network/elinks: Add Patches: disable suspend, -no-connect
2 contributed patches.
VERSION renumbering with commit hash.  Not likely to change unless
felinks fixes are back-ported though.
Change download URL.
Extra notes in README.
Tidy up slackbuild a bit. Move stuff.

Signed-off-by: Dave Woodfall <dave@slackbuilds.org>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
2022-04-30 13:51:48 +07:00

37 lines
1.3 KiB
Diff

################################################################
# Fix for HTML links that contain URL:http://
# dave@slackbuilds.org
###############################################################
diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c
--- a/src/protocol/gopher/gopher.c 2013-12-18 15:38:57.000000000 +0000
+++ b/src/protocol/gopher/gopher.c 2020-01-08 05:34:02.300498220 +0000
@@ -277,6 +277,10 @@
struct string command;
enum gopher_entity entity = DEFAULT_GOPHER_ENTITY;
unsigned char *selector = conn->uri->data;
+ unsigned char const* URI = "hURI%3";
+ unsigned char const* URL = "hURL%3";
+ unsigned char const* CURI = "HURI%3";
+ unsigned char const* CURL = "HURL%3";
int selectorlen = conn->uri->datalen;
struct gopher_entity_info *entity_info;
size_t size;
@@ -288,6 +292,18 @@
selectorlen--;
}
+ if(strstr(selector, URL) != NULL || strstr(selector, URI) != NULL) {
+ entity = GOPHER_HTML;
+ selector++;
+ selectorlen--;
+ }
+
+ if(strstr(selector, CURL) != NULL || strstr(selector, CURI) != NULL) {
+ entity = GOPHER_CHTML;
+ selector++;
+ selectorlen--;
+ }
+
/* This is probably a hack. It serves as a work around when no entity is
* available in the Gopher URI. Instead of segfaulting later the content
* will be served as application/octet-stream. However, it could