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
736b66b7
Unverified
Commit
736b66b7
authored
Mar 29, 2018
by
honfika
Committed by
GitHub
Mar 29, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #400 from justcoding121/develop
Transparent endpoint HTTP CONNECT handling is broken #339
parents
96d9775f
f2f1195b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
7 deletions
+18
-7
RequestHandler.cs
Titanium.Web.Proxy/RequestHandler.cs
+18
-7
No files found.
Titanium.Web.Proxy/RequestHandler.cs
View file @
736b66b7
...
...
@@ -135,7 +135,7 @@ namespace Titanium.Web.Proxy
clientStreamReader
=
new
CustomBinaryReader
(
clientStream
,
BufferSize
);
clientStreamWriter
=
new
HttpResponseWriter
(
clientStream
,
BufferSize
);
}
catch
(
Exception
e
)
catch
(
Exception
e
)
{
ExceptionFunc
(
new
Exception
(
$"Could'nt authenticate client '
{
connectHostname
}
' with fake certificate."
,
e
));
sslStream
?.
Dispose
();
...
...
@@ -238,21 +238,32 @@ namespace Titanium.Web.Proxy
if
(
clientHelloInfo
!=
null
)
{
var
sslStream
=
new
SslStream
(
clientStream
);
clientStream
=
new
CustomBufferedStream
(
sslStream
,
BufferSize
);
string
sniHostName
=
clientHelloInfo
.
GetServerName
()
??
endPoint
.
GenericCertificateName
;
SslStream
sslStream
=
null
;
string
sniHostName
=
null
;
string
certName
=
HttpHelper
.
GetWildCardDomainName
(
sniHostName
);
var
certificate
=
await
CertificateManager
.
CreateCertificateAsync
(
certName
);
try
{
sslStream
=
new
SslStream
(
clientStream
);
sniHostName
=
clientHelloInfo
.
GetServerName
()
??
endPoint
.
GenericCertificateName
;
string
certName
=
HttpHelper
.
GetWildCardDomainName
(
sniHostName
);
var
certificate
=
await
CertificateManager
.
CreateCertificateAsync
(
certName
);
//Successfully managed to authenticate the client using the fake certificate
await
sslStream
.
AuthenticateAsServerAsync
(
certificate
,
false
,
SslProtocols
.
Tls
,
false
);
//HTTPS server created - we can now decrypt the client's traffic
clientStream
=
new
CustomBufferedStream
(
sslStream
,
BufferSize
);
clientStreamReader
.
Dispose
();
clientStreamReader
=
new
CustomBinaryReader
(
clientStream
,
BufferSize
);
clientStreamWriter
=
new
HttpResponseWriter
(
clientStream
,
BufferSize
);
}
catch
(
Exception
e
)
{
ExceptionFunc
(
new
Exception
(
$"Could'nt authenticate client '
{
sniHostName
}
' with fake certificate."
,
e
));
sslStream
?.
Dispose
();
return
;
}
}
...
...
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