@@ -11,7 +11,17 @@ public class UtilityTests
11
11
{
12
12
[ Theory ]
13
13
[ InlineData ( "Location: mysql://host.example.com:1234/user=user@host" , "host.example.com" , 1234 , "user@host" ) ]
14
+ [ InlineData ( "Location: mysql://host.example.com:1234/user=user@host\n " , "host.example.com" , 1234 , "user@host" ) ]
14
15
[ InlineData ( "Location: mysql://host.example.com:1234/user=user@host&ttl=60" , "host.example.com" , 1234 , "user@host" ) ]
16
+ [ InlineData ( "Location: mysql://host.example.com:1234/user=user@host&ttl=60\n " , "host.example.com" , 1234 , "user@host" ) ]
17
+ [ InlineData ( "Location: mysql://[host.example.com]:1234/?user=abcd" , "host.example.com" , 1234 , "abcd" ) ]
18
+ [ InlineData ( "Location: mysql://[host.example.com]:1234/?user=abcd\n " , "host.example.com" , 1234 , "abcd" ) ]
19
+ [ InlineData ( "Location: mysql://[host.example.com]:1234/?user=abcd&ttl=60" , "host.example.com" , 1234 , "abcd" ) ]
20
+ [ InlineData ( "Location: mysql://[host.example.com]:1234/?user=abcd&ttl=60\n " , "host.example.com" , 1234 , "abcd" ) ]
21
+ [ InlineData ( "Location: mysql://[2001:4860:4860::8888]:1234/?user=abcd" , "2001:4860:4860::8888" , 1234 , "abcd" ) ]
22
+ [ InlineData ( "Location: mysql://[2001:4860:4860::8888]:1234/?user=abcd\n " , "2001:4860:4860::8888" , 1234 , "abcd" ) ]
23
+ [ InlineData ( "Location: mysql://[2001:4860:4860::8888]:1234/?user=abcd&ttl=60" , "2001:4860:4860::8888" , 1234 , "abcd" ) ]
24
+ [ InlineData ( "Location: mysql://[2001:4860:4860::8888]:1234/?user=abcd&ttl=60\n " , "2001:4860:4860::8888" , 1234 , "abcd" ) ]
15
25
public void ParseRedirectionHeader ( string input , string expectedHost , int expectedPort , string expectedUser )
16
26
{
17
27
Assert . True ( Utility . TryParseRedirectionHeader ( input , out var host , out var port , out var user ) ) ;
@@ -24,12 +34,21 @@ public void ParseRedirectionHeader(string input, string expectedHost, int expect
24
34
[ InlineData ( "" ) ]
25
35
[ InlineData ( "Location: mysql" ) ]
26
36
[ InlineData ( "Location: mysql://host.example.com" ) ]
37
+ [ InlineData ( "Location: mysql://host.example.com:" ) ]
38
+ [ InlineData ( "Location: mysql://[host.example.com" ) ]
39
+ [ InlineData ( "Location: mysql://[host.example.com]" ) ]
40
+ [ InlineData ( "Location: mysql://[host.example.com]:" ) ]
27
41
[ InlineData ( "Location: mysql://host.example.com:123" ) ]
28
42
[ InlineData ( "Location: mysql://host.example.com:123/" ) ]
43
+ [ InlineData ( "Location: mysql://[host.example.com]:123" ) ]
44
+ [ InlineData ( "Location: mysql://[host.example.com]:123/" ) ]
29
45
[ InlineData ( "Location: mysql://host.example.com:/user=" ) ]
46
+ [ InlineData ( "Location: mysql://host.example.com:123/user=" ) ]
47
+ [ InlineData ( "Location: mysql://[host.example.com]:123/?user=" ) ]
30
48
[ InlineData ( "Location: mysql://host.example.com:/user=user@host" ) ]
31
49
[ InlineData ( "Location: mysql://host.example.com:-1/user=user@host" ) ]
32
50
[ InlineData ( "Location: mysql://host.example.com:0/user=user@host" ) ]
51
+ [ InlineData ( "Location: mysql://[host.example.com]:123/user=abcd" ) ]
33
52
public void ParseRedirectionHeaderFails ( string input )
34
53
{
35
54
Assert . False ( Utility . TryParseRedirectionHeader ( input , out _ , out _ , out _ ) ) ;
0 commit comments