Uh oh!
There was an error while loading. Please reload this page.
Use IndexOfAny in HttpListener.HandleAuthentication - #71137
Conversation
ghost
commented
Jun 22, 2022
Tagging subscribers to this area: @dotnet/ncl Issue DetailsJust cleaning up a manual loop that can instead be IndexOfAny.
|
wfurt
commented
Jun 22, 2022
looks related |
Uh oh!
There was an error while loading. Please reload this page.
Just cleaning up a manual loop that can instead be IndexOfAny.
fe46e14 to
fd88434Comparefd88434 to
1724769Compare| { | ||
| break; | ||
| } | ||
| index = authorizationHeader.Length; |
There was a problem hiding this comment.
This will work. But I think this is only used in the condition bellow to guard if any character was found. e.g. you can simplify that without assignment as
- if (index < authorizationHeader.Length)+ if (index >= 0)There was a problem hiding this comment.
index is also referenced later in the method.
There was a problem hiding this comment.
yeah, I missed that reading it on GH. However, without going to the first block, headerScheme should remain AuthenticationSchemes.None and we will error out without reaching the next index use. Not sure if HttpListener is worth of any more troubles.
Just cleaning up a manual loop that can instead be IndexOfAny.