diff --git a/Libraries/SPTarkov.Server.Core/Servers/HttpServer.cs b/Libraries/SPTarkov.Server.Core/Servers/HttpServer.cs
index c15004f8..b8ac4823 100644
--- a/Libraries/SPTarkov.Server.Core/Servers/HttpServer.cs
+++ b/Libraries/SPTarkov.Server.Core/Servers/HttpServer.cs
@@ -99,29 +99,9 @@ public class HttpServer(
if (_httpConfig.LogRequests)
{
- var isLocalRequest = IsLocalRequest(clientIp);
- if (isLocalRequest.HasValue)
- {
- if (isLocalRequest.Value)
- {
- _logger.Info(_localisationService.GetText("client_request", context.Request.Path.Value));
- }
- else
- {
- _logger.Info(
- _localisationService.GetText(
- "client_request_ip", new
- {
- ip = clientIp,
- url = context.Request.Path.Value
- }
- )
- );
- }
- }
+ LogRequest(context, clientIp, IsLocalRequest(clientIp));
}
-
try
{
_httpListeners.SingleOrDefault(l => l.CanHandle(sessionId, context.Request))?.Handle(sessionId, context.Request, context.Response);
@@ -135,7 +115,33 @@ public class HttpServer(
// This http request would be passed through the SPT Router and handled by an ICallback
}
- protected static string? GetClientIp(HttpContext context, StringValues? realIp)
+ ///
+ /// Log request - handle differently if request is local
+ ///
+ /// HttpContext of request
+ /// Ip of requester
+ /// Is this local request
+ protected void LogRequest(HttpContext context, string clientIp, bool isLocalRequest)
+ {
+ if (isLocalRequest)
+ {
+ _logger.Info(_localisationService.GetText("client_request", context.Request.Path.Value));
+ }
+ else
+ {
+ _logger.Info(
+ _localisationService.GetText(
+ "client_request_ip", new
+ {
+ ip = clientIp,
+ url = context.Request.Path.Value
+ }
+ )
+ );
+ }
+ }
+
+ protected static string GetClientIp(HttpContext context, StringValues? realIp)
{
if (realIp.HasValue)
{
@@ -153,11 +159,11 @@ public class HttpServer(
///
/// Address to check
/// True if its local
- protected bool? IsLocalRequest(string? remoteAddress)
+ protected bool IsLocalRequest(string? remoteAddress)
{
if (remoteAddress == null)
{
- return null;
+ return false;
}
return remoteAddress.StartsWith("127.0.0") ||