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
ef2019e3
Unverified
Commit
ef2019e3
authored
Oct 06, 2019
by
honfika
Committed by
GitHub
Oct 06, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #644 from justcoding121/master
test fix
parents
96a8b1bf
5497aa64
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
21 additions
and
22 deletions
+21
-22
StaticTable.cs
src/Titanium.Web.Proxy/Http2/Hpack/StaticTable.cs
+1
-1
TcpConnectionFactory.cs
src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
+3
-1
ExpectContinueTests.cs
...itanium.Web.Proxy.IntegrationTests/ExpectContinueTests.cs
+4
-4
HttpContinueClient.cs
....Web.Proxy.IntegrationTests/Helpers/HttpContinueClient.cs
+4
-2
HttpMessageParsing.cs
....Web.Proxy.IntegrationTests/Helpers/HttpMessageParsing.cs
+2
-2
NestedProxyTests.cs
...s/Titanium.Web.Proxy.IntegrationTests/NestedProxyTests.cs
+1
-1
TestProxyServer.cs
...anium.Web.Proxy.IntegrationTests/Setup/TestProxyServer.cs
+3
-3
TestServer.cs
...s/Titanium.Web.Proxy.IntegrationTests/Setup/TestServer.cs
+3
-8
No files found.
src/Titanium.Web.Proxy/Http2/Hpack/StaticTable.cs
View file @
ef2019e3
...
...
@@ -28,7 +28,7 @@ namespace Titanium.Web.Proxy.Http2.Hpack
/// Appendix A: Static Table Definition
/// </summary>
/// <see cref="http://tools.ietf.org/html/rfc7541#appendix-A"/>
private
static
readonly
List
<
HttpHeader
>
staticTable
=
new
List
<
HttpHeader
>
()
private
static
readonly
List
<
HttpHeader
>
staticTable
=
new
List
<
HttpHeader
>
{
/* 1 */
new
HttpHeader
(
":authority"
,
string
.
Empty
),
...
...
src/Titanium.Web.Proxy/Network/Tcp/TcpConnectionFactory.cs
View file @
ef2019e3
...
...
@@ -294,6 +294,8 @@ namespace Titanium.Web.Proxy.Network.Tcp
session
.
TimeLine
[
"Dns Resolved"
]
=
DateTime
.
Now
;
}
Array
.
Sort
(
ipAddresses
,
(
x
,
y
)
=>
x
.
AddressFamily
.
CompareTo
(
y
.
AddressFamily
));
for
(
int
i
=
0
;
i
<
ipAddresses
.
Length
;
i
++)
{
try
...
...
@@ -319,7 +321,7 @@ namespace Titanium.Web.Proxy.Network.Tcp
tcpClient
.
Client
.
SetSocketOption
(
SocketOptionLevel
.
Socket
,
SocketOptionName
.
ReuseAddress
,
true
);
}
await
tcpClient
.
ConnectAsync
(
ipAddress
es
[
i
]
,
port
);
await
tcpClient
.
ConnectAsync
(
ipAddress
,
port
);
break
;
}
catch
(
Exception
e
)
...
...
tests/Titanium.Web.Proxy.IntegrationTests/ExpectContinueTests.cs
View file @
ef2019e3
...
...
@@ -22,7 +22,7 @@ namespace Titanium.Web.Proxy.IntegrationTests
{
var
testSuite
=
new
TestSuite
();
var
server
=
testSuite
.
GetServer
();
var
continueServer
=
new
HttpContinueServer
()
var
continueServer
=
new
HttpContinueServer
{
ExpectationResponse
=
HttpStatusCode
.
Continue
,
ResponseBody
=
"I am server. I received your greetings."
...
...
@@ -50,7 +50,7 @@ namespace Titanium.Web.Proxy.IntegrationTests
{
var
testSuite
=
new
TestSuite
();
var
server
=
testSuite
.
GetServer
();
var
continueServer
=
new
HttpContinueServer
()
{
ExpectationResponse
=
HttpStatusCode
.
ExpectationFailed
};
var
continueServer
=
new
HttpContinueServer
{
ExpectationResponse
=
HttpStatusCode
.
ExpectationFailed
};
server
.
HandleTcpRequest
(
continueServer
.
HandleRequest
);
var
proxy
=
testSuite
.
GetReverseProxy
();
...
...
@@ -73,7 +73,7 @@ namespace Titanium.Web.Proxy.IntegrationTests
{
var
testSuite
=
new
TestSuite
();
var
server
=
testSuite
.
GetServer
();
var
continueServer
=
new
HttpContinueServer
()
{
ExpectationResponse
=
HttpStatusCode
.
NotFound
};
var
continueServer
=
new
HttpContinueServer
{
ExpectationResponse
=
HttpStatusCode
.
NotFound
};
server
.
HandleTcpRequest
(
continueServer
.
HandleRequest
);
var
proxy
=
testSuite
.
GetReverseProxy
();
...
...
@@ -96,7 +96,7 @@ namespace Titanium.Web.Proxy.IntegrationTests
{
var
testSuite
=
new
TestSuite
();
var
server
=
testSuite
.
GetServer
();
var
continueServer
=
new
HttpContinueServer
()
{
ExpectationResponse
=
HttpStatusCode
.
Continue
};
var
continueServer
=
new
HttpContinueServer
{
ExpectationResponse
=
HttpStatusCode
.
Continue
};
server
.
HandleTcpRequest
(
continueServer
.
HandleRequest
);
var
dbzEx
=
new
DivideByZeroException
(
"Undefined"
);
...
...
tests/Titanium.Web.Proxy.IntegrationTests/Helpers/HttpContinueClient.cs
View file @
ef2019e3
...
...
@@ -9,6 +9,8 @@ namespace Titanium.Web.Proxy.IntegrationTests.Helpers
{
class
HttpContinueClient
{
private
const
int
waitTimeout
=
200
;
private
static
Encoding
MsgEncoding
=
HttpHelper
.
GetEncodingFromContentType
(
null
);
public
async
Task
<
Response
>
Post
(
string
server
,
int
port
,
string
content
)
...
...
@@ -37,7 +39,7 @@ namespace Titanium.Web.Proxy.IntegrationTests.Helpers
while
((
response
=
HttpMessageParsing
.
ParseResponse
(
responseMsg
))
==
null
)
{
var
readTask
=
client
.
GetStream
().
ReadAsync
(
buffer
,
0
,
1024
);
if
(!
readTask
.
Wait
(
200
))
if
(!
readTask
.
Wait
(
waitTimeout
))
return
null
;
responseMsg
+=
MsgEncoding
.
GetString
(
buffer
,
0
,
readTask
.
Result
);
...
...
@@ -52,7 +54,7 @@ namespace Titanium.Web.Proxy.IntegrationTests.Helpers
while
((
response
=
HttpMessageParsing
.
ParseResponse
(
responseMsg
))
==
null
)
{
var
readTask
=
client
.
GetStream
().
ReadAsync
(
buffer
,
0
,
1024
);
if
(!
readTask
.
Wait
(
200
))
if
(!
readTask
.
Wait
(
waitTimeout
))
return
null
;
responseMsg
+=
MsgEncoding
.
GetString
(
buffer
,
0
,
readTask
.
Result
);
}
...
...
tests/Titanium.Web.Proxy.IntegrationTests/Helpers/HttpMessageParsing.cs
View file @
ef2019e3
...
...
@@ -24,7 +24,7 @@ namespace Titanium.Web.Proxy.IntegrationTests.Helpers
try
{
Request
.
ParseRequestLine
(
line
,
out
var
method
,
out
var
url
,
out
var
version
);
RequestResponseBase
request
=
new
Request
()
RequestResponseBase
request
=
new
Request
{
Method
=
method
,
RequestUriString
=
url
,
HttpVersion
=
version
};
...
...
@@ -69,7 +69,7 @@ namespace Titanium.Web.Proxy.IntegrationTests.Helpers
try
{
Response
.
ParseResponseLine
(
line
,
out
var
version
,
out
var
status
,
out
var
desc
);
RequestResponseBase
response
=
new
Response
()
RequestResponseBase
response
=
new
Response
{
HttpVersion
=
version
,
StatusCode
=
status
,
StatusDescription
=
desc
};
...
...
tests/Titanium.Web.Proxy.IntegrationTests/NestedProxyTests.cs
View file @
ef2019e3
...
...
@@ -61,7 +61,7 @@ namespace Titanium.Web.Proxy.IntegrationTests
{
Assert
.
AreEqual
(
"Test"
,
session
.
UserData
);
return
await
Task
.
FromResult
(
new
Models
.
ExternalProxy
()
return
await
Task
.
FromResult
(
new
Models
.
ExternalProxy
{
HostName
=
"localhost"
,
Port
=
proxy2
.
ProxyEndPoints
[
0
].
Port
...
...
tests/Titanium.Web.Proxy.IntegrationTests/Setup/TestProxyServer.cs
View file @
ef2019e3
...
...
@@ -18,7 +18,7 @@ namespace Titanium.Web.Proxy.IntegrationTests.Setup
public
TestProxyServer
(
bool
isReverseProxy
,
ProxyServer
upStreamProxy
=
null
)
{
ProxyServer
=
new
ProxyServer
();
ProxyEndPoint
explicitEndPoint
=
isReverseProxy
?
var
explicitEndPoint
=
isReverseProxy
?
(
ProxyEndPoint
)
new
TransparentProxyEndPoint
(
IPAddress
.
Any
,
0
,
true
)
:
new
ExplicitProxyEndPoint
(
IPAddress
.
Any
,
0
,
true
);
...
...
@@ -26,13 +26,13 @@ namespace Titanium.Web.Proxy.IntegrationTests.Setup
if
(
upStreamProxy
!=
null
)
{
ProxyServer
.
UpStreamHttpProxy
=
new
ExternalProxy
()
ProxyServer
.
UpStreamHttpProxy
=
new
ExternalProxy
{
HostName
=
"localhost"
,
Port
=
upStreamProxy
.
ProxyEndPoints
[
0
].
Port
};
ProxyServer
.
UpStreamHttpsProxy
=
new
ExternalProxy
()
ProxyServer
.
UpStreamHttpsProxy
=
new
ExternalProxy
{
HostName
=
"localhost"
,
Port
=
upStreamProxy
.
ProxyEndPoints
[
0
].
Port
...
...
tests/Titanium.Web.Proxy.IntegrationTests/Setup/TestServer.cs
View file @
ef2019e3
...
...
@@ -62,14 +62,9 @@ namespace Titanium.Web.Proxy.IntegrationTests.Setup
.
Get
<
IServerAddressesFeature
>()
.
Addresses
.
ToArray
();
string
httpAddress
=
addresses
[
0
];
HttpListeningPort
=
int
.
Parse
(
httpAddress
.
Split
(
':'
)[
2
]);
string
httpsAddress
=
addresses
[
1
];
HttpsListeningPort
=
int
.
Parse
(
httpsAddress
.
Split
(
':'
)[
2
]);
string
tcpAddress
=
addresses
[
2
];
TcpListeningPort
=
int
.
Parse
(
tcpAddress
.
Split
(
':'
)[
2
]);
HttpListeningPort
=
new
Uri
(
addresses
[
0
]).
Port
;
HttpsListeningPort
=
new
Uri
(
addresses
[
1
]).
Port
;
TcpListeningPort
=
new
Uri
(
addresses
[
2
]).
Port
;
}
Func
<
HttpContext
,
Task
>
requestHandler
=
null
;
...
...
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