Skip to content

SocketsHttpHandler only checks for 200 OK instead of 2XX for CONNECT responses #116728

Open
@MihaZupan

Description

@MihaZupan

https://www.rfc-editor.org/rfc/rfc9110.html#section-9.3.6-7

Any 2xx (Successful) response indicates that the sender (and all inbound proxies) will switch to tunnel mode immediately after the response header section

https://www.rfc-editor.org/rfc/rfc9112.html#section-6.3-2.2

Any 2xx (Successful) response to a CONNECT request implies that the connection will become a tunnel immediately after the empty line that concludes the header fields. A client MUST ignore any Content-Length or Transfer-Encoding header fields received in such a message.

else if (request.Method.IsConnect && response.StatusCode == HttpStatusCode.OK)

if (statusCode == 200 && _response.RequestMessage!.IsExtendedConnectRequest)

Just from reading the RFC, not sure we've seen a proxy that uses a different 2XX response.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions