Commit 59c38199 authored by Honfika's avatar Honfika

Throw better exception when chunk length is invalid.

parent 60feeb00
......@@ -4,6 +4,7 @@ using System.IO;
using System.Threading.Tasks;
using StreamExtended;
using StreamExtended.Network;
using Titanium.Web.Proxy.Exceptions;
namespace Titanium.Web.Proxy.EventArguments
{
......@@ -60,7 +61,11 @@ namespace Titanium.Web.Proxy.EventArguments
chunkHead = chunkHead.Substring(0, idx);
}
int chunkSize = int.Parse(chunkHead, NumberStyles.HexNumber);
if (!int.TryParse(chunkHead, NumberStyles.HexNumber, null, out int chunkSize))
{
throw new ProxyHttpException($"Invalid chunk length: '{chunkSize}'", null, null);
}
bytesRemaining = chunkSize;
if (chunkSize == 0)
......
......@@ -41,7 +41,7 @@ namespace Titanium.Web.Proxy.Http2
{
var clientSettings = new Http2Settings();
var serverSettings = new Http2Settings();
;
var sessions = new ConcurrentDictionary<int, SessionEventArgs>();
// Now async relay all server=>client & client=>server data
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment