about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--CHANGES7
-rw-r--r--WWW/Library/Implementation/HTAccess.h3
-rw-r--r--WWW/Library/Implementation/HTGopher.c37
-rw-r--r--src/HTFWriter.c6
-rw-r--r--src/LYUtils.c4
5 files changed, 41 insertions, 16 deletions
diff --git a/CHANGES b/CHANGES
index eb64c043..e17f2a71 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,9 +1,12 @@
--- $LynxId: CHANGES,v 1.1019 2019/08/23 23:58:51 tom Exp $
+-- $LynxId: CHANGES,v 1.1020 2019/08/25 20:04:11 tom Exp $
 ===============================================================================
 Changes since Lynx 2.8 release
 ===============================================================================
 
-2019-08-23 (2.9.0dev.3)
+2019-08-25 (2.9.0dev.3)
+* modify gophermap menu-parsing to handle "h" HTML selectors similarly to the
+  command-line parsing, which avoids hex-encoding the parameter delimiters
+  "?", "=", ";" as well as "#" (report by Tobias Girstmair) -TD
 * make redirection-limit configurable, defaulting to 10 -TD
 * remove alert when relative base href is seen, since HTML5 allows for this
   (report by Sylvain Bertrand) -TD
diff --git a/WWW/Library/Implementation/HTAccess.h b/WWW/Library/Implementation/HTAccess.h
index 3aa9c6d9..b898535c 100644
--- a/WWW/Library/Implementation/HTAccess.h
+++ b/WWW/Library/Implementation/HTAccess.h
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTAccess.h,v 1.20 2008/01/03 00:24:16 tom Exp $
+ * $LynxId: HTAccess.h,v 1.21 2019/08/23 23:51:45 tom Exp $
  *					HTAccess:  Access manager for libwww
  *			ACCESS MANAGER
  *
@@ -24,6 +24,7 @@ extern "C" {
 #endif
     extern char *use_this_url_instead;
 
+    extern int redirection_limit;
     extern int redirection_attempts;
 
 /*      Return codes from load routines:
diff --git a/WWW/Library/Implementation/HTGopher.c b/WWW/Library/Implementation/HTGopher.c
index 865985c2..7c60af5e 100644
--- a/WWW/Library/Implementation/HTGopher.c
+++ b/WWW/Library/Implementation/HTGopher.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTGopher.c,v 1.71 2018/12/28 16:58:59 tom Exp $
+ * $LynxId: HTGopher.c,v 1.73 2019/08/25 19:59:48 tom Exp $
  *
  *			GOPHER ACCESS				HTGopher.c
  *			=============
@@ -140,7 +140,8 @@ typedef struct _CSOformgen_context {	/* For form-based CSO gateway - FM */
 /*	Matrix of allowed characters in filenames
  *	=========================================
  */
-static BOOL acceptable[256];
+static BOOL acceptable_html[256];
+static BOOL acceptable_file[256];
 static BOOL acceptable_inited = NO;
 
 static void init_acceptable(void)
@@ -149,10 +150,17 @@ static void init_acceptable(void)
     const char *good =
     "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./-_$";
 
-    for (i = 0; i < 256; i++)
-	acceptable[i] = NO;
-    for (; *good; good++)
-	acceptable[(unsigned int) *good] = YES;
+    for (i = 0; i < 256; i++) {
+	acceptable_html[i] = NO;
+	acceptable_file[i] = NO;
+    }
+    for (; *good; good++) {
+	acceptable_html[(unsigned int) *good] = YES;
+	acceptable_file[(unsigned int) *good] = YES;
+    }
+    for (good = ";?=#"; *good; ++good) {
+	acceptable_html[(unsigned int) *good] = YES;
+    }
     acceptable_inited = YES;
 }
 
@@ -224,6 +232,7 @@ static void parse_menu(const char *arg GCC_UNUSED,
     int bytes = 0;
     int BytesReported = 0;
     char buffer[128];
+    BOOL *valid_chars;
 
 #define TAB		'\t'
 #define HEX_ESCAPE	'%'
@@ -432,10 +441,22 @@ static void parse_menu(const char *arg GCC_UNUSED,
 
 		    if (gtype != GOPHER_DUPLICATE)
 			this_type = gtype;
-		    HTSprintf0(&address, "//%s/%c", host, this_type);
+
+		    if (gtype == GOPHER_HTML) {
+			valid_chars = acceptable_html;
+			HTSprintf0(&address, "//%s:%s/%c",
+				   host,
+				   isEmpty(port) ? "80" : port,
+				   this_type);
+			if (*selector == '/')
+			    ++selector;
+		    } else {
+			valid_chars = acceptable_file;
+			HTSprintf0(&address, "//%s/%c", host, this_type);
+		    }
 
 		    for (r = selector; *r; r++) {	/* Encode selector string */
-			if (acceptable[UCH(*r)]) {
+			if (valid_chars[UCH(*r)]) {
 			    HTSprintf(&address, "%c", *r);
 			} else {
 			    HTSprintf(&address, "%c%c%c",
diff --git a/src/HTFWriter.c b/src/HTFWriter.c
index de4c22eb..0ff5a56c 100644
--- a/src/HTFWriter.c
+++ b/src/HTFWriter.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: HTFWriter.c,v 1.118 2018/12/27 10:33:52 tom Exp $
+ * $LynxId: HTFWriter.c,v 1.119 2019/08/25 22:57:03 tom Exp $
  *
  *		FILE WRITER				HTFWrite.h
  *		===========
@@ -1237,10 +1237,10 @@ HTStream *HTCompressed(HTPresentation *pres,
 	middle = HTML_SUFFIX;
 	middle++;		/* point to 'h' of .htm(l) - kw */
     } else if (!strncasecomp(anchor->content_type, "text/", 5)) {
-	middle = TEXT_SUFFIX + 1;
+	middle = &TEXT_SUFFIX[1];
     } else if (!strncasecomp(anchor->content_type, "application/", 12)) {
 	/* FIXME: why is this BEFORE HTFileSuffix? */
-	middle = BIN_SUFFIX + 1;
+	middle = &BIN_SUFFIX[1];
     } else if ((suffix =
 		HTFileSuffix(HTAtom_for(anchor->content_type), NULL)) &&
 	       *suffix == '.') {
diff --git a/src/LYUtils.c b/src/LYUtils.c
index 0152ec72..d241f905 100644
--- a/src/LYUtils.c
+++ b/src/LYUtils.c
@@ -1,5 +1,5 @@
 /*
- * $LynxId: LYUtils.c,v 1.296 2019/08/22 09:17:59 tom Exp $
+ * $LynxId: LYUtils.c,v 1.297 2019/08/25 22:54:34 tom Exp $
  */
 #include <HTUtils.h>
 #include <HTTCP.h>
@@ -5095,7 +5095,7 @@ static char *CheckDir(char *path)
 	    || !S_ISDIR(stat_info.st_mode))) {
 	path = NULL;
     }
-    CTRACE((tfp, "CheckDir(%s) %s\n", path, path ? "OK" : "ERR"));
+    CTRACE((tfp, "CheckDir(%s) %s\n", NonNull(path), path ? "OK" : "ERR"));
     return path;
 }