diff options
| author | Bond-009 <bond.009@outlook.com> | 2020-05-04 19:01:02 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-04 19:01:02 +0200 |
| commit | ca2f9c73413a5c2daf2451ab0b4d575901d0b386 (patch) | |
| tree | 457f69f15fc7f8ee89c58036002b2b169781dfbf /Emby.Server.Implementations/SocketSharp/WebSocketSharpRequest.cs | |
| parent | 64ab8f8e7adfb4e7511011eca55159235c0ffb31 (diff) | |
| parent | 8322d412f07d495fcfc030fcfa88624f226f4b36 (diff) | |
Merge pull request #2945 from mark-monteiro/integration-tests
Add Integration Tests For BrandingService
Diffstat (limited to 'Emby.Server.Implementations/SocketSharp/WebSocketSharpRequest.cs')
| -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; |
