gopher: Handle errors from Gophernicus

It sends them as plain text instead of gopher directory
when it doesn't find something...
This commit is contained in:
François Revol
2014-07-28 20:26:47 +02:00
parent e243a03476
commit b8be186720
@@ -316,6 +316,16 @@ BGopherRequest::_ProtocolLoop()
// continue parsing the error text anyway
}
}
// special case for buggy(?) Gophernicus/1.5
static const char *buggy = "Error: File or directory not found!";
if (fInputBuffer.Size() > strlen(buggy)
&& !memcmp(fInputBuffer.Data(), buggy, strlen(buggy))) {
fItemType = GOPHER_TYPE_DIRECTORY;
readError = B_RESOURCE_NOT_FOUND;
// continue parsing the error text anyway
// but it won't look good
}
// now we probably have correct data
dataValidated = true;