Commit 5a4f1af9 authored by Honfika's avatar Honfika

WebSocket fix

parent fa449db1
...@@ -430,4 +430,3 @@ namespace Titanium.Web.Proxy.Examples.Basic ...@@ -430,4 +430,3 @@ namespace Titanium.Web.Proxy.Examples.Basic
//} //}
} }
} }
...@@ -25,7 +25,9 @@ namespace Titanium.Web.Proxy.EventArguments ...@@ -25,7 +25,9 @@ namespace Titanium.Web.Proxy.EventArguments
/// </summary> /// </summary>
private bool reRequest; private bool reRequest;
private WebSocketDecoder? webSocketDecoder; private WebSocketDecoder? webSocketDecoderSend;
private WebSocketDecoder? webSocketDecoderReceive;
/// <summary> /// <summary>
/// Is this session a HTTP/2 promise? /// Is this session a HTTP/2 promise?
...@@ -59,7 +61,12 @@ namespace Titanium.Web.Proxy.EventArguments ...@@ -59,7 +61,12 @@ namespace Titanium.Web.Proxy.EventArguments
} }
} }
public WebSocketDecoder WebSocketDecoder => webSocketDecoder ??= new WebSocketDecoder(BufferPool); [Obsolete("Use [WebSocketDecoderReceive] instead")]
public WebSocketDecoder WebSocketDecoder => WebSocketDecoderReceive;
public WebSocketDecoder WebSocketDecoderSend => webSocketDecoderSend ??= new WebSocketDecoder(BufferPool);
public WebSocketDecoder WebSocketDecoderReceive => webSocketDecoderReceive ??= new WebSocketDecoder(BufferPool);
/// <summary> /// <summary>
/// Occurs when multipart request part sent. /// Occurs when multipart request part sent.
......
...@@ -100,7 +100,6 @@ namespace Titanium.Web.Proxy ...@@ -100,7 +100,6 @@ namespace Titanium.Web.Proxy
{ {
data1[pos + 2] ^= (byte)(mask >> 16); data1[pos + 2] ^= (byte)(mask >> 16);
} }
;
} }
} }
...@@ -115,6 +114,19 @@ namespace Titanium.Web.Proxy ...@@ -115,6 +114,19 @@ namespace Titanium.Web.Proxy
{ {
copyToBuffer(buffer); copyToBuffer(buffer);
} }
if (copied)
{
if (buffer.Length == 0)
{
bufferLength = 0;
}
else
{
buffer.CopyTo(this.buffer);
bufferLength = buffer.Length;
}
}
} }
private Memory<byte> copyToBuffer(ReadOnlyMemory<byte> data) private Memory<byte> copyToBuffer(ReadOnlyMemory<byte> 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