Skip to content

Commit b2731d6

Browse files
benaadamsJamesNK
authored andcommitted
.IndexOf(...) >= 0 to .Contains(...) (#4688)
1 parent 4a9a96c commit b2731d6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Servers/Kestrel/Core/src/Internal/Http/HttpParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ private unsafe void TakeSingleHeader(byte* headerLine, int length, TRequestHandl
394394

395395
// Check for CR in value
396396
var valueBuffer = new Span<byte>(headerLine + valueStart, valueEnd - valueStart + 1);
397-
if (valueBuffer.IndexOf(ByteCR) >= 0)
397+
if (valueBuffer.Contains(ByteCR))
398398
{
399399
RejectRequestHeader(headerLine, length);
400400
}

src/Servers/Kestrel/Core/src/Internal/Http2/Http2Stream.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ private bool TryValidatePath(ReadOnlySpan<char> pathSegment)
290290
return false;
291291
}
292292

293-
var pathEncoded = pathSegment.IndexOf('%') >= 0;
293+
var pathEncoded = pathSegment.Contains('%');
294294

295295
// Compare with Http1Connection.OnOriginFormTarget
296296

0 commit comments

Comments
 (0)