Improve support for bad servers and hand-written/broken Gopher menus
This commit is contained in:
parent
d5262b612a
commit
b02b629fe9
|
@ -197,8 +197,12 @@ func (i *Item) parse(line []byte) error {
|
||||||
|
|
||||||
port, err := strconv.Atoi(string(parts[3]))
|
port, err := strconv.Atoi(string(parts[3]))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
// Ignore parsing errors for bad servers for INFO types
|
||||||
|
if i.Type != INFO {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
port = 0
|
||||||
|
}
|
||||||
i.Port = port
|
i.Port = port
|
||||||
|
|
||||||
if len(parts) >= 4 {
|
if len(parts) >= 4 {
|
||||||
|
@ -379,7 +383,8 @@ func (i *Item) FetchDirectory() (Directory, error) {
|
||||||
var i Item
|
var i Item
|
||||||
err := i.parse(line)
|
err := i.parse(line)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return d, err
|
log.Printf("Error parsing %q: %q", line, err)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
d = append(d, i)
|
d = append(d, i)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue