From 808f2f3095c18c18be7a6fd957ddeda2c4c97693 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 27 Nov 2017 14:08:55 -0500 Subject: update rssdp --- RSSDP/HttpResponseParser.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'RSSDP/HttpResponseParser.cs') diff --git a/RSSDP/HttpResponseParser.cs b/RSSDP/HttpResponseParser.cs index ba85a1657..5f297ca9a 100644 --- a/RSSDP/HttpResponseParser.cs +++ b/RSSDP/HttpResponseParser.cs @@ -75,7 +75,7 @@ namespace Rssdp.Infrastructure if (message == null) throw new ArgumentNullException("message"); 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()); @@ -84,8 +84,12 @@ namespace Rssdp.Infrastructure throw new ArgumentException("data status line is invalid. Status code is not a valid integer.", "data"); message.StatusCode = (HttpStatusCode)statusCode; - message.ReasonPhrase = parts[2].Trim(); - } + + if (parts.Length >= 3) + { + message.ReasonPhrase = parts[2].Trim(); + } + } #endregion -- cgit v1.2.3