diff options
author | Dave Woodfall <dave@slackbuilds.org> | 2020-01-09 10:14:49 +0000 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2020-01-12 08:47:52 +0700 |
commit | 9044f879a9a70226159660117c245a425a808293 (patch) | |
tree | 8ebbaa9baafe6ee3abd5ad6a07775e6447c9204e /network | |
parent | 7bf5d624be78d025b436312d3a1dd7a60c2b26f9 (diff) | |
download | slackbuilds-9044f879a9a70226159660117c245a425a808293.tar.gz |
network/elinks: Add gopher patch for html entities
Diffstat (limited to 'network')
-rw-r--r-- | network/elinks/elinks.SlackBuild | 2 | ||||
-rw-r--r-- | network/elinks/patches/0001-gopher_html_links.patch | 14 | ||||
-rw-r--r-- | network/elinks/patches/0002-gopher_index_queries.patch | 62 | ||||
-rw-r--r-- | network/elinks/patches/0003-gopher_directory_links.patch | 46 | ||||
-rw-r--r-- | network/elinks/patches/0004-ssl_cert_verify.patch | 4 | ||||
-rw-r--r-- | network/elinks/patches/0005-gopher_newlines_tabs_entity.patch | 51 | ||||
-rw-r--r-- | network/elinks/patches/0006-gopher-indexes_nocr.patch | 23 | ||||
-rw-r--r-- | network/elinks/patches/0006-indexes_nocr.patch | 62 | ||||
-rw-r--r-- | network/elinks/patches/0007-gopher-move_null.patch (renamed from network/elinks/patches/0007-move_null.patch) | 10 | ||||
-rw-r--r-- | network/elinks/patches/0008-gopher-encode-html.patch | 47 |
10 files changed, 127 insertions, 194 deletions
diff --git a/network/elinks/elinks.SlackBuild b/network/elinks/elinks.SlackBuild index 48769d4771..129980d383 100644 --- a/network/elinks/elinks.SlackBuild +++ b/network/elinks/elinks.SlackBuild @@ -23,7 +23,7 @@ PRGNAM=elinks VERSION=${VERSION:-git20131231} -BUILD=${BUILD:-10} +BUILD=${BUILD:-11} TAG=${TAG:-_SBo} if [ -z "$ARCH" ]; then diff --git a/network/elinks/patches/0001-gopher_html_links.patch b/network/elinks/patches/0001-gopher_html_links.patch index c9ab73856d..e2a927f9c8 100644 --- a/network/elinks/patches/0001-gopher_html_links.patch +++ b/network/elinks/patches/0001-gopher_html_links.patch @@ -1,21 +1,21 @@ ################################################################ -# There is a problem that html links that contain URL:htpp://... +# There is a problem that html links that contain URL:http:// # 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. -# dave@dawoodfall.net +# 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 2017-11-15 23:10:19.758394411 +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 *URI = "hURI%3"; -+ unsigned char *URL = "hURL%3"; -+ unsigned char *CURI = "HURI%3"; -+ unsigned char *CURL = "HURL%3"; ++ 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; diff --git a/network/elinks/patches/0002-gopher_index_queries.patch b/network/elinks/patches/0002-gopher_index_queries.patch index ab970f60f7..ce92695a0a 100644 --- a/network/elinks/patches/0002-gopher_index_queries.patch +++ b/network/elinks/patches/0002-gopher_index_queries.patch @@ -1,14 +1,14 @@ ####################################################################### # 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 +# 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. -# dave@dawoodfall.net +# you had entered the first. This patch fixes that and in my tests it +# seems to work so far. I've also added a primitive debug log. +# dave@slackbuilds.org ####################################################################### 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 +--- a/src/protocol/gopher/gopher.c 2020-01-08 05:37:57.443382095 +0000 ++++ b/src/protocol/gopher/gopher.c 2020-01-08 05:36:42.849199857 +0000 @@ -43,6 +43,34 @@ #include "util/memory.h" #include "util/string.h" @@ -44,14 +44,14 @@ diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c struct module gopher_protocol_module = struct_module( /* name: */ N_("Gopher"), /* options: */ NULL, -@@ -219,23 +247,31 @@ +@@ -219,11 +247,13 @@ 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 */ ++ /* fix query size to not include the search= part */ + query += 8; querylen = selector + selectorlen - query; /* Exclude '?' */ @@ -61,13 +61,7 @@ diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c 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); - } - +@@ -233,9 +263,11 @@ switch (entity) { case GOPHER_INDEX: /* No search required? */ @@ -80,18 +74,14 @@ diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c } 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 @@ +@@ -371,13 +403,14 @@ + add_gopher_search_field(struct string *buffer, const unsigned char *text, + const unsigned char *addr) + { ++ /* Not *every* query is a search */ + add_format_to_string(buffer, + "<form action=\"%s\">" + "<table>" "<td> </td>" "<td>%s:</td>" "<td><input maxlength=\"256\" name=\"search\" value=\"\"></td>" @@ -100,21 +90,3 @@ diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c "</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: diff --git a/network/elinks/patches/0003-gopher_directory_links.patch b/network/elinks/patches/0003-gopher_directory_links.patch index dc80ef3728..8c61f281bb 100644 --- a/network/elinks/patches/0003-gopher_directory_links.patch +++ b/network/elinks/patches/0003-gopher_directory_links.patch @@ -2,41 +2,34 @@ # 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@dawoodfall.net +# dave@slackbuilds.org ####################################################################### 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"; +--- 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; -@@ -354,6 +357,26 @@ +@@ -350,6 +353,19 @@ selectorlen++; } -+ if (entity_info->type == '1') -+ { -+ if (strstr(selector, DIR) == selector) -+ { ++ if (entity_info->type == '1') { ++ if (strstr(selector, DIR) == selector) { + *selector++; + selectorlen--; + } -+ else -+ { ++ else { + SLASHPOS = strstr(selector, SLASHDIR); -+ if (SLASHPOS != NULL) -+ { -+ if (strlen(SLASHPOS) == 2) -+ { ++ if (SLASHPOS != NULL && strlen(SLASHPOS) == 2) { + selectorlen--; -+ } + } + } + } @@ -44,18 +37,3 @@ diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c 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/patches/0004-ssl_cert_verify.patch b/network/elinks/patches/0004-ssl_cert_verify.patch index 4629da564a..0cb51242f7 100644 --- a/network/elinks/patches/0004-ssl_cert_verify.patch +++ b/network/elinks/patches/0004-ssl_cert_verify.patch @@ -3,8 +3,8 @@ # This is a modifed version of the patch here that fixes that issue: # http://lists.linuxfromscratch.org/pipermail/elinks-dev/2015-June/002099.html # This patch turns on verification by default, and differentiates -# between host verification fail and normal SSL errors. -# dave@dawoodfall.net +# between host verification fail and normal SSL errors, but more needs doing. +# dave@slackbuilds.org ############################################################################## --- a/configure.in 2017-12-21 15:58:12.470247050 +0000 +++ b/configure.in 2017-12-21 16:10:27.406938487 +0000 diff --git a/network/elinks/patches/0005-gopher_newlines_tabs_entity.patch b/network/elinks/patches/0005-gopher_newlines_tabs_entity.patch index f93b0d5431..f27b655cc6 100644 --- a/network/elinks/patches/0005-gopher_newlines_tabs_entity.patch +++ b/network/elinks/patches/0005-gopher_newlines_tabs_entity.patch @@ -2,11 +2,12 @@ # Some fixes for having line feeds in text without a carriage return. # Make sure that only lines with tabs are treated as links. # Support links that don't begin with a '/'. +# dave@slackbuilds.org ##################################################################### diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c ---- a/src/protocol/gopher/gopher.c 2017-12-28 15:08:54.310546900 +0000 -+++ b/src/protocol/gopher/gopher.c 2017-12-28 20:26:00.635193897 +0000 -@@ -326,7 +326,7 @@ +--- a/src/protocol/gopher/gopher.c 2020-01-08 05:43:40.148408539 +0000 ++++ b/src/protocol/gopher/gopher.c 2020-01-08 05:43:26.357005028 +0000 +@@ -322,7 +322,7 @@ /* Get entity type, and selector string. */ /* Pick up gopher_entity */ @@ -15,29 +16,7 @@ diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c entity = *selector++; selectorlen--; } -@@ -357,8 +357,7 @@ - selectorlen++; - } - -- if (entity_info->type == '1') -- { -+ if (entity_info->type == '1') { - if (strstr(selector, DIR) == selector) - { - *selector++; -@@ -402,9 +401,9 @@ - gopher->entity = entity_info; - gopher->commandlen = command.length; - -- debug_log("439 gopher->entity: ", 0); -+ debug_log("404 gopher->entity: ", 0); - debug_log(gopher->entity, 1); -- debug_log("437 command.source: ", 0); -+ debug_log("406 command.source: ", 0); - debug_log(command.source, 1); - memcpy(gopher->command, command.source, command.length); - done_string(&command); -@@ -486,6 +485,7 @@ +@@ -472,6 +472,7 @@ unsigned char *host = NULL; unsigned char *port = NULL; enum gopher_entity entity = *name++; @@ -45,7 +24,7 @@ diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c if (!entity) { add_char_to_string(buffer, '\n'); -@@ -495,6 +495,7 @@ +@@ -481,6 +482,7 @@ if (*name) { selector = strchr(name, ASCII_TAB); if (selector) { @@ -53,7 +32,7 @@ diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c /* Terminate name */ *selector++ = '\0'; -@@ -565,7 +566,7 @@ +@@ -551,7 +553,7 @@ switch (entity) { case GOPHER_WWW: /* Gopher pointer to W3 */ @@ -62,7 +41,7 @@ diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c add_gopher_link(buffer, name, selector); break; } -@@ -617,7 +618,8 @@ +@@ -603,7 +605,8 @@ } else if (address.length > 0 && strlcmp(address.source, address.length - 1, @@ -72,16 +51,12 @@ diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c add_gopher_link(buffer, name, address.source); } else { -@@ -639,6 +641,12 @@ +@@ -623,7 +626,7 @@ + get_gopher_line_end(unsigned char *data, int datalen) + { for (; datalen > 1; data++, datalen--) - if (data[0] == ASCII_CR && data[1] == ASCII_LF) +- if (data[0] == ASCII_CR && data[1] == ASCII_LF) ++ if (data[0] == ASCII_CR || data[0] == ASCII_LF) return data + 2; -+ else -+ if(data[0] == ASCII_CR) -+ return data + 2; -+ else -+ if(data[0] == ASCII_LF) -+ return data + 2; return NULL; - } diff --git a/network/elinks/patches/0006-gopher-indexes_nocr.patch b/network/elinks/patches/0006-gopher-indexes_nocr.patch new file mode 100644 index 0000000000..797c9a8b55 --- /dev/null +++ b/network/elinks/patches/0006-gopher-indexes_nocr.patch @@ -0,0 +1,23 @@ +####################################################################### +# Fixes index listings with only LF and no CRs. +# 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 07:39:33.403725857 +0000 ++++ b/src/protocol/gopher/gopher.c 2020-01-08 07:40:30.587406965 +0000 +@@ -779,6 +779,15 @@ + switch (gopher->entity->type) { + case GOPHER_DIRECTORY: + case GOPHER_INDEX: ++ /* Lines with no carriage returns */ ++ if (strchr(rb->data, ASCII_CR) == NULL) { ++ unsigned char *tmp = malloc(rb->length + 3); ++ tmp[0] = 'i'; ++ tmp = stpcpy(stpcpy(stpcpy(tmp, rb->data), '\r'), '\n'); ++ rb->length += 3; ++ memcpy(rb->data, tmp, rb->length); ++ free(tmp); ++ } + state = read_gopher_directory_data(conn, rb); + break; + diff --git a/network/elinks/patches/0006-indexes_nocr.patch b/network/elinks/patches/0006-indexes_nocr.patch deleted file mode 100644 index 5c68cee8ca..0000000000 --- a/network/elinks/patches/0006-indexes_nocr.patch +++ /dev/null @@ -1,62 +0,0 @@ -####################################################################### -# Fixes index listings with only LF and no CRs. -# dave@dawoodfall.net -####################################################################### -diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c ---- a/src/protocol/gopher/gopher.c 2017-12-29 17:14:24.247093626 +0000 -+++ b/src/protocol/gopher/gopher.c 2017-12-29 17:12:08.496272595 +0000 -@@ -638,15 +638,16 @@ - static unsigned char * - get_gopher_line_end(unsigned char *data, int datalen) - { -- for (; datalen > 1; data++, datalen--) -- if (data[0] == ASCII_CR && data[1] == ASCII_LF) -+ for (; datalen > 1; data++, datalen--) { -+ if (data[0] == ASCII_CR && data[1] == ASCII_LF) - return data + 2; - else - if(data[0] == ASCII_CR) -- return data + 2; -- else -- if(data[0] == ASCII_LF) -- return data + 2; -+ return data + 1; -+ else -+ if(data[0] == ASCII_LF) -+ return data + 1; -+ } - - return NULL; - } -@@ -796,9 +797,21 @@ - - /* Now read the data from the socket */ - switch (gopher->entity->type) { -+ case GOPHER_INDEX: -+ /* Lines with no carriage returns */ -+ if (strchr(rb->data, ASCII_CR) == NULL) { -+ unsigned char *tmp; -+ tmp = malloc(rb->length + 3); -+ memcpy(tmp, "i", 1); -+ memcpy(tmp+1, rb->data, rb->length); -+ tmp[rb->length]= '\r'; -+ tmp[rb->length+1]= '\n'; -+ rb->length+=3; -+ memcpy(rb->data, tmp, rb->length); -+ free(tmp); -+ } -+ - case GOPHER_DIRECTORY: --/* Don't do directory list for cgi output (7) -- case GOPHER_INDEX: */ - state = read_gopher_directory_data(conn, rb); - break; - -@@ -810,7 +823,6 @@ - state = connection_state(S_GOPHER_CSO_ERROR); - break; - -- case GOPHER_INDEX: - case GOPHER_SOUND: - case GOPHER_PLUS_SOUND: - case GOPHER_PLUS_MOVIE: diff --git a/network/elinks/patches/0007-move_null.patch b/network/elinks/patches/0007-gopher-move_null.patch index 9d8037cc37..01751c497a 100644 --- a/network/elinks/patches/0007-move_null.patch +++ b/network/elinks/patches/0007-gopher-move_null.patch @@ -1,11 +1,11 @@ ################################################################### # Move the added null terminator one char forwards -# dave@dawoodfall.net +# dave@slackbuilds.org ################################################################### -diff --exclude .git -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c ---- a/src/protocol/gopher/gopher.c 2017-12-29 17:15:39.521209968 +0000 -+++ b/src/protocol/gopher/gopher.c 2018-01-17 05:46:45.660258482 +0000 -@@ -658,7 +658,7 @@ +diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c +--- a/src/protocol/gopher/gopher.c 2020-01-08 06:52:23.491455711 +0000 ++++ b/src/protocol/gopher/gopher.c 2020-01-08 06:51:41.160210431 +0000 +@@ -638,7 +638,7 @@ assert(line < end); /* Just to be safe NUL terminate the line */ diff --git a/network/elinks/patches/0008-gopher-encode-html.patch b/network/elinks/patches/0008-gopher-encode-html.patch new file mode 100644 index 0000000000..21486ff1a4 --- /dev/null +++ b/network/elinks/patches/0008-gopher-encode-html.patch @@ -0,0 +1,47 @@ +diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c +--- a/src/protocol/gopher/gopher.c 2020-01-09 09:19:54.983674477 +0000 ++++ b/src/protocol/gopher/gopher.c 2020-01-09 09:21:58.885286474 +0000 +@@ -663,6 +663,25 @@ + return line[0] == '.' && !line[1] ? NULL : line; + } + ++/* substring replacement */ ++static void ++str_replace(char * in_string, char * s_string, char * r_string) ++{ ++ /* max == replace all characters */ ++ char temp[strlen(in_string) * (strlen(r_string) - strlen(s_string))]; ++ char * pos; ++ ++ if (!(pos = strstr(in_string, s_string))) ++ return; ++ ++ strncpy(temp, in_string, pos - in_string); ++ temp[pos - in_string] = 0; ++ sprintf(temp + (pos - in_string), "%s%s", r_string, pos + strlen(s_string)); ++ in_string[0] = 0; ++ strcpy(in_string, temp); ++ return str_replace(in_string, s_string, r_string); ++} ++ + /* Parse a Gopher Menu document */ + static struct connection_state + read_gopher_directory_data(struct connection *conn, struct read_buffer *rb) +@@ -682,6 +701,17 @@ + return connection_state(S_OUT_OF_MEM); + } + ++ /* Lines with characters that need to be converted to html */ ++ if (strstr(rb->data, "<")) { ++ str_replace(rb->data, "<", "<"); ++ } ++ if (strstr(rb->data, ">")) { ++ str_replace(rb->data, ">", ">"); ++ } ++ if (strstr(rb->data, "\"")) { ++ str_replace(rb->data, "\"", """); ++ } ++ + while ((end = get_gopher_line_end(rb->data, rb->length))) { + unsigned char *line = check_gopher_last_line(rb->data, end); + |