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
e05318f4
Unverified
Commit
e05318f4
authored
Nov 30, 2019
by
honfika
Committed by
GitHub
Nov 30, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #687 from justcoding121/master
beta
parents
f3ab526d
dd0a19ad
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
71 additions
and
20 deletions
+71
-20
ExplicitClientHandler.cs
src/Titanium.Web.Proxy/ExplicitClientHandler.cs
+7
-2
ConnectRequest.cs
src/Titanium.Web.Proxy/Http/ConnectRequest.cs
+2
-1
Request.cs
src/Titanium.Web.Proxy/Http/Request.cs
+2
-2
Http2Helper.cs
src/Titanium.Web.Proxy/Http2/Http2Helper.cs
+2
-2
ByteString.cs
src/Titanium.Web.Proxy/Models/ByteString.cs
+21
-0
TcpConnectionFactory.cs
src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
+29
-5
SslTools.cs
src/Titanium.Web.Proxy/StreamExtended/SslTools.cs
+1
-1
Titanium.Web.Proxy.Mono.csproj
src/Titanium.Web.Proxy/Titanium.Web.Proxy.Mono.csproj
+1
-1
Titanium.Web.Proxy.NetCore.csproj
src/Titanium.Web.Proxy/Titanium.Web.Proxy.NetCore.csproj
+1
-1
Titanium.Web.Proxy.csproj
src/Titanium.Web.Proxy/Titanium.Web.Proxy.csproj
+1
-1
Titanium.Web.Proxy.nuspec
src/Titanium.Web.Proxy/Titanium.Web.Proxy.nuspec
+4
-4
No files found.
src/Titanium.Web.Proxy/ExplicitClientHandler.cs
View file @
e05318f4
...
...
@@ -58,7 +58,7 @@ namespace Titanium.Web.Proxy
return
;
}
var
connectRequest
=
new
ConnectRequest
(
requestLine
.
RequestUri
.
GetString
()
)
var
connectRequest
=
new
ConnectRequest
(
requestLine
.
RequestUri
)
{
RequestUriString8
=
requestLine
.
RequestUri
,
HttpVersion
=
requestLine
.
Version
...
...
@@ -269,7 +269,12 @@ namespace Titanium.Web.Proxy
try
{
// clientStream.Available should be at most BufferSize because it is using the same buffer size
await
clientStream
.
ReadAsync
(
data
,
0
,
available
,
cancellationToken
);
int
read
=
await
clientStream
.
ReadAsync
(
data
,
0
,
available
,
cancellationToken
);
if
(
read
!=
available
)
{
throw
new
Exception
(
"Internal error."
);
}
await
connection
.
Stream
.
WriteAsync
(
data
,
0
,
available
,
true
,
cancellationToken
);
}
finally
...
...
src/Titanium.Web.Proxy/Http/ConnectRequest.cs
View file @
e05318f4
using
System
;
using
Titanium.Web.Proxy.Extensions
;
using
Titanium.Web.Proxy.Models
;
using
Titanium.Web.Proxy.StreamExtended
;
namespace
Titanium.Web.Proxy.Http
...
...
@@ -9,7 +10,7 @@ namespace Titanium.Web.Proxy.Http
/// </summary>
public
class
ConnectRequest
:
Request
{
public
ConnectRequest
(
s
tring
authority
)
internal
ConnectRequest
(
ByteS
tring
authority
)
{
Method
=
"CONNECT"
;
Authority
=
authority
;
...
...
src/Titanium.Web.Proxy/Http/Request.cs
View file @
e05318f4
...
...
@@ -40,7 +40,7 @@ namespace Titanium.Web.Proxy.Http
}
}
internal
string
?
Authority
{
get
;
set
;
}
internal
ByteString
Authority
{
get
;
set
;
}
/// <summary>
/// Request HTTP Uri.
...
...
@@ -75,7 +75,7 @@ namespace Titanium.Web.Proxy.Http
string
url
=
RequestUriString8
.
GetString
();
if
(
getUriScheme
(
RequestUriString8
).
Length
==
0
)
{
string
?
hostAndPath
=
Host
??
Authority
;
string
?
hostAndPath
=
Host
??
Authority
.
GetString
()
;
if
(
url
.
StartsWith
(
"/"
))
{
...
...
src/Titanium.Web.Proxy/Http2/Http2Helper.cs
View file @
e05318f4
...
...
@@ -264,7 +264,7 @@ namespace Titanium.Web.Proxy.Http2
request
.
HttpVersion
=
HttpVersion
.
Version20
;
request
.
Method
=
method
.
GetString
();
request
.
IsHttps
=
headerListener
.
Scheme
==
ProxyServer
.
UriSchemeHttps
;
request
.
Authority
=
headerListener
.
Authority
.
GetString
()
;
request
.
Authority
=
headerListener
.
Authority
;
request
.
RequestUriString8
=
path
;
//request.RequestUri = headerListener.GetUri();
...
...
@@ -475,7 +475,7 @@ namespace Titanium.Web.Proxy.Http2
encoder
.
EncodeHeader
(
writer
,
StaticTable
.
KnownHeaderMethod
,
request
.
Method
.
GetByteString
());
encoder
.
EncodeHeader
(
writer
,
StaticTable
.
KnownHeaderAuhtority
,
uri
.
Authority
.
GetByteString
());
encoder
.
EncodeHeader
(
writer
,
StaticTable
.
KnownHeaderScheme
,
uri
.
Scheme
.
GetByteString
());
encoder
.
EncodeHeader
(
writer
,
StaticTable
.
KnownHeaderPath
,
request
.
Url
.
GetByteString
()
,
false
,
encoder
.
EncodeHeader
(
writer
,
StaticTable
.
KnownHeaderPath
,
request
.
RequestUriString8
,
false
,
HpackUtil
.
IndexType
.
None
,
false
);
}
else
...
...
src/Titanium.Web.Proxy/Models/ByteString.cs
View file @
e05318f4
using
System
;
using
System.Text
;
using
Titanium.Web.Proxy.Extensions
;
namespace
Titanium.Web.Proxy.Models
{
...
...
@@ -28,11 +29,31 @@ namespace Titanium.Web.Proxy.Models
return
Data
.
Span
.
SequenceEqual
(
other
.
Data
.
Span
);
}
public
int
IndexOf
(
byte
value
)
{
return
Span
.
IndexOf
(
value
);
}
public
ByteString
Slice
(
int
start
)
{
return
Data
.
Slice
(
start
);
}
public
ByteString
Slice
(
int
start
,
int
length
)
{
return
Data
.
Slice
(
start
,
length
);
}
public
override
int
GetHashCode
()
{
return
Data
.
GetHashCode
();
}
public
override
string
ToString
()
{
return
this
.
GetString
();
}
public
static
explicit
operator
ByteString
(
string
str
)
=>
new
ByteString
(
Encoding
.
ASCII
.
GetBytes
(
str
));
public
static
implicit
operator
ByteString
(
byte
[]
data
)
=>
new
ByteString
(
data
);
...
...
src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
View file @
e05318f4
...
...
@@ -180,10 +180,34 @@ namespace Titanium.Web.Proxy.Network.Tcp
session
.
CustomUpStreamProxyUsed
=
customUpStreamProxy
;
var
uri
=
session
.
HttpClient
.
Request
.
RequestUri
;
var
request
=
session
.
HttpClient
.
Request
;
string
host
;
int
port
;
if
(
request
.
Authority
.
Length
>
0
)
{
var
authority
=
request
.
Authority
;
int
idx
=
authority
.
IndexOf
((
byte
)
':'
);
if
(
idx
==
-
1
)
{
host
=
authority
.
GetString
();
port
=
80
;
}
else
{
host
=
authority
.
Slice
(
0
,
idx
).
GetString
();
port
=
int
.
Parse
(
authority
.
Slice
(
idx
+
1
).
GetString
());
}
}
else
{
var
uri
=
request
.
RequestUri
;
host
=
uri
.
Host
;
port
=
uri
.
Port
;
}
return
await
GetServerConnection
(
uri
.
H
ost
,
uri
.
P
ort
,
h
ost
,
p
ort
,
session
.
HttpClient
.
Request
.
HttpVersion
,
isHttps
,
applicationProtocols
,
isConnect
,
server
,
session
,
session
.
HttpClient
.
UpStreamEndPoint
??
server
.
UpStreamEndPoint
,
...
...
@@ -426,11 +450,11 @@ retry:
if
(
externalProxy
!=
null
&&
(
isConnect
||
isHttps
))
{
string
authority
=
$"
{
remoteHostName
}
:
{
remotePort
}
"
;
var
authority
=
$"
{
remoteHostName
}
:
{
remotePort
}
"
.
GetByteString
()
;
var
connectRequest
=
new
ConnectRequest
(
authority
)
{
IsHttps
=
isHttps
,
RequestUriString8
=
HttpHeader
.
Encoding
.
GetBytes
(
authority
)
,
RequestUriString8
=
authority
,
HttpVersion
=
httpVersion
};
...
...
src/Titanium.Web.Proxy/StreamExtended/SslTools.cs
View file @
e05318f4
...
...
@@ -216,7 +216,7 @@ namespace Titanium.Web.Proxy.StreamExtended
int
recordLength
=
((
recordType
&
0x7f
)
<<
8
)
+
peekStream
.
ReadByte
();
if
(
recordLength
<
38
)
{
// Message body too short.
// Message body too short.
return
null
;
}
...
...
src/Titanium.Web.Proxy/Titanium.Web.Proxy.Mono.csproj
View file @
e05318f4
...
...
@@ -13,7 +13,7 @@
<ItemGroup>
<PackageReference Include="BrotliSharpLib" Version="0.3.3" />
<PackageReference Include="Portable.BouncyCastle" Version="1.8.5" />
<PackageReference Include="Portable.BouncyCastle" Version="1.8.5
.2
" />
<PackageReference Include="System.Buffers" Version="4.5.0" />
</ItemGroup>
...
...
src/Titanium.Web.Proxy/Titanium.Web.Proxy.NetCore.csproj
View file @
e05318f4
...
...
@@ -13,7 +13,7 @@
<ItemGroup>
<PackageReference Include="BrotliSharpLib" Version="0.3.3" />
<PackageReference Include="Portable.BouncyCastle" Version="1.8.5" />
<PackageReference Include="Portable.BouncyCastle" Version="1.8.5
.2
" />
<PackageReference Include="System.Buffers" Version="4.5.0" />
</ItemGroup>
...
...
src/Titanium.Web.Proxy/Titanium.Web.Proxy.csproj
View file @
e05318f4
...
...
@@ -14,7 +14,7 @@
<ItemGroup>
<PackageReference Include="BrotliSharpLib" Version="0.3.3" />
<PackageReference Include="Portable.BouncyCastle" Version="1.8.5" />
<PackageReference Include="Portable.BouncyCastle" Version="1.8.5
.2
" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'netstandard2.1'">
...
...
src/Titanium.Web.Proxy/Titanium.Web.Proxy.nuspec
View file @
e05318f4
...
...
@@ -16,14 +16,14 @@
<dependencies>
<group
targetFramework=
"net45"
>
<dependency
id=
"BrotliSharpLib"
version=
"0.3.3"
/>
<dependency
id=
"Portable.BouncyCastle"
version=
"1.8.5"
/>
<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"
/>
<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"
/>
...
...
@@ -32,7 +32,7 @@
</group>
<group
targetFramework=
"netstandard2.0"
>
<dependency
id=
"BrotliSharpLib"
version=
"0.3.3"
/>
<dependency
id=
"Portable.BouncyCastle"
version=
"1.8.5"
/>
<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"
/>
...
...
@@ -41,7 +41,7 @@
</group>
<group
targetFramework=
"netstandard2.1"
>
<dependency
id=
"BrotliSharpLib"
version=
"0.3.3"
/>
<dependency
id=
"Portable.BouncyCastle"
version=
"1.8.5"
/>
<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>
...
...
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