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
82ac9634
Unverified
Commit
82ac9634
authored
Dec 28, 2019
by
honfika
Committed by
GitHub
Dec 28, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #727 from justcoding121/beta
stable
parents
3a62c35e
fce77d70
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
5 deletions
+39
-5
ProxyTestController.cs
.../Titanium.Web.Proxy.Examples.Basic/ProxyTestController.cs
+5
-0
HttpServerStream.cs
src/Titanium.Web.Proxy/Helpers/HttpServerStream.cs
+2
-2
HttpStream.cs
src/Titanium.Web.Proxy/Helpers/HttpStream.cs
+6
-1
TcpConnectionFactory.cs
src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
+5
-0
RequestHandler.cs
src/Titanium.Web.Proxy/RequestHandler.cs
+21
-2
No files found.
examples/Titanium.Web.Proxy.Examples.Basic/ProxyTestController.cs
View file @
82ac9634
...
...
@@ -42,6 +42,11 @@ namespace Titanium.Web.Proxy.Examples.Basic
await
writeToConsole
(
exception
.
Message
,
ConsoleColor
.
Red
);
}
};
proxyServer
.
TcpTimeWaitSeconds
=
10
;
proxyServer
.
ConnectionTimeOutSeconds
=
15
;
proxyServer
.
ReuseSocket
=
false
;
proxyServer
.
EnableConnectionPool
=
false
;
proxyServer
.
ForwardToUpstreamGateway
=
true
;
proxyServer
.
CertificateManager
.
SaveFakeCertificates
=
true
;
//proxyServer.ProxyBasicAuthenticateFunc = async (args, userName, password) =>
...
...
src/Titanium.Web.Proxy/Helpers/HttpServerStream.cs
View file @
82ac9634
...
...
@@ -39,7 +39,7 @@ namespace Titanium.Web.Proxy.Helpers
{
// is this really possible?
httpStatus
=
await
ReadLineAsync
(
cancellationToken
)
??
throw
new
ServerConnectionException
(
"Server connection was closed."
);
throw
new
ServerConnectionException
(
"Server connection was closed.
Response status is empty.
"
);
}
Response
.
ParseResponseLine
(
httpStatus
,
out
var
version
,
out
int
statusCode
,
out
string
description
);
...
...
@@ -47,7 +47,7 @@ namespace Titanium.Web.Proxy.Helpers
}
catch
(
Exception
e
)
when
(!(
e
is
ServerConnectionException
))
{
throw
new
ServerConnectionException
(
"Server connection was closed.
"
);
throw
new
ServerConnectionException
(
"Server connection was closed.
Exception while reading the response status."
,
e
);
}
}
}
...
...
src/Titanium.Web.Proxy/Helpers/HttpStream.cs
View file @
82ac9634
...
...
@@ -1096,7 +1096,12 @@ namespace Titanium.Web.Proxy.Helpers
{
while
(
true
)
{
string
chunkHead
=
(
await
ReadLineAsync
(
cancellationToken
))!;
string
?
chunkHead
=
await
ReadLineAsync
(
cancellationToken
);
if
(
chunkHead
==
null
)
{
return
;
}
int
idx
=
chunkHead
.
IndexOf
(
";"
);
if
(
idx
>=
0
)
{
...
...
src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
View file @
82ac9634
...
...
@@ -302,6 +302,11 @@ namespace Titanium.Web.Proxy.Network.Tcp
}
}
if
(
isHttps
&&
sslProtocol
==
SslProtocols
.
None
)
{
sslProtocol
=
proxyServer
.
SupportedSslProtocols
;
}
bool
useUpstreamProxy1
=
false
;
// check if external proxy is set for HTTP/HTTPS
...
...
src/Titanium.Web.Proxy/RequestHandler.cs
View file @
82ac9634
...
...
@@ -68,7 +68,10 @@ namespace Titanium.Web.Proxy
UserData
=
connectArgs
?.
UserData
};
args
.
HttpClient
.
Request
.
IsHttps
=
isHttps
;
if
(
isHttps
)
{
args
.
HttpClient
.
Request
.
IsHttps
=
true
;
}
try
{
...
...
@@ -156,7 +159,19 @@ namespace Titanium.Web.Proxy
}
prefetchTask
=
null
;
}
if
(
connection
!=
null
)
{
var
socket
=
connection
.
TcpSocket
;
bool
part1
=
socket
.
Poll
(
1000
,
SelectMode
.
SelectRead
);
bool
part2
=
socket
.
Available
==
0
;
if
(
part1
&
part2
)
{
//connection is closed
await
tcpConnectionFactory
.
Release
(
connection
,
true
);
connection
=
null
;
}
}
// create a new connection if cache key changes.
...
...
@@ -283,7 +298,11 @@ namespace Titanium.Web.Proxy
if
(
args
.
HttpClient
.
Request
.
UpgradeToWebSocket
)
{
args
.
HttpClient
.
ConnectRequest
!.
TunnelType
=
TunnelType
.
Websocket
;
// connectRequest can be null for SOCKS connection
if
(
args
.
HttpClient
.
ConnectRequest
!=
null
)
{
args
.
HttpClient
.
ConnectRequest
!.
TunnelType
=
TunnelType
.
Websocket
;
}
// if upgrading to websocket then relay the request without reading the contents
await
handleWebSocketUpgrade
(
args
,
args
.
ClientStream
,
connection
,
cancellationTokenSource
,
cancellationToken
);
...
...
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