Skip to content
This repository was archived by the owner on Jul 9, 2023. It is now read-only.
This repository was archived by the owner on Jul 9, 2023. It is now read-only.

Http CONNECT fails due to fragmented client stream #638

@gt5700

Description

@gt5700

I have a situation where the Proxy is used by a process on the same host, and is listening on local loopback.

I have found the proxy sometimes fails for SSL connections.

I am using explicit clients, and the WebProxy in not decrypting SSL.

Looking deeper, I found that the initial "CONNECT" method is not being received by the WebProxy in a single "request". Only the first byte (the letter 'C') is being read. This may be because the Nagle algorithm is disabled for local TCP traffic....but I can't confirm if this is the root cause of the fragmentation.

The HttpHelper.cs code has a method that seems to assume the entire "CONNECT" string will be available in the receive buffer, but since there is only 1 byte available, it fails to detect the http CONNECT method.

I have hacked in a temporary work around to get my system up and going. I have modified the "IsConnectMethod" in HttpHelper.cs to only check for a single character "C". This appears to work, but its obviously not a permanent fix. I'm lucky that CONNECT appears to be the only http method that starts with a C.

I think the code needs to be updated to read in at least 10 bytes from the incoming client stream before it attempts to test for the "CONNECT" string, but I don't know what other impacts that might have. I mentioned 10 bytes because I can see 10 bytes is used in the "startsWith" method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions