Skip to content

SocketsHttpHandler should proactively handle EOF from server on idle HTTP/1.1 connections #60729

@geoffkizer

Description

@geoffkizer

From RFC 2616:

   When a client or server wishes to time-out it SHOULD issue a graceful
   close on the transport connection. Clients and servers SHOULD both
   constantly watch for the other side of the transport close, and
   respond to it as appropriate. If a client or server does not detect
   the other side's close promptly it could cause unnecessary resource
   drain on the network.

SocketsHttpHandler does not do this currently. We do issue a "read-ahead" read on idle connections, and we do close the connection during scavenging if we detect (via the read-ahead) that the server has closed the connection. But scavenging only happens periodically.

We could instead close the connection immediately when the read-ahead completes (and the connection is not in use). This seems more in line with the spirit of the RFC above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.Net.HttpenhancementProduct code improvement that does NOT require public API changes/additionstenet-performancePerformance related issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions