aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Woodfall <dave@dawoodfall.net>2017-12-18 10:35:57 +0000
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2017-12-21 08:19:23 +0700
commitdd634581ab75b056993a358414a7c05936879fd4 (patch)
tree873b71d6db65ce26a2334938344812c70a32ce0f
parent236e844c3223f677a09852ffb9e6f14ab12361a2 (diff)
network/elinks: Patched for remote directory gopher links.
Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
-rw-r--r--network/elinks/0001-gopher_html_links.patch (renamed from network/elinks/gopher_html_links.patch)0
-rw-r--r--network/elinks/0002-gopher_index_queries.patch (renamed from network/elinks/gopher_index_queries.patch)2
-rw-r--r--network/elinks/0003-gopher_directory_links.patch60
-rw-r--r--network/elinks/elinks.SlackBuild9
4 files changed, 67 insertions, 4 deletions
diff --git a/network/elinks/gopher_html_links.patch b/network/elinks/0001-gopher_html_links.patch
index 4e34e9cdbca4..4e34e9cdbca4 100644
--- a/network/elinks/gopher_html_links.patch
+++ b/network/elinks/0001-gopher_html_links.patch
diff --git a/network/elinks/gopher_index_queries.patch b/network/elinks/0002-gopher_index_queries.patch
index 17d2ac4b3e91..e281e4cc4482 100644
--- a/network/elinks/gopher_index_queries.patch
+++ b/network/elinks/0002-gopher_index_queries.patch
@@ -17,7 +17,7 @@ diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c
+#endif
+
+/* To enable logging for debugging purposes. */
-+#if 1
++#if 0
+
+#define LOGFILE "/tmp/log"
+
diff --git a/network/elinks/0003-gopher_directory_links.patch b/network/elinks/0003-gopher_directory_links.patch
new file mode 100644
index 000000000000..6185af21b630
--- /dev/null
+++ b/network/elinks/0003-gopher_directory_links.patch
@@ -0,0 +1,60 @@
+#######################################################################
+# 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.
+#######################################################################
+diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c
+--- a/src/protocol/gopher/gopher.c 2017-12-17 01:54:27.941645180 +0000
++++ b/src/protocol/gopher/gopher.c 2017-12-17 21:52:05.072454433 +0000
+@@ -317,6 +317,9 @@
+ unsigned char *URL = "hURL%3";
+ unsigned char *CURI = "HURI%3";
+ unsigned char *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;
+@@ -354,6 +357,26 @@
+ selectorlen++;
+ }
+
++ if (entity_info->type == '1')
++ {
++ if (strstr(selector, DIR) == selector)
++ {
++ *selector++;
++ selectorlen--;
++ }
++ else
++ {
++ SLASHPOS = strstr(selector, SLASHDIR);
++ if (SLASHPOS != NULL)
++ {
++ if (strlen(SLASHPOS) == 2)
++ {
++ selectorlen--;
++ }
++ }
++ }
++ }
++
+ state = add_gopher_command(conn, &command, entity, selector, selectorlen);
+ if (!is_in_state(state, S_CONN))
+ return state;
+@@ -379,10 +402,10 @@
+ gopher->entity = entity_info;
+ gopher->commandlen = command.length;
+
+-debug_log("439 gopher->entity:", 1);
+-debug_log(gopher->entity, 1);
+-debug_log("437 command.source:", 1);
+-debug_log(command.source, 1);
++ debug_log("439 gopher->entity: ", 0);
++ debug_log(gopher->entity, 1);
++ debug_log("437 command.source: ", 0);
++ debug_log(command.source, 1);
+ memcpy(gopher->command, command.source, command.length);
+ done_string(&command);
+
diff --git a/network/elinks/elinks.SlackBuild b/network/elinks/elinks.SlackBuild
index 24505e81ffc2..21e907e8630d 100644
--- a/network/elinks/elinks.SlackBuild
+++ b/network/elinks/elinks.SlackBuild
@@ -26,7 +26,7 @@
PRGNAM=elinks
VERSION=${VERSION:-git20131231}
-BUILD=${BUILD:-6}
+BUILD=${BUILD:-7}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
@@ -72,10 +72,13 @@ find -L . \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
# Next patch fixes URL: html links
-patch --verbose -p1 < $CWD/gopher_html_links.patch
+patch --verbose -p1 < $CWD/0001-gopher_html_links.patch
# Next patch fixes index queries
-patch --verbose -p1 < $CWD/gopher_index_queries.patch
+patch --verbose -p1 < $CWD/0002-gopher_index_queries.patch
+
+# Next patch fixes remote directory links
+patch --verbose -p1 < $CWD/0003-gopher_directory_links.patch
[ -n "$NOMOUSE" ] && mouse="--disable-mouse"
[ -n "$NOGPM" ] && gpm="--without-gpm"