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
ce0bba9b
Commit
ce0bba9b
authored
Mar 27, 2018
by
Honfika
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow to terminate server connection
parent
bb2d9b0e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
6 deletions
+16
-6
RequestHandler.cs
Titanium.Web.Proxy/RequestHandler.cs
+11
-6
ResponseHandler.cs
Titanium.Web.Proxy/ResponseHandler.cs
+5
-0
No files found.
Titanium.Web.Proxy/RequestHandler.cs
View file @
ce0bba9b
...
@@ -46,7 +46,6 @@ namespace Titanium.Web.Proxy
...
@@ -46,7 +46,6 @@ namespace Titanium.Web.Proxy
try
try
{
{
string
connectHostname
=
null
;
string
connectHostname
=
null
;
ConnectRequest
connectRequest
=
null
;
ConnectRequest
connectRequest
=
null
;
//Client wants to create a secure tcp tunnel (probably its a HTTPS or Websocket request)
//Client wants to create a secure tcp tunnel (probably its a HTTPS or Websocket request)
...
@@ -297,7 +296,7 @@ namespace Titanium.Web.Proxy
...
@@ -297,7 +296,7 @@ namespace Titanium.Web.Proxy
string
httpCmd
=
await
clientStreamReader
.
ReadLineAsync
();
string
httpCmd
=
await
clientStreamReader
.
ReadLineAsync
();
if
(
string
.
IsNullOrEmpty
(
httpCmd
))
if
(
string
.
IsNullOrEmpty
(
httpCmd
))
{
{
break
;
return
;
}
}
var
args
=
new
SessionEventArgs
(
BufferSize
,
endPoint
,
ExceptionFunc
)
var
args
=
new
SessionEventArgs
(
BufferSize
,
endPoint
,
ExceptionFunc
)
...
@@ -364,7 +363,7 @@ namespace Titanium.Web.Proxy
...
@@ -364,7 +363,7 @@ namespace Titanium.Web.Proxy
//send the response
//send the response
await
clientStreamWriter
.
WriteResponseAsync
(
args
.
WebSession
.
Response
);
await
clientStreamWriter
.
WriteResponseAsync
(
args
.
WebSession
.
Response
);
break
;
return
;
}
}
if
(!
isTransparentEndPoint
)
if
(!
isTransparentEndPoint
)
...
@@ -397,7 +396,7 @@ namespace Titanium.Web.Proxy
...
@@ -397,7 +396,7 @@ namespace Titanium.Web.Proxy
if
(!
response
.
KeepAlive
)
if
(!
response
.
KeepAlive
)
{
{
break
;
return
;
}
}
continue
;
continue
;
...
@@ -450,16 +449,22 @@ namespace Titanium.Web.Proxy
...
@@ -450,16 +449,22 @@ namespace Titanium.Web.Proxy
(
buffer
,
offset
,
count
)
=>
{
args
.
OnDataReceived
(
buffer
,
offset
,
count
);
},
(
buffer
,
offset
,
count
)
=>
{
args
.
OnDataReceived
(
buffer
,
offset
,
count
);
},
ExceptionFunc
);
ExceptionFunc
);
break
;
return
;
}
}
//construct the web request that we are going to issue on behalf of the client.
//construct the web request that we are going to issue on behalf of the client.
await
HandleHttpSessionRequestInternal
(
connection
,
args
);
await
HandleHttpSessionRequestInternal
(
connection
,
args
);
if
(
args
.
WebSession
.
ServerConnection
==
null
)
{
//server connection was closed
return
;
}
//if connection is closing exit
//if connection is closing exit
if
(!
response
.
KeepAlive
)
if
(!
response
.
KeepAlive
)
{
{
break
;
return
;
}
}
}
}
catch
(
Exception
e
)
when
(!(
e
is
ProxyHttpException
))
catch
(
Exception
e
)
when
(!(
e
is
ProxyHttpException
))
...
...
Titanium.Web.Proxy/ResponseHandler.cs
View file @
ce0bba9b
...
@@ -57,6 +57,11 @@ namespace Titanium.Web.Proxy
...
@@ -57,6 +57,11 @@ namespace Titanium.Web.Proxy
//syphon out the response body from server before setting the new body
//syphon out the response body from server before setting the new body
await
args
.
SyphonOutBodyAsync
(
false
);
await
args
.
SyphonOutBodyAsync
(
false
);
}
}
else
{
args
.
WebSession
.
ServerConnection
.
Dispose
();
args
.
WebSession
.
ServerConnection
=
null
;
}
return
;
return
;
}
}
...
...
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