mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
update rssdp
This commit is contained in:
parent
58a7829ecd
commit
808f2f3095
@ -64,7 +64,7 @@ namespace Rssdp.Infrastructure
|
|||||||
if (message == null) throw new ArgumentNullException("message");
|
if (message == null) throw new ArgumentNullException("message");
|
||||||
|
|
||||||
var parts = data.Split(' ');
|
var parts = data.Split(' ');
|
||||||
if (parts.Length < 3) throw new ArgumentException("Status line is invalid. Insufficient status parts.", "data");
|
if (parts.Length < 2) throw new ArgumentException("Status line is invalid. Insufficient status parts.", "data");
|
||||||
|
|
||||||
message.Method = new HttpMethod(parts[0].Trim());
|
message.Method = new HttpMethod(parts[0].Trim());
|
||||||
Uri requestUri;
|
Uri requestUri;
|
||||||
@ -73,7 +73,10 @@ namespace Rssdp.Infrastructure
|
|||||||
else
|
else
|
||||||
System.Diagnostics.Debug.WriteLine(parts[1]);
|
System.Diagnostics.Debug.WriteLine(parts[1]);
|
||||||
|
|
||||||
|
if (parts.Length >= 3)
|
||||||
|
{
|
||||||
message.Version = ParseHttpVersion(parts[2].Trim());
|
message.Version = ParseHttpVersion(parts[2].Trim());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -75,7 +75,7 @@ namespace Rssdp.Infrastructure
|
|||||||
if (message == null) throw new ArgumentNullException("message");
|
if (message == null) throw new ArgumentNullException("message");
|
||||||
|
|
||||||
var parts = data.Split(' ');
|
var parts = data.Split(' ');
|
||||||
if (parts.Length < 3) throw new ArgumentException("data status line is invalid. Insufficient status parts.", "data");
|
if (parts.Length < 2) throw new ArgumentException("data status line is invalid. Insufficient status parts.", "data");
|
||||||
|
|
||||||
message.Version = ParseHttpVersion(parts[0].Trim());
|
message.Version = ParseHttpVersion(parts[0].Trim());
|
||||||
|
|
||||||
@ -84,7 +84,11 @@ namespace Rssdp.Infrastructure
|
|||||||
throw new ArgumentException("data status line is invalid. Status code is not a valid integer.", "data");
|
throw new ArgumentException("data status line is invalid. Status code is not a valid integer.", "data");
|
||||||
|
|
||||||
message.StatusCode = (HttpStatusCode)statusCode;
|
message.StatusCode = (HttpStatusCode)statusCode;
|
||||||
|
|
||||||
|
if (parts.Length >= 3)
|
||||||
|
{
|
||||||
message.ReasonPhrase = parts[2].Trim();
|
message.ReasonPhrase = parts[2].Trim();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -743,6 +743,14 @@ namespace Rssdp
|
|||||||
|
|
||||||
private static void AddCustomProperty(XmlReader reader, SsdpDevice device)
|
private static void AddCustomProperty(XmlReader reader, SsdpDevice device)
|
||||||
{
|
{
|
||||||
|
// If the property is an empty element, there is no value to read
|
||||||
|
// Advance the reader and return
|
||||||
|
if (reader.IsEmptyElement)
|
||||||
|
{
|
||||||
|
reader.Read();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var newProp = new SsdpDeviceProperty() { Namespace = reader.Prefix, Name = reader.LocalName };
|
var newProp = new SsdpDeviceProperty() { Namespace = reader.Prefix, Name = reader.LocalName };
|
||||||
int depth = reader.Depth;
|
int depth = reader.Depth;
|
||||||
reader.Read();
|
reader.Read();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user