about summary refs log tree commit diff stats
path: root/WWW/Library/Implementation/HTGopher.c
diff options
context:
space:
mode:
Diffstat (limited to 'WWW/Library/Implementation/HTGopher.c')
-rw-r--r--WWW/Library/Implementation/HTGopher.c37
1 files changed, 29 insertions, 8 deletions
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",
febdb'>33352536 ^
13ef4258 ^
71eb22a5 ^
33352536 ^
71eb22a5 ^
33352536 ^

71eb22a5 ^
33352536 ^

ee9a9237 ^
7dac9ade ^
33352536 ^

6070c23e ^
cf02c20b ^
ee9a9237 ^
33352536 ^



7a583220 ^
33352536 ^

6030d7e2 ^
4224ec81 ^
e59a74ab ^

13ef4258 ^
33352536 ^
7dac9ade ^
e59a74ab ^

ee9a9237 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53