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