Skip to content
This repository was archived by the owner on Jul 9, 2023. It is now read-only.

Commit b69506e

Browse files
authored
Merge pull request #416 from justcoding121/develop
merge to beta
2 parents d3829ea + 498e964 commit b69506e

File tree

111 files changed

+3772
-3074
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+3772
-3074
lines changed
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
<?xml version="1.0" encoding="utf-8" ?>
1+
<?xml version="1.0" encoding="utf-8"?>
2+
23
<configuration>
3-
<startup>
4-
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
5-
</startup>
6-
</configuration>
4+
<startup>
5+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
6+
</startup>
7+
</configuration>

Examples/Titanium.Web.Proxy.Examples.Basic/Helpers/ConsoleHelper.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@
44
namespace Titanium.Web.Proxy.Examples.Basic.Helpers
55
{
66
/// <summary>
7-
/// Adapated from
8-
/// http://stackoverflow.com/questions/13656846/how-to-programmatic-disable-c-sharp-console-applications-quick-edit-mode
7+
/// Adapated from
8+
/// http://stackoverflow.com/questions/13656846/how-to-programmatic-disable-c-sharp-console-applications-quick-edit-mode
99
/// </summary>
1010
internal static class ConsoleHelper
1111
{
12-
const uint ENABLE_QUICK_EDIT = 0x0040;
12+
private const uint ENABLE_QUICK_EDIT = 0x0040;
1313

1414
// STD_INPUT_HANDLE (DWORD): -10 is the standard input device.
15-
const int STD_INPUT_HANDLE = -10;
15+
private const int STD_INPUT_HANDLE = -10;
1616

1717
[DllImport("kernel32.dll", SetLastError = true)]
18-
static extern IntPtr GetStdHandle(int nStdHandle);
18+
private static extern IntPtr GetStdHandle(int nStdHandle);
1919

2020
[DllImport("kernel32.dll")]
21-
static extern bool GetConsoleMode(IntPtr hConsoleHandle, out uint lpMode);
21+
private static extern bool GetConsoleMode(IntPtr hConsoleHandle, out uint lpMode);
2222

2323
[DllImport("kernel32.dll")]
24-
static extern bool SetConsoleMode(IntPtr hConsoleHandle, uint dwMode);
24+
private static extern bool SetConsoleMode(IntPtr hConsoleHandle, uint dwMode);
2525

2626
internal static bool DisableQuickEditMode()
2727
{

Examples/Titanium.Web.Proxy.Examples.Basic/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Reflection;
2-
using System.Runtime.CompilerServices;
32
using System.Runtime.InteropServices;
43

54
// General Information about an assembly is controlled through the following

Examples/Titanium.Web.Proxy.Examples.Basic/ProxyTestController.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,16 @@ public class ProxyTestController
1717
private readonly object lockObj = new object();
1818

1919
private readonly ProxyServer proxyServer;
20-
private ExplicitProxyEndPoint explicitEndPoint;
2120

2221
//keep track of request headers
23-
private readonly IDictionary<Guid, HeaderCollection> requestHeaderHistory = new ConcurrentDictionary<Guid, HeaderCollection>();
22+
private readonly IDictionary<Guid, HeaderCollection> requestHeaderHistory =
23+
new ConcurrentDictionary<Guid, HeaderCollection>();
2424

2525
//keep track of response headers
26-
private readonly IDictionary<Guid, HeaderCollection> responseHeaderHistory = new ConcurrentDictionary<Guid, HeaderCollection>();
26+
private readonly IDictionary<Guid, HeaderCollection> responseHeaderHistory =
27+
new ConcurrentDictionary<Guid, HeaderCollection>();
28+
29+
private ExplicitProxyEndPoint explicitEndPoint;
2730

2831
//share requestBody outside handlers
2932
//Using a dictionary is not a good idea since it can cause memory overflow
@@ -78,13 +81,7 @@ public void StartProxy()
7881

7982
//proxyServer.EnableWinAuth = true;
8083

81-
explicitEndPoint = new ExplicitProxyEndPoint(IPAddress.Any, 8000)
82-
{
83-
//Use self-issued generic certificate on all https requests
84-
//Optimizes performance by not creating a certificate for each https-enabled domain
85-
//Useful when certificate trust is not required by proxy clients
86-
//GenericCertificate = new X509Certificate2(Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "genericcert.pfx"), "password")
87-
};
84+
explicitEndPoint = new ExplicitProxyEndPoint(IPAddress.Any, 8000);
8885

8986
//Fired when a CONNECT request is received
9087
explicitEndPoint.BeforeTunnelConnectRequest += OnBeforeTunnelConnectRequest;
@@ -111,7 +108,10 @@ public void StartProxy()
111108
//proxyServer.UpStreamHttpsProxy = new ExternalProxy() { HostName = "localhost", Port = 8888 };
112109

113110
foreach (var endPoint in proxyServer.ProxyEndPoints)
114-
Console.WriteLine("Listening on '{0}' endpoint at Ip {1} and port: {2} ", endPoint.GetType().Name, endPoint.IpAddress, endPoint.Port);
111+
{
112+
Console.WriteLine("Listening on '{0}' endpoint at Ip {1} and port: {2} ", endPoint.GetType().Name,
113+
endPoint.IpAddress, endPoint.Port);
114+
}
115115

116116
#if NETSTANDARD2_0
117117
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
@@ -251,7 +251,7 @@ private async Task OnResponse(object sender, SessionEventArgs e)
251251
}
252252

253253
/// <summary>
254-
/// Allows overriding default certificate validation logic
254+
/// Allows overriding default certificate validation logic
255255
/// </summary>
256256
/// <param name="sender"></param>
257257
/// <param name="e"></param>
@@ -267,7 +267,7 @@ public Task OnCertificateValidation(object sender, CertificateValidationEventArg
267267
}
268268

269269
/// <summary>
270-
/// Allows overriding default client certificate selection logic during mutual authentication
270+
/// Allows overriding default client certificate selection logic during mutual authentication
271271
/// </summary>
272272
/// <param name="sender"></param>
273273
/// <param name="e"></param>
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
2+
23
<configuration>
3-
<startup>
4-
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
5-
</startup>
6-
</configuration>
4+
<startup>
5+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
6+
</startup>
7+
</configuration>

Examples/Titanium.Web.Proxy.Examples.Wpf/App.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
xmlns:local="clr-namespace:Titanium.Web.Proxy.Examples.Wpf"
55
StartupUri="MainWindow.xaml">
66
<Application.Resources>
7-
7+
88
</Application.Resources>
9-
</Application>
9+
</Application>

Examples/Titanium.Web.Proxy.Examples.Wpf/App.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Titanium.Web.Proxy.Examples.Wpf
44
{
55
/// <summary>
6-
/// Interaction logic for App.xaml
6+
/// Interaction logic for App.xaml
77
/// </summary>
88
public partial class App : Application
99
{

Examples/Titanium.Web.Proxy.Examples.Wpf/MainWindow.xaml

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -6,50 +6,51 @@
66
xmlns:local="clr-namespace:Titanium.Web.Proxy.Examples.Wpf"
77
mc:Ignorable="d"
88
Title="MainWindow" Height="500" Width="1000" WindowState="Maximized"
9-
DataContext="{Binding RelativeSource={RelativeSource Self}}">
9+
DataContext="{Binding RelativeSource={RelativeSource Self}}">
1010
<Grid>
1111
<Grid.ColumnDefinitions>
12-
<ColumnDefinition Width="500" />
13-
<ColumnDefinition Width="3" />
14-
<ColumnDefinition />
15-
</Grid.ColumnDefinitions>
16-
<Grid.RowDefinitions>
17-
<RowDefinition />
18-
<RowDefinition Height="Auto" />
19-
</Grid.RowDefinitions>
20-
<GridSplitter Grid.Column="1" Grid.Row="0" HorizontalAlignment="Stretch" />
21-
<ListView Grid.Column="0" Grid.Row="0" HorizontalAlignment="Stretch" ItemsSource="{Binding Sessions}" SelectedItem="{Binding SelectedSession}"
22-
KeyDown="ListViewSessions_OnKeyDown">
23-
<ListView.View>
24-
<GridView>
25-
<GridViewColumn Header="Result" DisplayMemberBinding="{Binding StatusCode}" />
26-
<GridViewColumn Header="Protocol" DisplayMemberBinding="{Binding Protocol}" />
27-
<GridViewColumn Header="Host" DisplayMemberBinding="{Binding Host}" />
28-
<GridViewColumn Header="Url" DisplayMemberBinding="{Binding Url}" />
29-
<GridViewColumn Header="BodySize" DisplayMemberBinding="{Binding BodySize}" />
30-
<GridViewColumn Header="Process" DisplayMemberBinding="{Binding Process}" />
31-
<GridViewColumn Header="SentBytes" DisplayMemberBinding="{Binding SentDataCount}" />
32-
<GridViewColumn Header="ReceivedBytes" DisplayMemberBinding="{Binding ReceivedDataCount}" />
33-
</GridView>
34-
</ListView.View>
35-
</ListView>
36-
<TabControl Grid.Column="2" Grid.Row="0">
37-
<TabItem Header="Session">
38-
<Grid Background="Red" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
39-
<Grid.RowDefinitions>
40-
<RowDefinition />
41-
<RowDefinition />
42-
</Grid.RowDefinitions>
43-
<TextBox x:Name="TextBoxRequest" Grid.Row="0" />
44-
<TextBox x:Name="TextBoxResponse" Grid.Row="1" />
45-
</Grid>
46-
</TabItem>
47-
</TabControl>
48-
<StackPanel Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="3" Orientation="Horizontal">
49-
<TextBlock Text="ClientConnectionCount:" />
50-
<TextBlock Text="{Binding ClientConnectionCount}" Margin="10,0,20,0" />
51-
<TextBlock Text="ServerConnectionCount:" />
52-
<TextBlock Text="{Binding ServerConnectionCount}" Margin="10,0,20,0" />
53-
</StackPanel>
12+
<ColumnDefinition Width="500" />
13+
<ColumnDefinition Width="3" />
14+
<ColumnDefinition />
15+
</Grid.ColumnDefinitions>
16+
<Grid.RowDefinitions>
17+
<RowDefinition />
18+
<RowDefinition Height="Auto" />
19+
</Grid.RowDefinitions>
20+
<GridSplitter Grid.Column="1" Grid.Row="0" HorizontalAlignment="Stretch" />
21+
<ListView Grid.Column="0" Grid.Row="0" HorizontalAlignment="Stretch" ItemsSource="{Binding Sessions}"
22+
SelectedItem="{Binding SelectedSession}"
23+
KeyDown="ListViewSessions_OnKeyDown">
24+
<ListView.View>
25+
<GridView>
26+
<GridViewColumn Header="Result" DisplayMemberBinding="{Binding StatusCode}" />
27+
<GridViewColumn Header="Protocol" DisplayMemberBinding="{Binding Protocol}" />
28+
<GridViewColumn Header="Host" DisplayMemberBinding="{Binding Host}" />
29+
<GridViewColumn Header="Url" DisplayMemberBinding="{Binding Url}" />
30+
<GridViewColumn Header="BodySize" DisplayMemberBinding="{Binding BodySize}" />
31+
<GridViewColumn Header="Process" DisplayMemberBinding="{Binding Process}" />
32+
<GridViewColumn Header="SentBytes" DisplayMemberBinding="{Binding SentDataCount}" />
33+
<GridViewColumn Header="ReceivedBytes" DisplayMemberBinding="{Binding ReceivedDataCount}" />
34+
</GridView>
35+
</ListView.View>
36+
</ListView>
37+
<TabControl Grid.Column="2" Grid.Row="0">
38+
<TabItem Header="Session">
39+
<Grid Background="Red" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
40+
<Grid.RowDefinitions>
41+
<RowDefinition />
42+
<RowDefinition />
43+
</Grid.RowDefinitions>
44+
<TextBox x:Name="TextBoxRequest" Grid.Row="0" />
45+
<TextBox x:Name="TextBoxResponse" Grid.Row="1" />
46+
</Grid>
47+
</TabItem>
48+
</TabControl>
49+
<StackPanel Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="3" Orientation="Horizontal">
50+
<TextBlock Text="ClientConnectionCount:" />
51+
<TextBlock Text="{Binding ClientConnectionCount}" Margin="10,0,20,0" />
52+
<TextBlock Text="ServerConnectionCount:" />
53+
<TextBlock Text="{Binding ServerConnectionCount}" Margin="10,0,20,0" />
54+
</StackPanel>
5455
</Grid>
55-
</Window>
56+
</Window>

0 commit comments

Comments
 (0)