aboutsummaryrefslogtreecommitdiff
path: root/network/elinks
diff options
context:
space:
mode:
authorDavid Woodfall <dave@dawoodfall.net>2017-11-30 21:55:02 +0000
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2017-12-02 06:31:05 +0700
commit08b044fcddda4280f5ca3ca69db7a6748a222a6b (patch)
tree9c3fd5d5400d70e43f672908a5634d934c447b89 /network/elinks
parent1447dddb4dba74a6b752ecd37c70befa71be19e4 (diff)
network/elinks: Patched to fix gopher index queries.
Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
Diffstat (limited to 'network/elinks')
-rw-r--r--network/elinks/elinks.SlackBuild8
-rw-r--r--network/elinks/gopher_html_links.patch (renamed from network/elinks/gopher-html.patch)6
-rw-r--r--network/elinks/gopher_index_queries.patch119
3 files changed, 131 insertions, 2 deletions
diff --git a/network/elinks/elinks.SlackBuild b/network/elinks/elinks.SlackBuild
index 4e01d232d48d6..24505e81ffc2d 100644
--- a/network/elinks/elinks.SlackBuild
+++ b/network/elinks/elinks.SlackBuild
@@ -26,7 +26,7 @@
PRGNAM=elinks
VERSION=${VERSION:-git20131231}
-BUILD=${BUILD:-4}
+BUILD=${BUILD:-6}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
@@ -71,7 +71,11 @@ find -L . \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
-patch --verbose -p1 < $CWD/gopher-html.patch
+# Next patch fixes URL: html links
+patch --verbose -p1 < $CWD/gopher_html_links.patch
+
+# Next patch fixes index queries
+patch --verbose -p1 < $CWD/gopher_index_queries.patch
[ -n "$NOMOUSE" ] && mouse="--disable-mouse"
[ -n "$NOGPM" ] && gpm="--without-gpm"
diff --git a/network/elinks/gopher-html.patch b/network/elinks/gopher_html_links.patch
index 350f577721399..4e34e9cdbca49 100644
--- a/network/elinks/gopher-html.patch
+++ b/network/elinks/gopher_html_links.patch
@@ -1,3 +1,9 @@
+################################################################
+# There is a problem that html links that contain URL:htpp://...
+# aren't being followed. This fixes that issue and also chtml.
+# Normally those kind of links go to a redirect page that the
+# server generates, which then sends you on your way.
+###############################################################
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 2017-11-15 23:10:19.758394411 +0000
diff --git a/network/elinks/gopher_index_queries.patch b/network/elinks/gopher_index_queries.patch
new file mode 100644
index 0000000000000..17d2ac4b3e91e
--- /dev/null
+++ b/network/elinks/gopher_index_queries.patch
@@ -0,0 +1,119 @@
+#######################################################################
+# elinks by default generates its own search query form when it sees
+# a type 7 index entity. The problem is that it didn't read the
+# served results page and instead generated another search page after
+# you had entered the first. This patch fixes that and in my tests it
+# seems to work so far.
+#######################################################################
+diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c
+--- a/src/protocol/gopher/gopher.c 2017-11-24 19:12:52.495714437 +0000
++++ b/src/protocol/gopher/gopher.c 2017-11-30 12:56:38.872336516 +0000
+@@ -43,6 +43,34 @@
+ #include "util/memory.h"
+ #include "util/string.h"
+
++#ifdef HAVE_FCNTL_H
++#include <fcntl.h> /* OS/2 needs this after sys/types.h */
++#endif
++
++/* To enable logging for debugging purposes. */
++#if 1
++
++#define LOGFILE "/tmp/log"
++
++static void
++debug_log(unsigned char *data, int NL)
++{
++ int fd = open(LOGFILE, O_WRONLY | O_APPEND | O_CREAT, 0622);
++
++ if (fd == -1) return;
++
++ set_bin(fd);
++ write(fd, data, strlen(data));
++ if (NL)
++ write(fd, "\n", 1);
++ close(fd);
++}
++#undef LOGFILE
++
++#else
++#define debug_log(data, len)
++#endif
++
+ struct module gopher_protocol_module = struct_module(
+ /* name: */ N_("Gopher"),
+ /* options: */ NULL,
+@@ -219,23 +247,31 @@
+ if (query) selectorlen -= 1;
+ query = NULL;
+ querylen = 0;
+- } else {
+- query += 1;
++ } else if (entity == GOPHER_INDEX) {
++ /* fix query size to not include the seach= part */
++ query += 8;
+ querylen = selector + selectorlen - query;
+ /* Exclude '?' */
+- selectorlen -= querylen + 1;
++ /* fix selector length to fit with query */
++ selectorlen -= querylen + 8;
+ if (querylen >= 7 && !c_strncasecmp(query, "search=", 7)) {
+ query += 7;
+ querylen -= 7;
+ }
++ debug_log("selector:", 1);
++ debug_log(selector, 1);
++ debug_log("query:", 1);
++ debug_log(query, 1);
+ }
+
+ switch (entity) {
+ case GOPHER_INDEX:
+ /* No search required? */
++ /* Don't display the form page */
+ if (!query) {
+ done_string(command);
+- return init_gopher_index_cache_entry(conn);
++ add_uri_decoded(command, selector, selectorlen, 0);
++ break;
+ }
+
+ add_uri_decoded(command, selector, selectorlen, 0);
+@@ -343,6 +379,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);
+ memcpy(gopher->command, command.source, command.length);
+ done_string(&command);
+
+@@ -377,7 +417,7 @@
+ "<td> </td>"
+ "<td>%s:</td>"
+ "<td><input maxlength=\"256\" name=\"search\" value=\"\"></td>"
+- "<td><input type=submit value=\"Search\"></td>"
++ "<td><input type=submit value=\"Submit\"></td>"
+ "</table>"
+ "</form>",
+ addr, text);
+@@ -726,7 +766,8 @@
+ /* Now read the data from the socket */
+ switch (gopher->entity->type) {
+ case GOPHER_DIRECTORY:
+- case GOPHER_INDEX:
++/* Don't do directory list for cgi output (7)
++ case GOPHER_INDEX: */
+ state = read_gopher_directory_data(conn, rb);
+ break;
+
+@@ -738,6 +779,7 @@
+ state = connection_state(S_GOPHER_CSO_ERROR);
+ break;
+
++ case GOPHER_INDEX:
+ case GOPHER_SOUND:
+ case GOPHER_PLUS_SOUND:
+ case GOPHER_PLUS_MOVIE: