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
3eeebcce
Commit
3eeebcce
authored
May 13, 2018
by
justcoding121
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use original isBodyRead when siphoning & refactor
parent
22dc6661
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
16 deletions
+39
-16
SessionEventArgs.cs
Titanium.Web.Proxy/EventArguments/SessionEventArgs.cs
+2
-5
Request.cs
Titanium.Web.Proxy/Http/Request.cs
+1
-0
RequestResponseBase.cs
Titanium.Web.Proxy/Http/RequestResponseBase.cs
+34
-3
RequestHandler.cs
Titanium.Web.Proxy/RequestHandler.cs
+1
-4
ResponseHandler.cs
Titanium.Web.Proxy/ResponseHandler.cs
+1
-4
No files found.
Titanium.Web.Proxy/EventArguments/SessionEventArgs.cs
View file @
3eeebcce
...
@@ -179,7 +179,7 @@ namespace Titanium.Web.Proxy.EventArguments
...
@@ -179,7 +179,7 @@ namespace Titanium.Web.Proxy.EventArguments
internal
async
Task
SyphonOutBodyAsync
(
bool
isRequest
,
CancellationToken
cancellationToken
)
internal
async
Task
SyphonOutBodyAsync
(
bool
isRequest
,
CancellationToken
cancellationToken
)
{
{
var
requestResponse
=
isRequest
?
(
RequestResponseBase
)
WebSession
.
Request
:
WebSession
.
Response
;
var
requestResponse
=
isRequest
?
(
RequestResponseBase
)
WebSession
.
Request
:
WebSession
.
Response
;
if
(
requestResponse
.
IsBodyRead
||
!
requestResponse
.
OriginalHasBody
)
if
(
requestResponse
.
Original
IsBodyRead
||
!
requestResponse
.
OriginalHasBody
)
{
{
return
;
return
;
}
}
...
@@ -583,10 +583,7 @@ namespace Titanium.Web.Proxy.EventArguments
...
@@ -583,10 +583,7 @@ namespace Titanium.Web.Proxy.EventArguments
TerminateServerConnection
();
TerminateServerConnection
();
}
}
response
.
OriginalHasBody
=
WebSession
.
Response
.
OriginalHasBody
;
response
.
SetOriginalHeaders
(
WebSession
.
Response
);
response
.
OriginalIsChunked
=
WebSession
.
Response
.
OriginalIsChunked
;
response
.
OriginalContentLength
=
WebSession
.
Response
.
OriginalContentLength
;
response
.
OriginalContentEncoding
=
WebSession
.
Response
.
OriginalContentEncoding
;
//response already received from server but not yet ready to sent to client.
//response already received from server but not yet ready to sent to client.
WebSession
.
Response
=
response
;
WebSession
.
Response
=
response
;
...
...
Titanium.Web.Proxy/Http/Request.cs
View file @
3eeebcce
...
@@ -233,5 +233,6 @@ namespace Titanium.Web.Proxy.Http
...
@@ -233,5 +233,6 @@ namespace Titanium.Web.Proxy.Http
return
true
;
return
true
;
}
}
}
}
}
}
Titanium.Web.Proxy/Http/RequestResponseBase.cs
View file @
3eeebcce
...
@@ -24,7 +24,7 @@ namespace Titanium.Web.Proxy.Http
...
@@ -24,7 +24,7 @@ namespace Titanium.Web.Proxy.Http
/// <summary>
/// <summary>
/// Store whether the original request/response has body or not, since the user may change the parameters.
/// Store whether the original request/response has body or not, since the user may change the parameters.
/// We need this detail to
tcp syphon out attached
connection for reuse.
/// We need this detail to
syphon out attached tcp
connection for reuse.
/// </summary>
/// </summary>
internal
bool
OriginalHasBody
{
get
;
set
;
}
internal
bool
OriginalHasBody
{
get
;
set
;
}
...
@@ -36,16 +36,22 @@ namespace Titanium.Web.Proxy.Http
...
@@ -36,16 +36,22 @@ namespace Titanium.Web.Proxy.Http
/// <summary>
/// <summary>
/// Store whether the original request/response was a chunked body, since the user may change the parameters.
/// Store whether the original request/response was a chunked body, since the user may change the parameters.
/// We need this detail to
tcp syphon out attached
connection for reuse.
/// We need this detail to
syphon out attached tcp
connection for reuse.
/// </summary>
/// </summary>
internal
bool
OriginalIsChunked
{
get
;
set
;
}
internal
bool
OriginalIsChunked
{
get
;
set
;
}
/// <summary>
/// <summary>
/// Store whether the original request/response content-encoding, since the user may change the parameters.
/// Store whether the original request/response content-encoding, since the user may change the parameters.
/// We need this detail to
tcp syphon out attached
connection for reuse.
/// We need this detail to
syphon out attached tcp
connection for reuse.
/// </summary>
/// </summary>
internal
string
OriginalContentEncoding
{
get
;
set
;
}
internal
string
OriginalContentEncoding
{
get
;
set
;
}
/// <summary>
/// Store whether the original request/response body was read by user.
/// We need this detail to syphon out attached tcp connection for reuse.
/// </summary>
public
bool
OriginalIsBodyRead
{
get
;
internal
set
;
}
/// <summary>
/// <summary>
/// Keeps the body data after the session is finished.
/// Keeps the body data after the session is finished.
/// </summary>
/// </summary>
...
@@ -251,6 +257,31 @@ namespace Titanium.Web.Proxy.Http
...
@@ -251,6 +257,31 @@ namespace Titanium.Web.Proxy.Http
ContentLength
=
IsChunked
?
-
1
:
BodyInternal
?.
Length
??
0
;
ContentLength
=
IsChunked
?
-
1
:
BodyInternal
?.
Length
??
0
;
}
}
/// <summary>
/// Set values for original headers using current headers.
/// </summary>
internal
void
SetOriginalHeaders
()
{
OriginalHasBody
=
HasBody
;
OriginalContentLength
=
ContentLength
;
OriginalIsChunked
=
IsChunked
;
OriginalContentEncoding
=
ContentEncoding
;
OriginalIsBodyRead
=
IsBodyRead
;
}
/// <summary>
/// Copy original header values.
/// </summary>
/// <param name="requestResponseBase"></param>
internal
void
SetOriginalHeaders
(
RequestResponseBase
requestResponseBase
)
{
OriginalHasBody
=
requestResponseBase
.
OriginalHasBody
;
OriginalContentLength
=
requestResponseBase
.
OriginalContentLength
;
OriginalIsChunked
=
requestResponseBase
.
OriginalIsChunked
;
OriginalContentEncoding
=
requestResponseBase
.
OriginalContentEncoding
;
OriginalIsBodyRead
=
requestResponseBase
.
OriginalIsBodyRead
;
}
/// <summary>
/// <summary>
/// Finish the session
/// Finish the session
/// </summary>
/// </summary>
...
...
Titanium.Web.Proxy/RequestHandler.cs
View file @
3eeebcce
...
@@ -163,10 +163,7 @@ namespace Titanium.Web.Proxy
...
@@ -163,10 +163,7 @@ namespace Titanium.Web.Proxy
}
}
//we need this to syphon out data from connection if API user changes them.
//we need this to syphon out data from connection if API user changes them.
request
.
OriginalHasBody
=
request
.
HasBody
;
request
.
SetOriginalHeaders
();
request
.
OriginalContentLength
=
request
.
ContentLength
;
request
.
OriginalIsChunked
=
request
.
IsChunked
;
request
.
OriginalContentEncoding
=
request
.
ContentEncoding
;
// If user requested interception do it
// If user requested interception do it
await
invokeBeforeRequest
(
args
);
await
invokeBeforeRequest
(
args
);
...
...
Titanium.Web.Proxy/ResponseHandler.cs
View file @
3eeebcce
...
@@ -41,10 +41,7 @@ namespace Titanium.Web.Proxy
...
@@ -41,10 +41,7 @@ namespace Titanium.Web.Proxy
//save original values so that if user changes them
//save original values so that if user changes them
//we can still use original values when syphoning out data from attached tcp connection.
//we can still use original values when syphoning out data from attached tcp connection.
response
.
OriginalHasBody
=
response
.
HasBody
;
response
.
SetOriginalHeaders
();
response
.
OriginalContentLength
=
response
.
ContentLength
;
response
.
OriginalIsChunked
=
response
.
IsChunked
;
response
.
OriginalContentEncoding
=
response
.
ContentEncoding
;
// if user requested call back then do it
// if user requested call back then do it
if
(!
response
.
Locked
)
if
(!
response
.
Locked
)
...
...
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