Open Cyberboss opened 4 years ago
https://tools.ietf.org/html/rfc7231#section-4.1
The method token is case-sensitive... By convention, standardized methods are defined in all-uppercase US-ASCII letters.
The server is currently within spec, but we might fix this anyways. The rest of the stack treats the method as case insensitive.
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
The problem here is that the HttpMethod used to filter the Post and Put requests is parsed from uppercase values. So the place throwing this error actually sees HttpMethod.Custom
for request with POSt
method.
A way to fix this would requires extending the current condition with checking for Custom HttpMethod value and then doing a string-ordinal-ignore-case comparison with MethodText property, which I believe is quite a performance penalty on this path (although now it affects only Http1.0).
Describe the bug
Using the method
POST
triggers withoutContent-Length
orTransfer-Encoding
rejects with HTTP 411 when the methodPOSt
does notSee the validation originally introduced in this commit.
https://github.com/dotnet/aspnetcore/commit/a1c598733b4d834a8a36359f52e447e99da2f142
Examples: Method:
POST
:Method
POSt
:Second response is expected of the method running successfully. I would expect the validation performed here to be case in-sensitive. (i.e. both should reject with HTTP 411).
To Reproduce
No bandwidth to currently make a repro, please let me know if more info is required.
Project: https://github.com/tgstation/tgstation-server/tree/843c3f660e30fef8cc525c24bf2275ad668da3cf/src/Tgstation.Server.Host Dotnet Host Configuration: https://github.com/tgstation/tgstation-server/blob/843c3f660e30fef8cc525c24bf2275ad668da3cf/src/Tgstation.Server.Host/ServerFactory.cs#L62 MVC Configuration: https://github.com/tgstation/tgstation-server/blob/843c3f660e30fef8cc525c24bf2275ad668da3cf/src/Tgstation.Server.Host/Core/Application.cs#L180
Further technical details
Runtime Environment: OS Name: Windows OS Version: 10.0.18363 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\3.1.401\
Host (useful for support): Version: 3.1.7 Commit: fcfdef8d6b
.NET Core SDKs installed: 2.1.201 [C:\Program Files\dotnet\sdk] 2.1.202 [C:\Program Files\dotnet\sdk] 2.1.402 [C:\Program Files\dotnet\sdk] 2.1.502 [C:\Program Files\dotnet\sdk] 2.1.504 [C:\Program Files\dotnet\sdk] 2.1.607 [C:\Program Files\dotnet\sdk] 2.2.101 [C:\Program Files\dotnet\sdk] 3.1.100 [C:\Program Files\dotnet\sdk] 3.1.401 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download