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
1073c975
Commit
1073c975
authored
Jul 06, 2016
by
j.sander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only check for locked request if not read already.
parent
afe22a41
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
15 deletions
+18
-15
SessionEventArgs.cs
Titanium.Web.Proxy/EventArguments/SessionEventArgs.cs
+18
-15
No files found.
Titanium.Web.Proxy/EventArguments/SessionEventArgs.cs
View file @
1073c975
...
...
@@ -63,7 +63,6 @@ namespace Titanium.Web.Proxy.EventArguments
WebSession
=
new
HttpWebClient
();
}
/// <summary>
/// Read request body content as bytes[] for current session
/// </summary>
...
...
@@ -98,7 +97,7 @@ namespace Titanium.Web.Proxy.EventArguments
await
this
.
ProxyClient
.
ClientStreamReader
.
CopyBytesToStream
(
bufferSize
,
requestBodyStream
,
WebSession
.
Request
.
ContentLength
);
}
else
if
(
WebSession
.
Request
.
HttpVersion
.
Major
==
1
&&
WebSession
.
Request
.
HttpVersion
.
Minor
==
0
)
else
if
(
WebSession
.
Request
.
HttpVersion
.
Major
==
1
&&
WebSession
.
Request
.
HttpVersion
.
Minor
==
0
)
await
WebSession
.
ServerConnection
.
StreamReader
.
CopyBytesToStream
(
bufferSize
,
requestBodyStream
,
long
.
MaxValue
);
}
WebSession
.
Request
.
RequestBody
=
await
GetDecompressedResponseBody
(
WebSession
.
Request
.
ContentEncoding
,
requestBodyStream
.
ToArray
());
...
...
@@ -134,7 +133,7 @@ namespace Titanium.Web.Proxy.EventArguments
await
WebSession
.
ServerConnection
.
StreamReader
.
CopyBytesToStream
(
bufferSize
,
responseBodyStream
,
WebSession
.
Response
.
ContentLength
);
}
else
if
(
WebSession
.
Response
.
HttpVersion
.
Major
==
1
&&
WebSession
.
Response
.
HttpVersion
.
Minor
==
0
)
else
if
(
WebSession
.
Response
.
HttpVersion
.
Major
==
1
&&
WebSession
.
Response
.
HttpVersion
.
Minor
==
0
)
await
WebSession
.
ServerConnection
.
StreamReader
.
CopyBytesToStream
(
bufferSize
,
responseBodyStream
,
long
.
MaxValue
);
}
...
...
@@ -151,11 +150,14 @@ namespace Titanium.Web.Proxy.EventArguments
/// </summary>
/// <returns></returns>
public
async
Task
<
byte
[
]>
GetRequestBody
()
{
if
(!
WebSession
.
Request
.
RequestBodyRead
)
{
if
(
WebSession
.
Request
.
RequestLocked
)
throw
new
Exception
(
"You cannot call this function after request is made to server."
);
await
ReadRequestBody
();
}
return
WebSession
.
Request
.
RequestBody
;
}
/// <summary>
...
...
@@ -163,13 +165,14 @@ namespace Titanium.Web.Proxy.EventArguments
/// </summary>
/// <returns></returns>
public
async
Task
<
string
>
GetRequestBodyAsString
()
{
if
(!
WebSession
.
Request
.
RequestBodyRead
)
{
if
(
WebSession
.
Request
.
RequestLocked
)
throw
new
Exception
(
"You cannot call this function after request is made to server."
);
await
ReadRequestBody
();
}
//Use the encoding specified in request to decode the byte[] data to string
return
WebSession
.
Request
.
RequestBodyString
??
(
WebSession
.
Request
.
RequestBodyString
=
WebSession
.
Request
.
Encoding
.
GetString
(
WebSession
.
Request
.
RequestBody
));
}
...
...
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