quick fix errorwhen parsing invalid http header

This commit is contained in:
Lucca Faria Ferri 2023-01-30 07:03:36 -08:00
parent 69a11814ac
commit 568b0a48fe

View File

@ -5,6 +5,7 @@ using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using DiIiS_NA.Core.Logging;
namespace DiIiS_NA.REST.Http namespace DiIiS_NA.REST.Http
{ {
@ -86,6 +87,8 @@ namespace DiIiS_NA.REST.Http
headerValues.Add("type", info[2]); headerValues.Add("type", info[2]);
while (!sr.EndOfStream) while (!sr.EndOfStream)
{
try
{ {
info = sr.ReadLine().Split(new string[] { ": " }, StringSplitOptions.RemoveEmptyEntries); info = sr.ReadLine().Split(new string[] { ": " }, StringSplitOptions.RemoveEmptyEntries);
@ -110,6 +113,11 @@ namespace DiIiS_NA.REST.Http
break; break;
} }
} }
catch (Exception ex)
{
return null;
}
}
} }
var httpFields = typeof(HttpHeader).GetTypeInfo().GetProperties(); var httpFields = typeof(HttpHeader).GetTypeInfo().GetProperties();