aboutsummaryrefslogtreecommitdiff
path: root/RSSDP
diff options
context:
space:
mode:
authorcvium <clausvium@gmail.com>2022-01-07 10:23:22 +0100
committercvium <clausvium@gmail.com>2022-01-07 10:23:22 +0100
commitc658a883a2bc84b46ed73d209d2983e8a324cdce (patch)
treedabdbb5ac224e202d5433e7062e0c1b6872d1af7 /RSSDP
parent2899b77cd58456470b8dd4d01d3a8c525a9b5911 (diff)
parent6b4f5a86631e5bde93dae88553380c7ffd99b8e4 (diff)
Merge branch 'master' into keyframe_extraction_v1
# Conflicts: # Jellyfin.Api/Controllers/DynamicHlsController.cs # MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs # MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs
Diffstat (limited to 'RSSDP')
-rw-r--r--RSSDP/HttpParserBase.cs6
-rw-r--r--RSSDP/HttpRequestParser.cs4
-rw-r--r--RSSDP/HttpResponseParser.cs4
-rw-r--r--RSSDP/SsdpCommunicationsServer.cs2
-rw-r--r--RSSDP/SsdpDeviceLocator.cs2
-rw-r--r--RSSDP/SsdpDevicePublisher.cs15
6 files changed, 14 insertions, 19 deletions
diff --git a/RSSDP/HttpParserBase.cs b/RSSDP/HttpParserBase.cs
index c56249523..6b6c13d99 100644
--- a/RSSDP/HttpParserBase.cs
+++ b/RSSDP/HttpParserBase.cs
@@ -82,7 +82,7 @@ namespace Rssdp.Infrastructure
throw new ArgumentNullException(nameof(versionData));
}
- var versionSeparatorIndex = versionData.IndexOf('/');
+ var versionSeparatorIndex = versionData.IndexOf('/', StringComparison.Ordinal);
if (versionSeparatorIndex <= 0 || versionSeparatorIndex == versionData.Length)
{
throw new ArgumentException("request header line is invalid. Http Version not supplied or incorrect format.", nameof(versionData));
@@ -101,7 +101,7 @@ namespace Rssdp.Infrastructure
{
// Header format is
// name: value
- var headerKeySeparatorIndex = line.IndexOf(":", StringComparison.OrdinalIgnoreCase);
+ var headerKeySeparatorIndex = line.IndexOf(':', StringComparison.Ordinal);
var headerName = line.Substring(0, headerKeySeparatorIndex).Trim();
var headerValue = line.Substring(headerKeySeparatorIndex + 1).Trim();
@@ -172,7 +172,7 @@ namespace Rssdp.Infrastructure
else
{
var segments = headerValue.Split(SeparatorCharacters);
- if (headerValue.Contains('"'))
+ if (headerValue.Contains('"', StringComparison.Ordinal))
{
for (int segmentIndex = 0; segmentIndex < segments.Length; segmentIndex++)
{
diff --git a/RSSDP/HttpRequestParser.cs b/RSSDP/HttpRequestParser.cs
index 4114195a6..a3e100796 100644
--- a/RSSDP/HttpRequestParser.cs
+++ b/RSSDP/HttpRequestParser.cs
@@ -1,6 +1,6 @@
using System;
-using System.Linq;
using System.Net.Http;
+using Jellyfin.Extensions;
namespace Rssdp.Infrastructure
{
@@ -86,7 +86,7 @@ namespace Rssdp.Infrastructure
/// <param name="headerName">A string containing the name of the header to return the type of.</param>
protected override bool IsContentHeader(string headerName)
{
- return ContentHeaderNames.Contains(headerName, StringComparer.OrdinalIgnoreCase);
+ return ContentHeaderNames.Contains(headerName, StringComparison.OrdinalIgnoreCase);
}
}
}
diff --git a/RSSDP/HttpResponseParser.cs b/RSSDP/HttpResponseParser.cs
index 0dd4bb45a..3e361465d 100644
--- a/RSSDP/HttpResponseParser.cs
+++ b/RSSDP/HttpResponseParser.cs
@@ -1,7 +1,7 @@
using System;
-using System.Linq;
using System.Net;
using System.Net.Http;
+using Jellyfin.Extensions;
namespace Rssdp.Infrastructure
{
@@ -49,7 +49,7 @@ namespace Rssdp.Infrastructure
/// <returns>A boolean, true if th specified header relates to HTTP content, otherwise false.</returns>
protected override bool IsContentHeader(string headerName)
{
- return ContentHeaderNames.Contains(headerName, StringComparer.OrdinalIgnoreCase);
+ return ContentHeaderNames.Contains(headerName, StringComparison.OrdinalIgnoreCase);
}
/// <summary>
diff --git a/RSSDP/SsdpCommunicationsServer.cs b/RSSDP/SsdpCommunicationsServer.cs
index e0116c068..58dabc628 100644
--- a/RSSDP/SsdpCommunicationsServer.cs
+++ b/RSSDP/SsdpCommunicationsServer.cs
@@ -395,7 +395,7 @@ namespace Rssdp.Infrastructure
// Strange cannot convert compiler error here if I don't explicitly
// assign or cast to Action first. Assignment is easier to read,
// so went with that.
- ProcessMessage(System.Text.UTF8Encoding.UTF8.GetString(result.Buffer, 0, result.ReceivedBytes), result.RemoteEndPoint, result.LocalIPAddress);
+ ProcessMessage(UTF8Encoding.UTF8.GetString(result.Buffer, 0, result.ReceivedBytes), result.RemoteEndPoint, result.LocalIPAddress);
}
}
catch (ObjectDisposedException)
diff --git a/RSSDP/SsdpDeviceLocator.cs b/RSSDP/SsdpDeviceLocator.cs
index 188e298e2..3a52b2a3e 100644
--- a/RSSDP/SsdpDeviceLocator.cs
+++ b/RSSDP/SsdpDeviceLocator.cs
@@ -513,7 +513,7 @@ namespace Rssdp.Infrastructure
return TimeSpan.Zero;
}
- return (TimeSpan)(headerValue.MaxAge ?? headerValue.SharedMaxAge ?? TimeSpan.Zero);
+ return headerValue.MaxAge ?? headerValue.SharedMaxAge ?? TimeSpan.Zero;
}
private void RemoveExpiredDevicesFromCache()
diff --git a/RSSDP/SsdpDevicePublisher.cs b/RSSDP/SsdpDevicePublisher.cs
index 64d19803d..a7767b3c0 100644
--- a/RSSDP/SsdpDevicePublisher.cs
+++ b/RSSDP/SsdpDevicePublisher.cs
@@ -15,8 +15,6 @@ namespace Rssdp.Infrastructure
/// </summary>
public class SsdpDevicePublisher : DisposableManagedObjectBase, ISsdpDevicePublisher
{
- private readonly INetworkManager _networkManager;
-
private ISsdpCommunicationsServer _CommsServer;
private string _OSName;
private string _OSVersion;
@@ -38,19 +36,17 @@ namespace Rssdp.Infrastructure
/// <summary>
/// Default constructor.
/// </summary>
- public SsdpDevicePublisher(ISsdpCommunicationsServer communicationsServer, INetworkManager networkManager,
- string osName, string osVersion, bool sendOnlyMatchedHost)
+ public SsdpDevicePublisher(
+ ISsdpCommunicationsServer communicationsServer,
+ string osName,
+ string osVersion,
+ bool sendOnlyMatchedHost)
{
if (communicationsServer == null)
{
throw new ArgumentNullException(nameof(communicationsServer));
}
- if (networkManager == null)
- {
- throw new ArgumentNullException(nameof(networkManager));
- }
-
if (osName == null)
{
throw new ArgumentNullException(nameof(osName));
@@ -77,7 +73,6 @@ namespace Rssdp.Infrastructure
_RecentSearchRequests = new Dictionary<string, SearchRequest>(StringComparer.OrdinalIgnoreCase);
_Random = new Random();
- _networkManager = networkManager;
_CommsServer = communicationsServer;
_CommsServer.RequestReceived += CommsServer_RequestReceived;
_OSName = osName;