dotnet/aspnetcore

Stop using InvalidOperationExceptions to signal invalid ASCII during parsing

Open

#4.736 geöffnet am 19. Juli 2018

Auf GitHub ansehen
 (4 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)C# (10.653 Forks)batch import
affected-very-fewarea-networkingenhancementfeature-kestrelhelp wantedseverity-nice-to-have

Repository-Metriken

Stars
 (37.933 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 16T 9h) (258 gemergte PRs in 30 T)

Beschreibung

GetAsciiStringNonNullCharacters() currently throws an InvalidOperationException fo invalid or chacters, and the parsing logic catches these InvalidOperationExceptions at various layers to handle the bad request appropriately.

Ideally we could switch to calling a TryGetAsciiStringNonNullCharacters method, but if propagating failure down the stack proves too difficult, we should at least move to a custom exception type so we don't end up obscuring real product bugs by inadvertently swallowing InvalidOperationExceptions thrown by other methods.

Contributor Guide