diff options
author | Dave Woodfall <dave@slackbuilds.org> | 2020-09-12 08:52:02 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2020-09-12 23:44:59 +0700 |
commit | a689188b56c0b494c0aefefdd4d93780d0cf48e7 (patch) | |
tree | 7b0e5a18f74d45a4f9c51a8f38238177177febe6 /network/felinks/patches | |
parent | 69ce7e253e572491a5aea319bd7377d8ae4a08db (diff) |
network/felinks: Added (A fork of Elinks, the web browser).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'network/felinks/patches')
6 files changed, 292 insertions, 0 deletions
diff --git a/network/felinks/patches/0001-gopher_html_links.patch b/network/felinks/patches/0001-gopher_html_links.patch new file mode 100644 index 000000000000..38a2dd0b1081 --- /dev/null +++ b/network/felinks/patches/0001-gopher_html_links.patch @@ -0,0 +1,37 @@ +################################################################ +# 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 diff --git a/network/felinks/patches/0002-gopher_index_queries.patch b/network/felinks/patches/0002-gopher_index_queries.patch new file mode 100644 index 000000000000..662fd13a7f84 --- /dev/null +++ b/network/felinks/patches/0002-gopher_index_queries.patch @@ -0,0 +1,113 @@ +####################################################################### +# Fix for type 7 entities. +# dave@slackbuilds.org +####################################################################### +diff -Naur '--exclude=.git' bb/src/protocol/gopher/gopher.c cc/src/protocol/gopher/gopher.c +--- bb/src/protocol/gopher/gopher.c 2020-01-13 22:35:13.663935305 +0000 ++++ cc/src/protocol/gopher/gopher.c 2020-01-13 23:16:00.053003768 +0000 +@@ -197,7 +197,7 @@ + command->length = strlen(command->source); + } + +-static struct connection_state init_gopher_index_cache_entry(struct connection *conn); ++/* static struct connection_state init_gopher_index_cache_entry(struct connection *conn); */ + + static struct connection_state + add_gopher_command(struct connection *conn, struct string *command, +@@ -205,7 +205,7 @@ + unsigned char *selector, int selectorlen) + { + unsigned char *query; +- int querylen; ++ int querylen = 0; + + if (!init_string(command)) + return connection_state(S_OUT_OF_MEM); +@@ -218,13 +218,14 @@ + /* Exclude '?' */ + if (query) selectorlen -= 1; + query = NULL; +- querylen = 0; +- } else { +- query += 1; ++ } else if (entity == GOPHER_INDEX) { ++ /* fix query size to not include the search= part */ ++ query += 8; + querylen = selector + selectorlen - query; + /* Exclude '?' */ +- selectorlen -= querylen + 1; +- if (querylen >= 7 && !c_strncasecmp(query, "search=", 7)) { ++ /* fix selector length to fit with query */ ++ selectorlen -= querylen + 8; ++ if (querylen >= 7 && !c_strncasecmp(query, "submit=", 7)) { + query += 7; + querylen -= 7; + } +@@ -233,9 +234,11 @@ + 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); +@@ -371,13 +374,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>" +- "<td><input type=submit value=\"Search\"></td>" ++ "<td><input maxlength=\"256\" name=\"submit\" value=\"\"></td>" ++ "<td><input type=submit value=\"Submit\"></td>" + "</table>" + "</form>", + addr, text); +@@ -662,6 +666,7 @@ + } + + /* Display a Gopher Index document. */ ++/* Use the page that the gopher site sends us + static struct connection_state + init_gopher_index_cache_entry(struct connection *conn) + { +@@ -674,9 +679,9 @@ + + where = get_uri_string(conn->uri, URI_PUBLIC); + +- /* TODO: Use different function when using UTF-8 ++ TODO: Use different function when using UTF-8 + * in terminal (decode_uri_for_display replaces +- * bytes of UTF-8 characters width '*'). */ ++ * bytes of UTF-8 characters width '*'). * + if (where) decode_uri_for_display(where); + + add_format_to_string(&buffer, +@@ -695,7 +700,7 @@ + + mem_free_if(where); + +- /* FIXME: I think this needs a form or something */ ++ * FIXME: I think this needs a form or something * + + add_fragment(conn->cached, conn->from, buffer.source, buffer.length); + conn->from += buffer.length; +@@ -707,7 +712,7 @@ + ? connection_state(S_OK) + : connection_state(S_OUT_OF_MEM); + } +- ++*/ + + static void + read_gopher_response_data(struct socket *socket, struct read_buffer *rb) diff --git a/network/felinks/patches/0003-gopher_directory_links.patch b/network/felinks/patches/0003-gopher_directory_links.patch new file mode 100644 index 000000000000..15a89fac2f29 --- /dev/null +++ b/network/felinks/patches/0003-gopher_directory_links.patch @@ -0,0 +1,26 @@ +####################################################################### +# Fix remote directory links. +# dave@slackbuilds.org +####################################################################### +diff -Naur -x .git bb/src/protocol/gopher/gopher.c cc/src/protocol/gopher/gopher.c +--- bb/src/protocol/gopher/gopher.c 2020-01-13 23:22:18.918292198 +0000 ++++ cc/src/protocol/gopher/gopher.c 2020-01-13 23:21:00.631960039 +0000 +@@ -321,6 +321,18 @@ + selectorlen++; + } + ++ if (entity_info->type == '1') { ++ if (strchr(selector, '1') == (char *) selector) { ++ selector++; ++ selectorlen--; ++ } ++ else { ++ if ((char *) selector == "/1") { ++ selectorlen--; ++ } ++ } ++ } ++ + state = add_gopher_command(conn, &command, entity, selector, selectorlen); + if (!is_in_state(state, S_CONN)) + return state; diff --git a/network/felinks/patches/0005-gopher_newlines_tabs_entity-2.patch b/network/felinks/patches/0005-gopher_newlines_tabs_entity-2.patch new file mode 100644 index 000000000000..2885a67e76b3 --- /dev/null +++ b/network/felinks/patches/0005-gopher_newlines_tabs_entity-2.patch @@ -0,0 +1,50 @@ +diff -Naur a/src/protocol/gopher/gopher.c b/src/protocol/gopher/gopher.c +--- a/src/protocol/gopher/gopher.c 2020-01-31 16:50:36.000000000 +0000 ++++ b/src/protocol/gopher/gopher.c 2020-05-14 06:21:44.523952135 +0000 +@@ -283,7 +283,7 @@ + + /* Get entity type, and selector string. */ + /* Pick up gopher_entity */ +- if (selectorlen > 1 && selector[1] == '/') { ++ if (selectorlen > 1) { + entity = *selector++; + selectorlen--; + } +@@ -308,6 +308,18 @@ + selectorlen--; + } + ++ if (entity_info->type == '1') { ++ if (strchr(selector, '1') == (char *) selector) { ++ selector++; ++ selectorlen--; ++ } ++ else { ++ if ((char *) selector == "/1") { ++ selectorlen--; ++ } ++ } ++ } ++ + state = add_gopher_command(conn, &command, entity, selector, selectorlen); + if (!is_in_state(state, S_CONN)) + return state; +@@ -548,7 +560,8 @@ + + } else if (address.length > 0 + && strlcmp(address.source, address.length - 1, +- "gopher://error.host:1/", -1)) { ++ "gopher://error.host:1/", -1) ++ && selector) { + add_gopher_link(buffer, name, address.source); + + } else { +@@ -571,7 +584,7 @@ + if (data[0] == ASCII_CR && data[1] == ASCII_LF) + return data + 2; + +- if (data[0] == ASCII_LF) ++ if (data[0] == ASCII_CR || data[0] == ASCII_LF) + return data + 1; + } + diff --git a/network/felinks/patches/0006-gopher-indexes_nocr.patch b/network/felinks/patches/0006-gopher-indexes_nocr.patch new file mode 100644 index 000000000000..9e4a441db66c --- /dev/null +++ b/network/felinks/patches/0006-gopher-indexes_nocr.patch @@ -0,0 +1,19 @@ +####################################################################### +# Fix index listings with only LF and no CRs. +# dave@slackbuilds.org +####################################################################### +diff -Naur '--exclude=.git' bb/src/protocol/gopher/gopher.c cc/src/protocol/gopher/gopher.c +--- bb/src/protocol/gopher/gopher.c 2020-01-14 06:42:11.030536586 +0000 ++++ cc/src/protocol/gopher/gopher.c 2020-01-14 06:42:26.710000886 +0000 +@@ -757,6 +757,11 @@ + switch (gopher->entity->type) { + case GOPHER_DIRECTORY: + case GOPHER_INDEX: ++ /* Lines with no carriage returns */ ++ if (strchr(rb->data, ASCII_CR) == NULL) { ++ strncat(rb->data, "\r\n", 2); ++ rb->length += 3; ++ } + state = read_gopher_directory_data(conn, rb); + break; + diff --git a/network/felinks/patches/0008-gopher-html-entities.patch b/network/felinks/patches/0008-gopher-html-entities.patch new file mode 100644 index 000000000000..750d1a49deb4 --- /dev/null +++ b/network/felinks/patches/0008-gopher-html-entities.patch @@ -0,0 +1,47 @@ +################################################################### +# Encode < > to HTML. +################################################################### +diff -Naur '--exclude=.git' bb/src/protocol/gopher/gopher.c cc/src/protocol/gopher/gopher.c +--- bb/src/protocol/gopher/gopher.c 2020-01-14 03:26:41.791778387 +0000 ++++ cc/src/protocol/gopher/gopher.c 2020-01-14 06:19:56.964025440 +0000 +@@ -620,6 +620,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)) + 1]; ++ 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 + 1); ++ 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) +@@ -639,6 +658,14 @@ + 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, ">", ">"); ++ } ++ + while ((end = get_gopher_line_end(rb->data, rb->length))) { + unsigned char *line = check_gopher_last_line(rb->data, end); + |