Skip to content

Connection is kept alive when "Connection: close" is set in response headers #5881

Closed
@tschuegge

Description

@tschuegge

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsbugThis issue describes a behavior which is not expected - a bug.feature-httpsys

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions