File tree Expand file tree Collapse file tree 3 files changed +17
-3
lines changed
Nager.EmailAuthentication.UnitTest/SpfRecordParserTest/FragmentParser
Nager.EmailAuthentication Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -73,5 +73,17 @@ public void Should_Parse_Spf_With_Multiple_Ip4_And_Include()
73
73
Assert . IsNotNull ( spfDataFragment . SpfTerms ) ;
74
74
Assert . AreEqual ( 7 , spfDataFragment . SpfTerms . Length ) ;
75
75
}
76
+
77
+ [ TestMethod ]
78
+ public void Should_Parse_Spf_With_Ip4_Uppercase ( )
79
+ {
80
+ var spf = "v=spf1 IP4:155.56.66.96 IP4:155.56.66.102/31 -all" ;
81
+ var isSuccessful = SpfRecordDataFragmentParserV1 . TryParse ( spf , out var spfDataFragment ) ;
82
+
83
+ Assert . IsTrue ( isSuccessful ) ;
84
+ Assert . IsNotNull ( spfDataFragment ) ;
85
+ Assert . IsNotNull ( spfDataFragment . SpfTerms ) ;
86
+ Assert . AreEqual ( 3 , spfDataFragment . SpfTerms . Length ) ;
87
+ }
76
88
}
77
89
}
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ public static bool TryParse(
90
90
91
91
foreach ( var mechanismType in mechanismTypes )
92
92
{
93
- if ( ! value . StartsWith ( mechanismType . Key ) )
93
+ if ( ! value . StartsWith ( mechanismType . Key , StringComparison . OrdinalIgnoreCase ) )
94
94
{
95
95
continue ;
96
96
}
@@ -120,7 +120,7 @@ public static bool TryParse(
120
120
121
121
foreach ( var modifierType in modifierTypes )
122
122
{
123
- if ( ! value . StartsWith ( modifierType . Key ) )
123
+ if ( ! value . StartsWith ( modifierType . Key , StringComparison . OrdinalIgnoreCase ) )
124
124
{
125
125
continue ;
126
126
}
@@ -146,6 +146,8 @@ public static bool TryParse(
146
146
}
147
147
}
148
148
149
+ //Failure found no match
150
+
149
151
inputSpan = inputSpan [ ( nextIndexOfDelimiter + 1 ) ..] ;
150
152
}
151
153
Original file line number Diff line number Diff line change 20
20
21
21
<TargetFrameworks >net8.0;net9.0</TargetFrameworks >
22
22
23
- <Version >4.0.0 </Version >
23
+ <Version >4.0.1 </Version >
24
24
</PropertyGroup >
25
25
26
26
<ItemGroup >
You can’t perform that action at this time.
0 commit comments