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
42a5ee99
Commit
42a5ee99
authored
Apr 27, 2019
by
Honfika
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow to change http/2 body
parent
7330b5c3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
200 additions
and
72 deletions
+200
-72
MainWindow.xaml.cs
examples/Titanium.Web.Proxy.Examples.Wpf/MainWindow.xaml.cs
+7
-1
SessionEventArgs.cs
src/Titanium.Web.Proxy/EventArguments/SessionEventArgs.cs
+14
-0
RequestResponseBase.cs
src/Titanium.Web.Proxy/Http/RequestResponseBase.cs
+11
-0
Http2Helper.cs
src/Titanium.Web.Proxy/Http2/Http2Helper.cs
+168
-70
ResponseHandler.cs
src/Titanium.Web.Proxy/ResponseHandler.cs
+0
-1
No files found.
examples/Titanium.Web.Proxy.Examples.Wpf/MainWindow.xaml.cs
View file @
42a5ee99
...
...
@@ -159,6 +159,9 @@ namespace Titanium.Web.Proxy.Examples.Wpf
//{
//}
//if (!e.HttpClient.Request.RequestUri.ToString().Contains("/mail/u/"))
// return;
if
(
e
.
HttpClient
.
Request
.
HasBody
)
{
e
.
HttpClient
.
Request
.
KeepBody
=
true
;
...
...
@@ -177,7 +180,10 @@ namespace Titanium.Web.Proxy.Examples.Wpf
}
});
e
.
HttpClient
.
Response
.
Headers
.
AddHeader
(
"X-Titanium-Header"
,
"HTTP/2 works"
);
//e.SetResponseBody(Encoding.ASCII.GetBytes("TITANIUMMMM!!!!"));
//if (!e.HttpClient.Request.RequestUri.ToString().Contains("/mail/u/"))
// return;
//e.HttpClient.Response.Headers.AddHeader("X-Titanium-Header", "HTTP/2 works");
//if (e.HttpClient.ConnectRequest?.TunnelType == TunnelType.Http2)
//{
...
...
src/Titanium.Web.Proxy/EventArguments/SessionEventArgs.cs
View file @
42a5ee99
...
...
@@ -91,6 +91,9 @@ namespace Titanium.Web.Proxy.EventArguments
{
if
(
request
.
HttpVersion
==
HttpHeader
.
Version20
)
{
// do not send to the remote endpoint
request
.
Http2IgnoreBodyFrames
=
true
;
request
.
Http2BodyData
=
new
MemoryStream
();
var
tcs
=
new
TaskCompletionSource
<
bool
>();
...
...
@@ -100,6 +103,10 @@ namespace Titanium.Web.Proxy.EventArguments
request
.
ReadHttp2BeforeHandlerTaskCompletionSource
.
SetResult
(
true
);
await
tcs
.
Task
;
// Now set the flag to true
// So that next time we can deliver body from cache
request
.
IsBodyRead
=
true
;
}
else
{
...
...
@@ -157,6 +164,9 @@ namespace Titanium.Web.Proxy.EventArguments
{
if
(
response
.
HttpVersion
==
HttpHeader
.
Version20
)
{
// do not send to the remote endpoint
response
.
Http2IgnoreBodyFrames
=
true
;
response
.
Http2BodyData
=
new
MemoryStream
();
var
tcs
=
new
TaskCompletionSource
<
bool
>();
...
...
@@ -166,6 +176,10 @@ namespace Titanium.Web.Proxy.EventArguments
response
.
ReadHttp2BeforeHandlerTaskCompletionSource
.
SetResult
(
true
);
await
tcs
.
Task
;
// Now set the flag to true
// So that next time we can deliver body from cache
response
.
IsBodyRead
=
true
;
}
else
{
...
...
src/Titanium.Web.Proxy/Http/RequestResponseBase.cs
View file @
42a5ee99
...
...
@@ -56,6 +56,15 @@ namespace Titanium.Web.Proxy.Http
internal
MemoryStream
Http2BodyData
;
internal
bool
Http2IgnoreBodyFrames
;
internal
Task
Http2BeforeHandlerTask
;
/// <summary>
/// Priority used only in HTTP/2
/// </summary>
internal
long
?
Priority
;
/// <summary>
/// Keeps the body data after the session is finished.
/// </summary>
...
...
@@ -201,6 +210,8 @@ namespace Titanium.Web.Proxy.Http
/// </summary>
internal
bool
Locked
{
get
;
set
;
}
internal
bool
BodyAvailable
=>
BodyInternal
!=
null
;
internal
abstract
void
EnsureBodyAvailable
(
bool
throwWhenNotReadYet
=
true
);
/// <summary>
...
...
src/Titanium.Web.Proxy/Http2/Http2Helper.cs
View file @
42a5ee99
This diff is collapsed.
Click to expand it.
src/Titanium.Web.Proxy/ResponseHandler.cs
View file @
42a5ee99
...
...
@@ -125,7 +125,6 @@ namespace Titanium.Web.Proxy
}
args
.
TimeLine
[
"Response Sent"
]
=
DateTime
.
Now
;
}
/// <summary>
...
...
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