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
7eb8f297
Unverified
Commit
7eb8f297
authored
Mar 25, 2018
by
honfika
Committed by
GitHub
Mar 25, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #391 from justcoding121/develop
merge to beta
parents
5e1841ff
a2961205
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
16 deletions
+24
-16
MainWindow.xaml.cs
Examples/Titanium.Web.Proxy.Examples.Wpf/MainWindow.xaml.cs
+1
-2
LimitedStream.cs
Titanium.Web.Proxy/EventArguments/LimitedStream.cs
+22
-9
Tcp.cs
Titanium.Web.Proxy/Helpers/Tcp.cs
+1
-5
No files found.
Examples/Titanium.Web.Proxy.Examples.Wpf/MainWindow.xaml.cs
View file @
7eb8f297
...
@@ -90,8 +90,7 @@ namespace Titanium.Web.Proxy.Examples.Wpf
...
@@ -90,8 +90,7 @@ namespace Titanium.Web.Proxy.Examples.Wpf
//proxyServer.CertificateManager.LoadRootCertificate(@"C:\NameFolder\rootCert.pfx", "PfxPassword");
//proxyServer.CertificateManager.LoadRootCertificate(@"C:\NameFolder\rootCert.pfx", "PfxPassword");
var
explicitEndPoint
=
new
ExplicitProxyEndPoint
(
IPAddress
.
Any
,
8000
,
true
);
var
explicitEndPoint
=
new
ExplicitProxyEndPoint
(
IPAddress
.
Any
,
8000
,
true
);
proxyServer
.
AddEndPoint
(
explicitEndPoint
);
proxyServer
.
AddEndPoint
(
explicitEndPoint
);
//proxyServer.UpStreamHttpProxy = new ExternalProxy
//proxyServer.UpStreamHttpProxy = new ExternalProxy
//{
//{
...
...
Titanium.Web.Proxy/EventArguments/LimitedStream.cs
View file @
7eb8f297
...
@@ -22,7 +22,11 @@ namespace Titanium.Web.Proxy.EventArguments
...
@@ -22,7 +22,11 @@ namespace Titanium.Web.Proxy.EventArguments
this
.
baseStream
=
baseStream
;
this
.
baseStream
=
baseStream
;
this
.
baseReader
=
baseReader
;
this
.
baseReader
=
baseReader
;
this
.
isChunked
=
isChunked
;
this
.
isChunked
=
isChunked
;
bytesRemaining
=
isChunked
?
0
:
contentLength
;
bytesRemaining
=
isChunked
?
0
:
contentLength
==
-
1
?
long
.
MaxValue
:
contentLength
;
}
}
private
void
GetNextChunk
()
private
void
GetNextChunk
()
...
@@ -98,22 +102,31 @@ namespace Titanium.Web.Proxy.EventArguments
...
@@ -98,22 +102,31 @@ namespace Titanium.Web.Proxy.EventArguments
int
res
=
baseStream
.
Read
(
buffer
,
offset
,
toRead
);
int
res
=
baseStream
.
Read
(
buffer
,
offset
,
toRead
);
bytesRemaining
-=
res
;
bytesRemaining
-=
res
;
if
(
res
==
0
)
{
bytesRemaining
=
-
1
;
}
return
res
;
return
res
;
}
}
public
async
Task
Finish
()
public
async
Task
Finish
()
{
{
var
buffer
=
BufferPool
.
GetBuffer
(
baseReader
.
Buffer
.
Length
);
if
(
bytesRemaining
!=
-
1
)
try
{
{
while
(
bytesRemaining
!=
-
1
)
var
buffer
=
BufferPool
.
GetBuffer
(
baseReader
.
Buffer
.
Length
);
try
{
{
await
ReadAsync
(
buffer
,
0
,
buffer
.
Length
);
int
res
=
await
ReadAsync
(
buffer
,
0
,
buffer
.
Length
);
if
(
res
!=
0
)
{
throw
new
Exception
(
"Data received after stream end"
);
}
}
finally
{
BufferPool
.
ReturnBuffer
(
buffer
);
}
}
}
finally
{
BufferPool
.
ReturnBuffer
(
buffer
);
}
}
}
}
...
...
Titanium.Web.Proxy/Helpers/Tcp.cs
View file @
7eb8f297
...
@@ -249,12 +249,8 @@ namespace Titanium.Web.Proxy.Helpers
...
@@ -249,12 +249,8 @@ namespace Titanium.Web.Proxy.Helpers
internal
static
Task
SendRaw
(
Stream
clientStream
,
Stream
serverStream
,
int
bufferSize
,
internal
static
Task
SendRaw
(
Stream
clientStream
,
Stream
serverStream
,
int
bufferSize
,
Action
<
byte
[],
int
,
int
>
onDataSend
,
Action
<
byte
[],
int
,
int
>
onDataReceive
,
ExceptionHandler
exceptionFunc
)
Action
<
byte
[],
int
,
int
>
onDataSend
,
Action
<
byte
[],
int
,
int
>
onDataReceive
,
ExceptionHandler
exceptionFunc
)
{
{
#if NET45
// todo: fix APM mode
return
SendRawApm
(
clientStream
,
serverStream
,
bufferSize
,
onDataSend
,
onDataReceive
,
exceptionFunc
);
#else
// todo: Apm hangs in dotnet core
return
SendRawTap
(
clientStream
,
serverStream
,
bufferSize
,
onDataSend
,
onDataReceive
,
exceptionFunc
);
return
SendRawTap
(
clientStream
,
serverStream
,
bufferSize
,
onDataSend
,
onDataReceive
,
exceptionFunc
);
#endif
}
}
}
}
}
}
\ No newline at end of file
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