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
50129826
Commit
50129826
authored
Nov 17, 2019
by
Honfika
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small improvement in ssl tools
parent
347c310c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
88 deletions
+6
-88
DebugCustomBufferedStream.cs
src/Titanium.Web.Proxy/Network/DebugCustomBufferedStream.cs
+0
-74
ProxyServer.cs
src/Titanium.Web.Proxy/ProxyServer.cs
+0
-7
PeekStreamReader.cs
...nium.Web.Proxy/StreamExtended/Network/PeekStreamReader.cs
+1
-1
SslTools.cs
src/Titanium.Web.Proxy/StreamExtended/SslTools.cs
+5
-6
No files found.
src/Titanium.Web.Proxy/Network/DebugCustomBufferedStream.cs
deleted
100644 → 0
View file @
347c310c
using
Titanium.Web.Proxy.StreamExtended.BufferPool
;
using
Titanium.Web.Proxy.StreamExtended.Network
;
#if DEBUG
using
System
;
using
System.IO
;
using
System.Text
;
using
System.Threading
;
namespace
Titanium.Web.Proxy.Network
{
internal
class
DebugCustomBufferedStream
:
CustomBufferedStream
{
private
const
string
basePath
=
@"."
;
private
static
int
counter
;
private
readonly
FileStream
fileStreamReceived
;
private
readonly
FileStream
fileStreamSent
;
public
DebugCustomBufferedStream
(
Guid
connectionId
,
string
type
,
Stream
baseStream
,
IBufferPool
bufferPool
,
bool
leaveOpen
=
false
)
:
base
(
baseStream
,
bufferPool
,
leaveOpen
)
{
Counter
=
Interlocked
.
Increment
(
ref
counter
);
fileStreamSent
=
new
FileStream
(
Path
.
Combine
(
basePath
,
$"
{
connectionId
}
_
{
type
}
_
{
Counter
}
_sent.dat"
),
FileMode
.
Create
);
fileStreamReceived
=
new
FileStream
(
Path
.
Combine
(
basePath
,
$"
{
connectionId
}
_
{
type
}
_
{
Counter
}
_received.dat"
),
FileMode
.
Create
);
}
public
int
Counter
{
get
;
}
protected
override
void
OnDataWrite
(
byte
[]
buffer
,
int
offset
,
int
count
)
{
fileStreamSent
.
Write
(
buffer
,
offset
,
count
);
Flush
();
}
protected
override
void
OnDataRead
(
byte
[]
buffer
,
int
offset
,
int
count
)
{
fileStreamReceived
.
Write
(
buffer
,
offset
,
count
);
Flush
();
}
public
void
LogException
(
Exception
ex
)
{
var
data
=
Encoding
.
UTF8
.
GetBytes
(
"EXCEPTION: "
+
ex
);
fileStreamReceived
.
Write
(
data
,
0
,
data
.
Length
);
fileStreamReceived
.
Flush
();
}
public
override
void
Flush
()
{
fileStreamSent
.
Flush
(
true
);
fileStreamReceived
.
Flush
(
true
);
if
(
CanWrite
)
{
base
.
Flush
();
}
}
protected
override
void
Dispose
(
bool
disposing
)
{
if
(
disposing
)
{
Flush
();
fileStreamSent
.
Dispose
();
fileStreamReceived
.
Dispose
();
}
base
.
Dispose
(
disposing
);
}
}
}
#endif
src/Titanium.Web.Proxy/ProxyServer.cs
View file @
50129826
...
@@ -805,13 +805,6 @@ namespace Titanium.Web.Proxy
...
@@ -805,13 +805,6 @@ namespace Titanium.Web.Proxy
/// <param name="exception">The exception.</param>
/// <param name="exception">The exception.</param>
private
void
onException
(
CustomBufferedStream
clientStream
,
Exception
exception
)
private
void
onException
(
CustomBufferedStream
clientStream
,
Exception
exception
)
{
{
#if DEBUG
if
(
clientStream
is
DebugCustomBufferedStream
debugStream
)
{
debugStream
.
LogException
(
exception
);
}
#endif
ExceptionFunc
(
exception
);
ExceptionFunc
(
exception
);
}
}
...
...
src/Titanium.Web.Proxy/StreamExtended/Network/PeekStreamReader.cs
View file @
50129826
...
@@ -53,5 +53,5 @@ namespace Titanium.Web.Proxy.StreamExtended.Network
...
@@ -53,5 +53,5 @@ namespace Titanium.Web.Proxy.StreamExtended.Network
return
buffer
;
return
buffer
;
}
}
}
}
}
}
src/Titanium.Web.Proxy/StreamExtended/SslTools.cs
View file @
50129826
...
@@ -127,11 +127,10 @@ namespace Titanium.Web.Proxy.StreamExtended
...
@@ -127,11 +127,10 @@ namespace Titanium.Web.Proxy.StreamExtended
return
null
;
return
null
;
}
}
byte
[]
ciphersData
=
peekStream
.
ReadBytes
(
length
);
int
[]
ciphers
=
new
int
[
length
/
2
];
int
[]
ciphers
=
new
int
[
ciphersData
.
Length
/
2
];
for
(
int
i
=
0
;
i
<
ciphers
.
Length
;
i
++)
for
(
int
i
=
0
;
i
<
ciphers
.
Length
;
i
++)
{
{
ciphers
[
i
]
=
(
ciphersData
[
2
*
i
]
<<
8
)
+
ciphersData
[
2
*
i
+
1
]
;
ciphers
[
i
]
=
peekStream
.
ReadInt16
()
;
}
}
length
=
peekStream
.
ReadByte
();
length
=
peekStream
.
ReadByte
();
...
@@ -286,11 +285,11 @@ namespace Titanium.Web.Proxy.StreamExtended
...
@@ -286,11 +285,11 @@ namespace Titanium.Web.Proxy.StreamExtended
int
cipherSuite
=
peekStream
.
ReadInt16
();
int
cipherSuite
=
peekStream
.
ReadInt16
();
byte
compressionMethod
=
peekStream
.
ReadByte
();
byte
compressionMethod
=
peekStream
.
ReadByte
();
int
extens
t
ionsStartPosition
=
peekStream
.
Position
;
int
extensionsStartPosition
=
peekStream
.
Position
;
Dictionary
<
string
,
SslExtension
>?
extensions
=
null
;
Dictionary
<
string
,
SslExtension
>?
extensions
=
null
;
if
(
extens
t
ionsStartPosition
<
recordLength
+
5
)
if
(
extensionsStartPosition
<
recordLength
+
5
)
{
{
extensions
=
await
ReadExtensions
(
majorVersion
,
minorVersion
,
peekStream
,
bufferPool
,
cancellationToken
);
extensions
=
await
ReadExtensions
(
majorVersion
,
minorVersion
,
peekStream
,
bufferPool
,
cancellationToken
);
}
}
...
@@ -298,7 +297,7 @@ namespace Titanium.Web.Proxy.StreamExtended
...
@@ -298,7 +297,7 @@ namespace Titanium.Web.Proxy.StreamExtended
var
serverHelloInfo
=
new
ServerHelloInfo
(
3
,
majorVersion
,
minorVersion
,
random
,
sessionId
,
cipherSuite
,
peekStream
.
Position
)
var
serverHelloInfo
=
new
ServerHelloInfo
(
3
,
majorVersion
,
minorVersion
,
random
,
sessionId
,
cipherSuite
,
peekStream
.
Position
)
{
{
CompressionMethod
=
compressionMethod
,
CompressionMethod
=
compressionMethod
,
EntensionsStartPosition
=
extens
t
ionsStartPosition
,
EntensionsStartPosition
=
extensionsStartPosition
,
Extensions
=
extensions
,
Extensions
=
extensions
,
};
};
...
...
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