diff options
| author | Mark Monteiro <marknr.monteiro@protonmail.com> | 2020-05-14 11:08:08 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-14 11:08:08 -0400 |
| commit | 2e09311a93cbf7b4d0629e058974a84e70c4b800 (patch) | |
| tree | 9217bb9d15df7f1a516afcbc2f531bbc35161a53 /Emby.Server.Implementations/SocketSharp | |
| parent | 3623aafcb60dec4f4f5055046717d895b7597b60 (diff) | |
| parent | 11dd96f6c715b0f701903e636f08ee910c9a08eb (diff) | |
Merge branch 'master' into websocket
Diffstat (limited to 'Emby.Server.Implementations/SocketSharp')
| -rw-r--r-- | Emby.Server.Implementations/SocketSharp/WebSocketSharpRequest.cs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Emby.Server.Implementations/SocketSharp/WebSocketSharpRequest.cs b/Emby.Server.Implementations/SocketSharp/WebSocketSharpRequest.cs index 9c638f439..ee5131c1f 100644 --- a/Emby.Server.Implementations/SocketSharp/WebSocketSharpRequest.cs +++ b/Emby.Server.Implementations/SocketSharp/WebSocketSharpRequest.cs @@ -63,6 +63,9 @@ namespace Emby.Server.Implementations.SocketSharp if (!IPAddress.TryParse(GetHeader(CustomHeaderNames.XRealIP), out ip)) { ip = Request.HttpContext.Connection.RemoteIpAddress; + + // Default to the loopback address if no RemoteIpAddress is specified (i.e. during integration tests) + ip ??= IPAddress.Loopback; } } @@ -90,7 +93,10 @@ namespace Emby.Server.Implementations.SocketSharp public IQueryCollection QueryString => Request.Query; - public bool IsLocal => Request.HttpContext.Connection.LocalIpAddress.Equals(Request.HttpContext.Connection.RemoteIpAddress); + public bool IsLocal => + (Request.HttpContext.Connection.LocalIpAddress == null + && Request.HttpContext.Connection.RemoteIpAddress == null) + || Request.HttpContext.Connection.LocalIpAddress.Equals(Request.HttpContext.Connection.RemoteIpAddress); public string HttpMethod => Request.Method; |
