Kestrel rejects requests with non standard ASCII characters
See original GitHub issueDescription
When sending a request to Kestrel web server with header value which has non standard ASCII characters, the server rejects the response with 400 Bad request: malformed headers.
Reproduction steps
Steps to reproduce the behavior:
- create a new web app: dotnet new web
- run the application as console (not IISExpress)
- send a request (using Fiddler/postman/wget) with non standard ASCII header value
This is reproducible with 2.1.9, 2.1.10 and 2.2.4
wget -Uri http://localhost:5000 -Headers @{"test"="Tk'emlúps te Secwépemc"}
Expected behavior
The request is accepted and the header value is accessible in the Request.Headers
Additional context
.NET Core SDK (reflecting any global.json): Version: 2.2.203 Commit: e5bab63eca
Runtime Environment: OS Name: Windows OS Version: 10.0.17763 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\2.2.203\
Host (useful for support): Version: 2.2.4 Commit: f95848e524
.NET Core SDKs installed: 2.1.505 [C:\Program Files\dotnet\sdk] 2.1.603 [C:\Program Files\dotnet\sdk] 2.2.106 [C:\Program Files\dotnet\sdk] 2.2.203 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Issue Analytics
- State:
- Created 4 years ago
- Comments:14 (8 by maintainers)
Ok, thanks, I’ll get working on that. It would be nice if the server was a little more lenient in this, or at least allows interjection. This exact set up is working with IIS in proc mode as well as other web servers. Unfortunately Kesterl is the only container hosting option ATM.
Closing as per the discussion. Kestrel requires the use of UTF-8 or ASCII, ANSI extensions are not supported. Either use a client that sends UTF-8, or use a reverse proxy that transcodes this.