network/felinks: Updated for version 0.15.0.

Signed-off-by: Dave Woodfall <dave@slackbuilds.org>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Dave Woodfall 2022-06-06 21:30:30 +01:00 committed by Willy Sudiarto Raharjo
parent 83ec1777e9
commit 2930703049
No known key found for this signature in database
GPG key ID: 3F617144D7238786
8 changed files with 10 additions and 309 deletions

View file

@ -25,8 +25,7 @@ cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=felinks PRGNAM=felinks
SRCNAM=elinks SRCNAM=elinks
VERSION=${VERSION:-08da1d8} VERSION=${VERSION:-0.15.0}
COMMIT=${COMMIT:-08da1d87eb74e082ca7aae8c81d2518a4415f3a7}
BUILD=${BUILD:-1} BUILD=${BUILD:-1}
TAG=${TAG:-_SBo} TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz} PKGTYPE=${PKGTYPE:-tgz}
@ -73,9 +72,9 @@ set -e
rm -rf $PKG rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT mkdir -p $TMP $PKG $OUTPUT
cd $TMP cd $TMP
rm -rf $SRCNAM-$COMMIT rm -rf $SRCNAM-$VERSION
tar xvf $CWD/$SRCNAM-$COMMIT.tar.?z tar xvf $CWD/$SRCNAM-$VERSION.tar.?z
cd $SRCNAM-$COMMIT cd $SRCNAM-$VERSION
chown -R root:root . chown -R root:root .
find -L . \ find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
@ -83,11 +82,6 @@ find -L . \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
for patch in $CWD/patches/*; do
printf "\n%s\n" "Applying Patch $( basename $patch )"
patch --verbose -p1 < $patch
done
## System ## System
[ "${FASTMEM:-no}" = "yes" ] && fastmem="--enable-fastmem" [ "${FASTMEM:-no}" = "yes" ] && fastmem="--enable-fastmem"
[ "${DEBUG:-no}" = "yes" ] && debug="--enable-debug --disable-fastmem" [ "${DEBUG:-no}" = "yes" ] && debug="--enable-debug --disable-fastmem"
@ -183,9 +177,8 @@ LDFLAGS="$SLKLDFLAGS" \
# Don't clobber the one supplied by glibc-i18n. # Don't clobber the one supplied by glibc-i18n.
rm -f $PKG/usr/share/locale/locale.alias rm -f $PKG/usr/share/locale/locale.alias
if [ "$DEBUG" = "no" ]; then if [ "${DEBUG:-no}" = "no" ]; then
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | strip --strip-unneeded $PKG/usr/bin/$SRCNAM
grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
fi fi
find $PKG/usr/man -type f -exec gzip -9 {} \; find $PKG/usr/man -type f -exec gzip -9 {} \;

View file

@ -1,8 +1,8 @@
PRGNAM="felinks" PRGNAM="felinks"
VERSION="08da1d8" VERSION="0.15.0"
HOMEPAGE="https://github.com/rkd77/felinks" HOMEPAGE="https://github.com/rkd77/elinks"
DOWNLOAD="https://github.com/rkd77/felinks/archive/08da1d87eb74e082ca7aae8c81d2518a4415f3a7/elinks-08da1d87eb74e082ca7aae8c81d2518a4415f3a7.tar.gz" DOWNLOAD="https://github.com/rkd77elinks/archive/v0.15.0/elinks-0.15.0.tar.gz"
MD5SUM="58032b24cc7fea37ca6afeffd15d4d54" MD5SUM="52028102283424664c2ac2bdd23e991f"
DOWNLOAD_x86_64="" DOWNLOAD_x86_64=""
MD5SUM_x86_64="" MD5SUM_x86_64=""
REQUIRES="" REQUIRES=""

View file

@ -1,37 +0,0 @@
################################################################
# 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

View file

@ -1,113 +0,0 @@
#######################################################################
# 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)

View file

@ -1,26 +0,0 @@
#######################################################################
# 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;

View file

@ -1,50 +0,0 @@
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;
}

View file

@ -1,19 +0,0 @@
#######################################################################
# 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;

View file

@ -1,47 +0,0 @@
###################################################################
# 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, "<", "&lt;");
+ }
+ if (strstr(rb->data, ">")) {
+ str_replace(rb->data, ">", "&gt;");
+ }
+
while ((end = get_gopher_line_end(rb->data, rb->length))) {
unsigned char *line = check_gopher_last_line(rb->data, end);