Unverified Commit 34e533c1 authored by Jehonathan Thomas's avatar Jehonathan Thomas Committed by GitHub

Merge pull request #582 from honfika/master

prepare for basic http/2 support and another small fixes (typo, version numbers)
parents 578fd98c b3a486fb
......@@ -103,7 +103,7 @@ namespace Titanium.Web.Proxy
if (await checkAuthorization(connectArgs) == false)
{
await endPoint.InvokeBeforeTunnectConnectResponse(this, connectArgs, ExceptionFunc);
await endPoint.InvokeBeforeTunnelConnectResponse(this, connectArgs, ExceptionFunc);
// send the response
await clientStreamWriter.WriteResponseAsync(connectArgs.HttpClient.Response,
......@@ -129,7 +129,7 @@ namespace Titanium.Web.Proxy
connectRequest.ClientHelloInfo = clientHelloInfo;
}
await endPoint.InvokeBeforeTunnectConnectResponse(this, connectArgs, ExceptionFunc, isClientHello);
await endPoint.InvokeBeforeTunnelConnectResponse(this, connectArgs, ExceptionFunc, isClientHello);
if (decryptSsl && isClientHello)
{
......@@ -183,7 +183,7 @@ namespace Titanium.Web.Proxy
// Successfully managed to authenticate the client using the fake certificate
var options = new SslServerAuthenticationOptions();
if (http2Supported)
if (EnableHttp2 && http2Supported)
{
options.ApplicationProtocols = clientHelloInfo.GetAlpn();
if (options.ApplicationProtocols == null || options.ApplicationProtocols.Count == 0)
......
......@@ -63,6 +63,7 @@ namespace Titanium.Web.Proxy.Http2
while (true)
{
int read = await ForceRead(input, headerBuffer, 0, 9, cancellationToken);
onCopy(headerBuffer, 0, read);
if (read != 9)
{
return;
......@@ -75,6 +76,7 @@ namespace Titanium.Web.Proxy.Http2
headerBuffer[8];
read = await ForceRead(input, buffer, 0, length, cancellationToken);
onCopy(buffer, 0, read);
if (read != length)
{
return;
......@@ -138,7 +140,7 @@ namespace Titanium.Web.Proxy.Http2
while (bytesToRead > 0)
{
int read = await input.ReadAsync(buffer, offset, bytesToRead, cancellationToken);
if (read == -1)
if (read == 0)
{
break;
}
......
......@@ -50,7 +50,7 @@ namespace Titanium.Web.Proxy.Models
}
}
internal async Task InvokeBeforeTunnectConnectResponse(ProxyServer proxyServer,
internal async Task InvokeBeforeTunnelConnectResponse(ProxyServer proxyServer,
TunnelConnectSessionEventArgs connectArgs, ExceptionHandler exceptionFunc, bool isClientHello = false)
{
if (BeforeTunnelConnectResponse != null)
......
......@@ -145,6 +145,12 @@ namespace Titanium.Web.Proxy
/// </summary>
public bool EnableWinAuth { get; set; }
/// <summary>
/// Enable disable HTTP/2 support. This setting is internal,
/// because the implementation is not finished
/// </summary>
internal bool EnableHttp2 { get; set; } = false;
/// <summary>
/// Should we check for certificate revocation during SSL authentication to servers
/// Note: If enabled can reduce performance. Defaults to false.
......
......@@ -12,9 +12,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BrotliSharpLib" Version="0.3.1" />
<PackageReference Include="Portable.BouncyCastle" Version="1.8.3" />
<PackageReference Include="StreamExtended" Version="1.0.188-beta" />
<PackageReference Include="BrotliSharpLib" Version="0.3.3" />
<PackageReference Include="Portable.BouncyCastle" Version="1.8.5" />
<PackageReference Include="StreamExtended" Version="1.0.209-beta" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net45;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net45;netstandard2.0;netcoreapp2.1</TargetFrameworks>
<RootNamespace>Titanium.Web.Proxy</RootNamespace>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<SignAssembly>True</SignAssembly>
......
......@@ -26,6 +26,13 @@
<dependency id="Microsoft.Win32.Registry" version="4.4.0" />
<dependency id="System.Security.Principal.Windows" version="4.4.1" />
</group>
<group targetFramework="netcoreapp2.1">
<dependency id="StreamExtended" version="1.0.209-beta" />
<dependency id="Portable.BouncyCastle" version="1.8.5" />
<dependency id="BrotliSharpLib" version="0.3.3" />
<dependency id="Microsoft.Win32.Registry" version="4.4.0" />
<dependency id="System.Security.Principal.Windows" version="4.4.1" />
</group>
</dependencies>
</metadata>
<files>
......
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