Skip to content
This repository was archived by the owner on Jul 9, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Titanium.Web.Proxy/ExplicitClientHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ await clientStreamWriter.WriteResponseAsync(connectArgs.HttpClient.Response,

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,
Expand All @@ -129,7 +129,7 @@ await clientStreamWriter.WriteResponseAsync(connectArgs.HttpClient.Response,
connectRequest.ClientHelloInfo = clientHelloInfo;
}

await endPoint.InvokeBeforeTunnectConnectResponse(this, connectArgs, ExceptionFunc, isClientHello);
await endPoint.InvokeBeforeTunnelConnectResponse(this, connectArgs, ExceptionFunc, isClientHello);

if (decryptSsl && isClientHello)
{
Expand Down Expand Up @@ -183,7 +183,7 @@ await clientStreamWriter.WriteResponseAsync(connectArgs.HttpClient.Response,

// 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)
Expand Down
4 changes: 3 additions & 1 deletion src/Titanium.Web.Proxy/Http2/Http2Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ private static async Task CopyHttp2FrameAsync(Stream input, Stream output, Actio
while (true)
{
int read = await ForceRead(input, headerBuffer, 0, 9, cancellationToken);
onCopy(headerBuffer, 0, read);
if (read != 9)
{
return;
Expand All @@ -75,6 +76,7 @@ private static async Task CopyHttp2FrameAsync(Stream input, Stream output, Actio
headerBuffer[8];

read = await ForceRead(input, buffer, 0, length, cancellationToken);
onCopy(buffer, 0, read);
if (read != length)
{
return;
Expand Down Expand Up @@ -138,7 +140,7 @@ private static async Task<int> ForceRead(Stream input, byte[] buffer, int offset
while (bytesToRead > 0)
{
int read = await input.ReadAsync(buffer, offset, bytesToRead, cancellationToken);
if (read == -1)
if (read == 0)
{
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Titanium.Web.Proxy/Models/ExplicitProxyEndPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ internal async Task InvokeBeforeTunnelConnectRequest(ProxyServer proxyServer,
}
}

internal async Task InvokeBeforeTunnectConnectResponse(ProxyServer proxyServer,
internal async Task InvokeBeforeTunnelConnectResponse(ProxyServer proxyServer,
TunnelConnectSessionEventArgs connectArgs, ExceptionHandler exceptionFunc, bool isClientHello = false)
{
if (BeforeTunnelConnectResponse != null)
Expand Down
6 changes: 6 additions & 0 deletions src/Titanium.Web.Proxy/ProxyServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ public ProxyServer(string rootCertificateName, string rootCertificateIssuerName,
/// Defaults to false.
/// </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
Expand Down
6 changes: 3 additions & 3 deletions src/Titanium.Web.Proxy/Titanium.Web.Proxy.NetCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -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'">
Expand Down
2 changes: 1 addition & 1 deletion src/Titanium.Web.Proxy/Titanium.Web.Proxy.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<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>
Expand Down
7 changes: 7 additions & 0 deletions src/Titanium.Web.Proxy/Titanium.Web.Proxy.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down