Added nullguard when req.socket.remoteAddress
is null inside handleRequest()
This commit is contained in:
parent
ad54e7ae98
commit
10b1b2b3aa
@ -79,17 +79,20 @@ export class HttpServer
|
|||||||
if (this.httpConfig.logRequests)
|
if (this.httpConfig.logRequests)
|
||||||
{
|
{
|
||||||
// TODO: Extend to include 192.168 / 10.10 ranges or check subnet
|
// TODO: Extend to include 192.168 / 10.10 ranges or check subnet
|
||||||
const isLocalRequest = req.socket.remoteAddress.startsWith("127.0.0");
|
const isLocalRequest = req.socket.remoteAddress?.startsWith("127.0.0");
|
||||||
if (isLocalRequest)
|
if (typeof isLocalRequest !== "undefined")
|
||||||
{
|
{
|
||||||
this.logger.info(this.localisationService.getText("client_request", req.url));
|
if (isLocalRequest)
|
||||||
}
|
{
|
||||||
else
|
this.logger.info(this.localisationService.getText("client_request", req.url));
|
||||||
{
|
}
|
||||||
this.logger.info(this.localisationService.getText("client_request_ip", {
|
else
|
||||||
ip: req.socket.remoteAddress,
|
{
|
||||||
url: req.url.replaceAll("/", "\\"), // Localisation service escapes `/` into hex code `/`
|
this.logger.info(this.localisationService.getText("client_request_ip", {
|
||||||
}));
|
ip: req.socket.remoteAddress,
|
||||||
|
url: req.url.replaceAll("/", "\\"), // Localisation service escapes `/` into hex code `/`
|
||||||
|
}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user