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
fe81398b
Commit
fe81398b
authored
May 15, 2017
by
justcoding121
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reduce timeout; cleanup
parent
8317c222
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
18 deletions
+25
-18
ProxyServer.cs
Titanium.Web.Proxy/ProxyServer.cs
+1
-1
RequestHandler.cs
Titanium.Web.Proxy/RequestHandler.cs
+21
-14
ResponseHandler.cs
Titanium.Web.Proxy/ResponseHandler.cs
+3
-3
No files found.
Titanium.Web.Proxy/ProxyServer.cs
View file @
fe81398b
...
...
@@ -252,7 +252,7 @@ namespace Titanium.Web.Proxy
public
ProxyServer
(
string
rootCertificateName
,
string
rootCertificateIssuerName
)
{
//default values
ConnectionTimeOutSeconds
=
12
0
;
ConnectionTimeOutSeconds
=
3
0
;
CertificateCacheTimeOutMinutes
=
60
;
ProxyEndPoints
=
new
List
<
ProxyEndPoint
>();
...
...
Titanium.Web.Proxy/RequestHandler.cs
View file @
fe81398b
...
...
@@ -217,11 +217,16 @@ namespace Titanium.Web.Proxy
endPoint
.
EnableSsl
?
endPoint
.
GenericCertificateName
:
null
,
endPoint
,
null
);
}
/// <summary>
/// Create a Server Connection
/// </summary>
/// <param name="args"></param>
/// <returns></returns>
private
async
Task
<
TcpConnection
>
GetServerConnection
(
SessionEventArgs
args
,
ExternalProxy
customUpStreamHttpProxy
,
ExternalProxy
customUpStreamHttpsProxy
,
bool
closeConnection
)
SessionEventArgs
args
)
{
ExternalProxy
customUpStreamHttpProxy
=
null
;
ExternalProxy
customUpStreamHttpsProxy
=
null
;
if
(
args
.
WebSession
.
Request
.
RequestUri
.
Scheme
==
"http"
)
{
...
...
@@ -243,7 +248,8 @@ namespace Titanium.Web.Proxy
return
await
tcpConnectionFactory
.
CreateClient
(
this
,
args
.
WebSession
.
Request
.
RequestUri
.
Host
,
args
.
WebSession
.
Request
.
RequestUri
.
Port
,
args
.
WebSession
.
Request
.
HttpVersion
,
args
.
WebSession
.
Request
.
RequestUri
.
Port
,
args
.
WebSession
.
Request
.
HttpVersion
,
args
.
IsHttps
,
customUpStreamHttpProxy
??
UpStreamHttpProxy
,
customUpStreamHttpsProxy
??
UpStreamHttpsProxy
,
...
...
@@ -392,7 +398,7 @@ namespace Titanium.Web.Proxy
/// <returns></returns>
private
async
Task
HandleHttpSessionRequest
(
TcpClient
client
,
string
httpCmd
,
Stream
clientStream
,
CustomBinaryReader
clientStreamReader
,
StreamWriter
clientStreamWriter
,
string
httpsHostName
,
ProxyEndPoint
endPoint
,
List
<
HttpHeader
>
connectHeaders
,
ExternalProxy
customUpStreamHttpProxy
=
null
,
ExternalProxy
customUpStreamHttpsProxy
=
null
)
ProxyEndPoint
endPoint
,
List
<
HttpHeader
>
connectHeaders
)
{
TcpConnection
connection
=
null
;
...
...
@@ -410,8 +416,7 @@ namespace Titanium.Web.Proxy
break
;
}
var
args
=
new
SessionEventArgs
(
BufferSize
,
HandleHttpSessionResponse
)
var
args
=
new
SessionEventArgs
(
BufferSize
,
HandleHttpSessionResponse
)
{
ProxyClient
=
{
TcpClient
=
client
},
WebSession
=
{
ConnectHeaders
=
connectHeaders
}
...
...
@@ -464,12 +469,14 @@ namespace Titanium.Web.Proxy
args
.
ProxyClient
.
ClientStreamReader
=
clientStreamReader
;
args
.
ProxyClient
.
ClientStreamWriter
=
clientStreamWriter
;
if
(
httpsHostName
==
null
&&
await
CheckAuthorization
(
clientStreamWriter
,
args
.
WebSession
.
Request
.
RequestHeaders
.
Values
)
==
false
)
if
(
httpsHostName
==
null
&&
await
CheckAuthorization
(
clientStreamWriter
,
args
.
WebSession
.
Request
.
RequestHeaders
.
Values
)
==
false
)
{
Dispose
(
clientStream
,
clientStreamReader
,
clientStreamWriter
,
args
.
WebSession
.
ServerC
onnection
);
c
onnection
);
break
;
}
...
...
@@ -502,14 +509,14 @@ namespace Titanium.Web.Proxy
Dispose
(
clientStream
,
clientStreamReader
,
clientStreamWriter
,
args
.
WebSession
.
ServerC
onnection
);
c
onnection
);
break
;
}
if
(
connection
==
null
)
{
connection
=
await
GetServerConnection
(
args
,
customUpStreamHttpProxy
,
customUpStreamHttpsProxy
,
false
);
connection
=
await
GetServerConnection
(
args
);
}
//construct the web request that we are going to issue on behalf of the client.
...
...
@@ -526,7 +533,7 @@ namespace Titanium.Web.Proxy
Dispose
(
clientStream
,
clientStreamReader
,
clientStreamWriter
,
args
.
WebSession
.
ServerC
onnection
);
c
onnection
);
break
;
}
...
...
@@ -537,7 +544,7 @@ namespace Titanium.Web.Proxy
Dispose
(
clientStream
,
clientStreamReader
,
clientStreamWriter
,
args
.
WebSession
.
ServerC
onnection
);
c
onnection
);
break
;
}
...
...
@@ -552,7 +559,7 @@ namespace Titanium.Web.Proxy
Dispose
(
clientStream
,
clientStreamReader
,
clientStreamWriter
,
args
.
WebSession
.
ServerC
onnection
);
c
onnection
);
break
;
}
}
...
...
Titanium.Web.Proxy/ResponseHandler.cs
View file @
fe81398b
...
...
@@ -59,9 +59,9 @@ namespace Titanium.Web.Proxy
ServerConnectionCount
--;
}
var
connection
=
await
GetServerConnection
(
args
,
null
,
null
,
true
);
await
HandleHttpSessionRequestInternal
(
null
,
args
,
true
);
return
true
;
var
connection
=
await
GetServerConnection
(
args
);
var
result
=
await
HandleHttpSessionRequestInternal
(
null
,
args
,
true
);
return
result
;
}
args
.
WebSession
.
Response
.
ResponseLocked
=
true
;
...
...
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