mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-20 05:04:18 +01:00
Standardize use of IsLocal and RemoteIp
This commit is contained in:
@@ -32,13 +32,13 @@ namespace Jellyfin.Server.Middleware
|
||||
/// <returns>The async task.</returns>
|
||||
public async Task Invoke(HttpContext httpContext, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager)
|
||||
{
|
||||
if (httpContext.Request.IsLocal())
|
||||
if (httpContext.IsLocal())
|
||||
{
|
||||
await _next(httpContext).ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
|
||||
var remoteIp = httpContext.Request.RemoteIp();
|
||||
var remoteIp = httpContext.GetNormalizedRemoteIp();
|
||||
|
||||
if (serverConfigurationManager.Configuration.EnableRemoteAccess)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.Extensions;
|
||||
@@ -69,7 +70,7 @@ namespace Jellyfin.Server.Middleware
|
||||
_logger.LogWarning(
|
||||
"Slow HTTP Response from {url} to {remoteIp} in {elapsed:g} with Status Code {statusCode}",
|
||||
context.Request.GetDisplayUrl(),
|
||||
context.Connection.RemoteIpAddress,
|
||||
context.GetNormalizedRemoteIp(),
|
||||
watch.Elapsed,
|
||||
context.Response.StatusCode);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user