Don't throw error if ping fails
This commit is contained in:
1 parent
612563f171
commit
07a5c96e2a
1 file changed
+5
-1
+5
-1
@@ -593,7 +593,11 @@ export function listener(request, response): void {
|
|||||||
const host = querystring.unescape(PING_REGEX.exec(urlParts.pathname)[1]);
|
const host = querystring.unescape(PING_REGEX.exec(urlParts.pathname)[1]);
|
||||||
ping(host, (err, res, stdout) => {
|
ping(host, (err, res, stdout) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
if (!res) throwError(err, response);
|
if (!res) {
|
||||||
|
response.writeHead(500, { Connection: "close" });
|
||||||
|
response.end(`${err.name}: ${err.message}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
response.writeHead(404, { "Cache-Control": "no-cache" });
|
response.writeHead(404, { "Cache-Control": "no-cache" });
|
||||||
response.end(`${err.name}: ${err.message}`);
|
response.end(`${err.name}: ${err.message}`);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in new issue
Block a user