Skip to content

Connection Close Behavior on HTTP1.0 Requests #56223

@xiaozhao018

Description

@xiaozhao018

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

if (requestVersion <= Constants.V1_0 // Http.Sys does not support "Keep-Alive: true" or "Connection: Keep-Alive"

if (requestVersion <= Constants.V1_0 // Http.Sys does not support "Keep-Alive: true" or "Connection: Keep-Alive"

The comment in the code indicates http.sys does not support "Connection: Keep-Alive". However, we certainly see that header got to work in IIS, so the comment might be wrong. Thus, we want to change the behavior so that it aligns with IIS.

The reason we want to change this behavior on the server-side is that we don't want to keep closing connections on every request for http1.0, that will increase TLS costs on our end for subsequent re-connects. Given http1.0 traffic is not trivial amount.

Expected Behavior

If the request is http1.0 AND the request contains "Connection: keep-alive", we also send the "Connection: keep-alive" header in the response.

Steps To Reproduce

Send http 1.0 request using curl to ASP.NET endpoint with "Connection: keep-alive" header

curl.exe --http1.0 -i <ASP.NET endpoint uri> -H "Connection: keep-alive"

From the response, you'll see the "Connection: close" header.

Exceptions (if any)

No response

.NET Version

6.0.131

Anything else?

No response

Metadata

Metadata

Labels

area-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsfeature-httpsys

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions