about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--CHANGES5
-rw-r--r--WWW/Library/Implementation/HTGopher.c40
2 files changed, 42 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index ac657bac..b35e8084 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,9 +1,10 @@
--- $LynxId: CHANGES,v 1.853 2016/10/14 09:25:53 tom Exp $
+-- $LynxId: CHANGES,v 1.854 2016/10/15 01:11:44 tom Exp $
 ===============================================================================
 Changes since Lynx 2.8 release
 ===============================================================================
 
 2016-10-14 (2.8.9dev.10)
+* begin work to parse gopher extension "link to URL" -TD
 * remove an obsolete comment in the manual page about -dump versus -force_html
   (report by Peter Schmitt).
 * modify samples/oldlynx to provide an empty ".lss" file as a better default
@@ -19,7 +20,7 @@ Changes since Lynx 2.8 release
   (patch by Al Walker).
 * add a limit-check in case colspan is given as zero for non-nested-table case
   (report by Sami Liedes) -TD
-* update nl.po from
+* update nl.po, sl.po from
     http://translationproject.org/latest/lynx
 
 2016-04-26 (2.8.9dev.9)
diff --git a/WWW/Library/Implementation/HTGopher.c b/WWW/Library/Implementation/HTGopher.c
index 30577a9d..a8c8c434 100644
--- a/WWW/Library/Implementation/HTGopher.c
+++ b/WWW/Library/Implementation/HTGopher.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTGopher.c,v 1.62 2015/12/16 01:17:53 tom Exp $
+ * $LynxId: HTGopher.c,v 1.63 2016/10/15 01:11:44 tom Exp $
  *
  *			GOPHER ACCESS				HTGopher.c
  *			=============
@@ -1688,6 +1688,36 @@ static int HTLoadCSO(const char *arg,
     return HT_LOADED;
 }
 
+static char *link_to_URL(const char *arg)
+{
+    char *result;
+    char *next;
+    char *temp = 0;
+
+    StrAllocCopy(temp, arg);
+    HTUnEscape(temp);
+    result = temp;
+
+    /* skip past method://host */
+    if ((next = strstr(result, "://")) != 0) {
+	result = next + 3;
+    }
+    if ((next = strchr(result, '/')) != 0) {
+	result = next + 1;
+    }
+    /* check if the selector is the special html one */
+    if (!strncmp(result, "hURL:", 5)) {
+	result += 5;
+	next = result;
+	result = temp;
+	while ((*temp++ = *next++) != 0) ;
+    } else {
+	FREE(temp);
+	result = 0;
+    }
+    return result;
+}
+
 /*	Load by name.						HTLoadGopher
  *	=============
  *
@@ -1697,6 +1727,7 @@ static int HTLoadGopher(const char *arg,
 			HTFormat format_out,
 			HTStream *sink)
 {
+    char *hURL;
     char *command;		/* The whole command */
     int status;			/* tcp return */
     char gtype;			/* Gopher Node type */
@@ -1843,6 +1874,13 @@ static int HTLoadGopher(const char *arg,
 	*p++ = LF;
 	*p = '\0';
     }
+    /*
+     * Check for link to URL
+     */
+    if ((hURL = link_to_URL(arg)) != 0) {
+	CTRACE((tfp, "gopher found link to URL '%s'\n", hURL));
+	free(hURL);
+    }
 
     /*
      * Set up a socket to the server for the data.