Improves Kestrel to reject requests that don't conform to HTTP spec.
RFC 7230 section 5.4: "A server MUST respond with a 400 (Bad Request)
status code to any HTTP/1.1 request message that lacks a Host header
field and to any request message that contains more than one Host
header field or a Host header field with an invalid field-value."
See https://tools.ietf.org/html/rfc7230#section-5.4.
Other changes:
- update VS code settings to work better with CLI 2.0
- update tests that were subject to infinite hangs
* Rename EngineTests to LibuvTransportTests.
* Move libuv-specific tests into their own test project.
* Move LibuvOutputConsumerTests.AllocCommitCanBeCalledAfterConnectionClose to new OutputProducerTests class and rename it to WritesNoopAfterConnectionCloses.
* Remove TransportContext from TestServiceContext.
* Make KestrelTests depend on Kestrel.Core only.
* Rename Microsoft.AspNetCore.Server.Kestrel.KestrelTests to Microsoft.AspNetCore.Server.Kestrel.Core.Tests.
* Add Microsoft.AspNetCore.Server.Kestrel.Tests test project for WebHostBuilderKestrelExtensionsTests.
* Increase socket receive timeout in MaxRequestBufferSizeTests to mitigate flakiness.
* Anything using TestServer should be a functional test.
* Move out of LibuvTransportTests tests that are not specific to LibuvTransport.
- Move to RequestTests:
- Http11 (rename to Http11KeptAliveByDefault)
- Http10ContentLength (rename to Http10NotKeptAliveByDefault)
- Http10KeepAlive
- Http10KeepAliveNotUsedIfResponseContentLengthNotSet (rename to Http10KeepAliveNotHonoredIfResponseContentLengthNotSet)
- Http10ContentLengthKeepAlive (rename to Http10KeepAliveHonoredIfResponseContentLengthSet)
- Expect100ContinueForBody (rename to Expect100ContinueHonored)
- ZeroContentLengthAssumedOnNonKeepAliveRequestsWithoutContentLengthOrTransferEncodingHeader
- ConnectionClosesWhenFinReceivedBeforeRequestCompletes (test was actually not marked as Theory, and was incorrect)
- RequestsCanBeAbortedMidRead
- RequestHeadersAreResetOnEachRequest
- UpgradeRequestIsNotKeptAliveOrChunked
- HeadersAndStreamsAreReused (rename to HeadersAndStreamsAreReusedAcrossRequests)
- Move to ResponseTests:
- Http10RequestReceivesHttp11Response (rename to Http11ResponseSentToHttp10Request)
- ZeroContentLengthSetAutomaticallyAfterNoWrites
- ZeroContentLengthSetAutomaticallyForNonKeepAliveRequests
- ZeroContentLengthNotSetAutomaticallyForHeadRequests
- ZeroContentLengthNotSetAutomaticallyForCertainStatusCodes
- ConnectionClosedAfter101Response
- ThrowingResultsIn500Response
- ThrowingAfterWritingKillsConnection
- ThrowingAfterPartialWriteKillsConnection
- ThrowingInOnStartingResultsInFailedWritesAnd500Response
- ThrowingInOnCompletedIsLoggedAndClosesConnection
- FailedWritesResultInAbortedRequest
- NoErrorsLoggedWhenServerEndsConnectionBeforeClient
- NoResponseSentWhenConnectionIsClosedByServerBeforeClientFinishesSendingRequest
- ResponseHeadersAreResetOnEachRequest
- OnStartingCallbacksAreCalledInLastInFirstOutOrder
- OnCompletedCallbacksAreCalledInLastInFirstOutOrder
- Remove:
- RePathEscapeTests (theory data to HttpParsingData)
- ReDisconnectingClient (what was that testing?)
- Put everything in the libuv transport package under `Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.*` namespaces.
- Move stuff in Transport.Libuv/Internal/Http and Transport.Libuv/Internal/Infrastructure to Transport.Libuv/Internal (keep the Networking directory for the libuv wrappers).
- Add `Libuv` prefix to most libuv internal classes.
- Rename `KestrelEngine` to `LibuvTransport`.
- Rename `SocketOutputConsumer` to `LibuvOutputConsumer`.
- Rename `SocketOutputProducer` to `OutputProducer`.
- Fix namespaces in `Microsoft.AspNetCore.Server.Kestrel.Core.`
Improves compliance with RFC 7230 on the expected handling of requests
that have URI or asterisk in the request target.
This means rejecting asterisk requests that are not OPTIONS and rejecting
authority-form requests taht are not CONNECT.
This also means the server will handle the path and query on targets
with absolute URIs as request-targets.
* Made changes to TakeSingleHeader
- Remove state machine and just parse in place
- Inline OnHeader into TakeSingleHeader
- Use IndexOfVectorized instead of custom indexof
- Normalize header whitespace error
- Combine IndexOf and IndexOfAny into a single IndexOfNameEnd call