From 46897aab4f85bd2ea50e0ff1ef57c0cfa8f48c67 Mon Sep 17 00:00:00 2001 From: Bond-009 Date: Wed, 13 Feb 2019 17:28:04 +0100 Subject: [PATCH] More warnings --- Jellyfin.Server/SocketSharp/RequestMono.cs | 9 ++------- Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs | 7 +++++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Jellyfin.Server/SocketSharp/RequestMono.cs b/Jellyfin.Server/SocketSharp/RequestMono.cs index 584d38bcbc..9a06017501 100644 --- a/Jellyfin.Server/SocketSharp/RequestMono.cs +++ b/Jellyfin.Server/SocketSharp/RequestMono.cs @@ -431,13 +431,13 @@ namespace Jellyfin.Server.SocketSharp real = position + d; break; default: - throw new ArgumentException(nameof(origin)); + throw new ArgumentException("Unknown SeekOrigin value", nameof(origin)); } long virt = real - offset; if (virt < 0 || virt > Length) { - throw new ArgumentException(); + throw new ArgumentException("Invalid position", nameof(origin)); } position = s.Seek(real, SeekOrigin.Begin); @@ -572,11 +572,6 @@ namespace Jellyfin.Server.SocketSharp public HttpMultipart(Stream data, string b, Encoding encoding) { this.data = data; - // DB: 30/01/11: cannot set or read the Position in HttpListener in Win.NET - // var ms = new MemoryStream(32 * 1024); - // data.CopyTo(ms); - // this.data = ms; - boundary = b; boundary_bytes = encoding.GetBytes(b); buffer = new byte[boundary_bytes.Length + 2]; // CRLF or '--' diff --git a/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs b/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs index c5fdf6a3b0..a19ea6bf7a 100644 --- a/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs +++ b/Jellyfin.Server/SocketSharp/WebSocketSharpRequest.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.IO; using System.Text; using Emby.Server.Implementations.HttpServer; @@ -69,9 +70,11 @@ namespace Jellyfin.Server.SocketSharp public string UserHostAddress => request.UserHostAddress; - public string XForwardedFor => string.IsNullOrEmpty(request.Headers["X-Forwarded-For"]) ? null : request.Headers["X-Forwarded-For"]; + public string XForwardedFor + => string.IsNullOrEmpty(request.Headers["X-Forwarded-For"]) ? null : request.Headers["X-Forwarded-For"]; - public int? XForwardedPort => string.IsNullOrEmpty(request.Headers["X-Forwarded-Port"]) ? (int?)null : int.Parse(request.Headers["X-Forwarded-Port"]); + public int? XForwardedPort + => string.IsNullOrEmpty(request.Headers["X-Forwarded-Port"]) ? (int?)null : int.Parse(request.Headers["X-Forwarded-Port"], CultureInfo.InvariantCulture); public string XForwardedProtocol => string.IsNullOrEmpty(request.Headers["X-Forwarded-Proto"]) ? null : request.Headers["X-Forwarded-Proto"];