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
ac02c68b
Commit
ac02c68b
authored
Mar 31, 2019
by
justcoding121
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix fake tunnel failure
parent
48c041e6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
1 deletion
+43
-1
RequestHandler.cs
src/Titanium.Web.Proxy/RequestHandler.cs
+14
-1
HttpsTests.cs
tests/Titanium.Web.Proxy.IntegrationTests/HttpsTests.cs
+29
-0
No files found.
src/Titanium.Web.Proxy/RequestHandler.cs
View file @
ac02c68b
...
...
@@ -2,6 +2,7 @@
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Net
;
using
System.Net.Sockets
;
#if NETCOREAPP2_1
using
System.Net.Security
;
#endif
...
...
@@ -187,9 +188,21 @@ namespace Titanium.Web.Proxy
//If prefetch task is available.
if
(
connection
==
null
&&
prefetchTask
!=
null
)
{
try
{
connection
=
await
prefetchTask
;
}
catch
(
SocketException
e
)
{
if
(
e
.
SocketErrorCode
!=
SocketError
.
HostNotFound
)
{
throw
;
}
}
prefetchTask
=
null
;
}
// create a new connection if cache key changes.
...
...
tests/Titanium.Web.Proxy.IntegrationTests/HttpsTests.cs
View file @
ac02c68b
...
...
@@ -33,5 +33,34 @@ namespace Titanium.Web.Proxy.IntegrationTests
Assert
.
AreEqual
(
"I am server. I received your greetings."
,
body
);
}
[
TestMethod
]
public
async
Task
Can_Handle_Https_Fake_Tunnel_Request
()
{
var
testSuite
=
new
TestSuite
();
var
server
=
testSuite
.
GetServer
();
server
.
HandleRequest
((
context
)
=>
{
return
context
.
Response
.
WriteAsync
(
"I am server. I received your greetings."
);
});
var
proxy
=
testSuite
.
GetProxy
();
proxy
.
BeforeRequest
+=
async
(
sender
,
e
)
=>
{
e
.
HttpClient
.
Request
.
RequestUri
=
new
Uri
(
server
.
ListeningHttpUrl
);
await
Task
.
FromResult
(
0
);
};
var
client
=
testSuite
.
GetClient
(
proxy
);
var
response
=
await
client
.
PostAsync
(
new
Uri
(
$"https://
{
Guid
.
NewGuid
().
ToString
()}
.com"
),
new
StringContent
(
"hello server. I am a client."
));
Assert
.
AreEqual
(
HttpStatusCode
.
OK
,
response
.
StatusCode
);
var
body
=
await
response
.
Content
.
ReadAsStringAsync
();
Assert
.
AreEqual
(
"I am server. I received your greetings."
,
body
);
}
}
}
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