Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Titanium-Web-Proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Titanium-Web-Proxy
Commits
4562e132
Commit
4562e132
authored
Nov 18, 2019
by
Honfika
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net4.5 support is back
parent
9b4e3dca
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
90 additions
and
18 deletions
+90
-18
SessionEventArgs.cs
src/Titanium.Web.Proxy/EventArguments/SessionEventArgs.cs
+4
-0
RunTime.cs
src/Titanium.Web.Proxy/Helpers/RunTime.cs
+22
-2
HeaderBuilder.cs
src/Titanium.Web.Proxy/Http/HeaderBuilder.cs
+8
-0
Decoder.cs
src/Titanium.Web.Proxy/Http2/Hpack/Decoder.cs
+9
-1
DynamicTable.cs
src/Titanium.Web.Proxy/Http2/Hpack/DynamicTable.cs
+4
-0
Net45Compatibility.cs
src/Titanium.Web.Proxy/Net45Compatibility.cs
+15
-0
TcpConnectionFactory.cs
src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
+4
-0
RequestHandler.cs
src/Titanium.Web.Proxy/RequestHandler.cs
+1
-1
Titanium.Web.Proxy.csproj
src/Titanium.Web.Proxy/Titanium.Web.Proxy.csproj
+5
-11
Titanium.Web.Proxy.nuspec
src/Titanium.Web.Proxy/Titanium.Web.Proxy.nuspec
+18
-3
No files found.
src/Titanium.Web.Proxy/EventArguments/SessionEventArgs.cs
View file @
4562e132
...
...
@@ -589,7 +589,11 @@ namespace Titanium.Web.Proxy.EventArguments
var
response
=
new
RedirectResponse
();
response
.
HttpVersion
=
HttpClient
.
Request
.
HttpVersion
;
response
.
Headers
.
AddHeader
(
KnownHeaders
.
Location
,
url
);
#if NET45
response
.
Body
=
Net45Compatibility
.
EmptyArray
;
#else
response
.
Body
=
Array
.
Empty
<
byte
>();
#endif
Respond
(
response
,
closeServerConnection
);
}
...
...
src/Titanium.Web.Proxy/Helpers/RunTime.cs
View file @
4562e132
using
System
;
using
System
;
using
System.Reflection
;
using
System.Text
;
using
System.Runtime.InteropServices
;
...
...
@@ -13,6 +13,25 @@ namespace Titanium.Web.Proxy.Helpers
{
private
static
readonly
Lazy
<
bool
>
isRunningOnMono
=
new
Lazy
<
bool
>(()
=>
Type
.
GetType
(
"Mono.Runtime"
)
!=
null
);
#if NET45
/// <summary>
/// cache for Windows platform check
/// </summary>
/// <returns></returns>
private
static
bool
isRunningOnWindows
=>
true
;
/// <summary>
/// cache for mono runtime check
/// </summary>
/// <returns></returns>
private
static
bool
isRunningOnLinux
=>
false
;
/// <summary>
/// cache for mac runtime check
/// </summary>
/// <returns></returns>
private
static
bool
isRunningOnMac
=>
false
;
#else
/// <summary>
/// cache for Windows platform check
/// </summary>
...
...
@@ -30,7 +49,8 @@ namespace Titanium.Web.Proxy.Helpers
/// </summary>
/// <returns></returns>
private
static
bool
isRunningOnMac
=>
RuntimeInformation
.
IsOSPlatform
(
OSPlatform
.
OSX
);
#endif
/// <summary>
/// Is running on Mono?
/// </summary>
...
...
src/Titanium.Web.Proxy/Http/HeaderBuilder.cs
View file @
4562e132
...
...
@@ -85,14 +85,22 @@ namespace Titanium.Web.Proxy.Http
public
ArraySegment
<
byte
>
GetBuffer
()
{
#if NET45
return
new
ArraySegment
<
byte
>(
stream
.
ToArray
());
#else
stream
.
TryGetBuffer
(
out
var
buffer
);
return
buffer
;
#endif
}
public
string
GetString
(
Encoding
encoding
)
{
#if NET45
return
encoding
.
GetString
(
stream
.
ToArray
());
#else
stream
.
TryGetBuffer
(
out
var
buffer
);
return
encoding
.
GetString
(
buffer
.
Array
,
buffer
.
Offset
,
buffer
.
Count
);
#endif
}
}
}
src/Titanium.Web.Proxy/Http2/Hpack/Decoder.cs
View file @
4562e132
...
...
@@ -258,7 +258,11 @@ namespace Titanium.Web.Proxy.Http2.Hpack
if
(
nameLength
+
HttpHeader
.
HttpHeaderOverhead
>
dynamicTable
.
Capacity
)
{
dynamicTable
.
Clear
();
#if NET45
name
=
Net45Compatibility
.
EmptyArray
;
#else
name
=
Array
.
Empty
<
byte
>();
#endif
skipLength
=
nameLength
;
state
=
State
.
SkipLiteralHeaderName
;
break
;
...
...
@@ -375,7 +379,11 @@ namespace Titanium.Web.Proxy.Http2.Hpack
if
(
valueLength
==
0
)
{
InsertHeader
(
headerListener
,
name
,
Array
.
Empty
<
byte
>(),
indexType
);
#if NET45
InsertHeader
(
headerListener
,
name
,
Net45Compatibility
.
EmptyArray
,
indexType
);
#else
name
=
Array
.
Empty
<
byte
>();
#endif
state
=
State
.
ReadHeaderRepresentation
;
}
else
...
...
src/Titanium.Web.Proxy/Http2/Hpack/DynamicTable.cs
View file @
4562e132
...
...
@@ -23,7 +23,11 @@ namespace Titanium.Web.Proxy.Http2.Hpack
public
class
DynamicTable
{
// a circular queue of header fields
#if NET45
HttpHeader
[]
headerFields
=
new
HttpHeader
[
0
];
#else
HttpHeader
[]
headerFields
=
Array
.
Empty
<
HttpHeader
>();
#endif
int
head
;
int
tail
;
...
...
src/Titanium.Web.Proxy/Net45Compatibility.cs
0 → 100644
View file @
4562e132
#
if
NET45
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
Titanium.Web.Proxy
{
class
Net45Compatibility
{
public
static
byte
[]
EmptyArray
=
new
byte
[
0
];
}
}
#endif
src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
View file @
4562e132
...
...
@@ -355,7 +355,11 @@ retry:
{
// dispose the current TcpClient and try the next address
lastException
=
e
;
#if NET45
tcpClient
?.
Close
();
#else
tcpClient
?.
Dispose
();
#endif
tcpClient
=
null
;
}
}
...
...
src/Titanium.Web.Proxy/RequestHandler.cs
View file @
4562e132
...
...
@@ -51,7 +51,7 @@ namespace Titanium.Web.Proxy
// Loop through each subsequent request on this particular client connection
// (assuming HTTP connection is kept alive by client)
while
(
true
)
{
{
if
(
clientStream
.
IsClosed
)
{
return
;
...
...
src/Titanium.Web.Proxy/Titanium.Web.Proxy.csproj
View file @
4562e132
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net
45;net461;net
standard2.0;netstandard2.1</TargetFrameworks>
<RootNamespace>Titanium.Web.Proxy</RootNamespace>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<SignAssembly>True</SignAssembly>
...
...
@@ -15,21 +15,15 @@
<ItemGroup>
<PackageReference Include="BrotliSharpLib" Version="0.3.3" />
<PackageReference Include="Portable.BouncyCastle" Version="1.8.5.2" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'netstandard2.1'">
<PackageReference Include="System.Buffers" Version="4.5.0" />
<PackageReference Include="System.Memory" Version="4.5.3" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.3" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Microsoft.Win32.Registry">
<Version>4.6.0</Version>
</PackageReference>
<PackageReference Include="System.Security.Principal.Windows">
<Version>4.6.0</Version>
</PackageReference>
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
<ItemGroup Condition="'$(TargetFramework)' != 'net45'">
<PackageReference Include="Microsoft.Win32.Registry">
<Version>4.6.0</Version>
</PackageReference>
...
...
src/Titanium.Web.Proxy/Titanium.Web.Proxy.nuspec
View file @
4562e132
...
...
@@ -14,27 +14,42 @@
<copyright>
Copyright
©
Titanium. All rights reserved.
</copyright>
<tags></tags>
<dependencies>
<group
targetFramework=
"netstandard2.0"
>
<group
targetFramework=
"net45"
>
<dependency
id=
"BrotliSharpLib"
version=
"0.3.3"
/>
<dependency
id=
"Portable.BouncyCastle"
version=
"1.8.5.2"
/>
<dependency
id=
"System.Buffers"
version=
"4.5.0"
/>
<dependency
id=
"System.Memory"
version=
"4.5.3"
/>
<dependency
id=
"System.Threading.Tasks.Extensions"
version=
"4.5.3"
/>
</group>
<group
targetFramework=
"net461"
>
<dependency
id=
"BrotliSharpLib"
version=
"0.3.3"
/>
<dependency
id=
"Portable.BouncyCastle"
version=
"1.8.5.2"
/>
<dependency
id=
"Microsoft.Win32.Registry"
version=
"4.6.0"
/>
<dependency
id=
"System.Buffers"
version=
"4.5.0"
/>
<dependency
id=
"System.Memory"
version=
"4.5.3"
/>
<dependency
id=
"System.Threading.Tasks.Extensions"
version=
"4.5.3"
/>
<dependency
id=
"System.Security.Principal.Windows"
version=
"4.6.0"
/>
</group>
<group
targetFramework=
"netstandard2.1"
>
<dependency
id=
"Portable.BouncyCastle"
version=
"1.8.5.2"
/>
<group
targetFramework=
"netstandard2.0"
>
<dependency
id=
"BrotliSharpLib"
version=
"0.3.3"
/>
<dependency
id=
"Portable.BouncyCastle"
version=
"1.8.5.2"
/>
<dependency
id=
"Microsoft.Win32.Registry"
version=
"4.6.0"
/>
<dependency
id=
"System.Buffers"
version=
"4.5.0"
/>
<dependency
id=
"System.Memory"
version=
"4.5.3"
/>
<dependency
id=
"System.Threading.Tasks.Extensions"
version=
"4.5.3"
/>
<dependency
id=
"System.Security.Principal.Windows"
version=
"4.6.0"
/>
</group>
<group
targetFramework=
"netstandard2.1"
>
<dependency
id=
"BrotliSharpLib"
version=
"0.3.3"
/>
<dependency
id=
"Portable.BouncyCastle"
version=
"1.8.5.2"
/>
<dependency
id=
"Microsoft.Win32.Registry"
version=
"4.6.0"
/>
<dependency
id=
"System.Security.Principal.Windows"
version=
"4.6.0"
/>
</group>
</dependencies>
</metadata>
<files>
<file
src=
"bin\$configuration$\net45\Titanium.Web.Proxy.dll"
target=
"lib\net45"
/>
<file
src=
"bin\$configuration$\net461\Titanium.Web.Proxy.dll"
target=
"lib\net461"
/>
<file
src=
"bin\$configuration$\netstandard2.0\Titanium.Web.Proxy.dll"
target=
"lib\netstandard2.0"
/>
<file
src=
"bin\$configuration$\netstandard2.1\Titanium.Web.Proxy.dll"
target=
"lib\netstandard2.1"
/>
</files>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment