Description
As stated in the official Microsoft documentation, the HttpSendHttpResponse function produces undefined results when combining the flags HTTP_SEND_RESPONSE_FLAG_DISCONNECT and HTTP_SEND_RESPONSE_FLAG_MORE_DATA in a single call (see https://msdn.microsoft.com/en-us/library/windows/desktop/aa364499(v=vs.85).aspx). This makes absolutely sense. However, in HttpSysServer (2.0.0 and earlier) when you set "Connection: close" in the response headers, the HttpSendHttpResponse function gets called (within Response.SendHeaders) with both of these flags set and afterwards when the body is going to be sent, there are no flags set. Instead the HTTP_SEND_RESPONSE_FLAG_DISCONNECT flag should have been set, so HTTP.SYS closes the connection. To reproduce the behavior mentioned, you can debug the test Microsoft.AspNetCore.Server.HttpSys.ResponseHeaderTests.ResponseHeaders_ServerSendsConnectionClose_Closed.