slackbuilds_ponce/network/felinks/patches/0005-gopher_newlines_tabs_entity-2.patch
Dave Woodfall a689188b56
network/felinks: Added (A fork of Elinks, the web browser).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
2020-09-12 23:44:59 +07:00

50 lines
1.3 KiB
Diff

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;
}