blob: 8c61f281bbd9a26c4b79a75784641e9ac6fe6ac5 (
plain)
#######################################################################
# elinks does not follow links to directories on other servers
# properly. This adds a '/' before the '1' at the start of a link and
# removes any trailing 1.
# dave@slackbuilds.org
#######################################################################
diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c
--- a/src/protocol/gopher/gopher.c 2020-01-08 04:56:18.809169382 +0000
+++ b/src/protocol/gopher/gopher.c 2020-01-08 04:52:43.722879240 +0000
@@ -313,6 +313,9 @@
unsigned char const* URL = "hURL%3";
unsigned char const* CURI = "HURI%3";
unsigned char const* CURL = "HURL%3";
+ unsigned char *DIR = "1";
+ unsigned char *SLASHDIR = "/1";
+ unsigned char *SLASHPOS;
int selectorlen = conn->uri->datalen;
struct gopher_entity_info *entity_info;
size_t size;
@@ -350,6 +353,19 @@
selectorlen++;
}
+ if (entity_info->type == '1') {
+ if (strstr(selector, DIR) == selector) {
+ *selector++;
+ selectorlen--;
+ }
+ else {
+ SLASHPOS = strstr(selector, SLASHDIR);
+ if (SLASHPOS != NULL && strlen(SLASHPOS) == 2) {
+ selectorlen--;
+ }
+ }
+ }
+
state = add_gopher_command(conn, &command, entity, selector, selectorlen);
if (!is_in_state(state, S_CONN))
return state;
|