Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration/Connections: Allow HTTP tunneling #2274

Merged
merged 18 commits into from
Oct 21, 2022
Merged

Configuration/Connections: Allow HTTP tunneling #2274

merged 18 commits into from
Oct 21, 2022

Conversation

mgravell
Copy link
Collaborator

@mgravell mgravell commented Oct 17, 2022

  1. add a tunnel config option, which is used to influence connection creation
  2. implement http-tunnel as a well-known tunnel, integrated via the http: prefix on the tunnel option

tunnels are implemented as concrete subclasses of the Tunnel type; an HTTP proxy "connect" implementation is provided as a well-known version that is supported inside Parse - but custom 3rd-party tunnel implementations can also be provided via the object-model (not Parse)

A Tunnel allows:

  • overriding the EndPoint used to create Socket connections, or to suppress Socket creation entirely (by default, the same logical endpoint requested is provided back out)
  • provide a "before socket connect" twin (mirrors delegate approach, but: async; by default, do nothing)
  • provide a "before authenticate" injection point, which can a: perform additional handshake operations, and b: subvert the entire Stream (by default, nothing is done and no custom stream is returned)

@mgravell mgravell marked this pull request as draft October 17, 2022 16:14
@mgravell mgravell marked this pull request as ready for review October 21, 2022 12:41
@NickCraver NickCraver changed the title experimental hack to allow HTTP tunneling Configuration/Connections: Allow HTTP tunneling Oct 21, 2022
Copy link
Collaborator

@NickCraver NickCraver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tidied docs/APIs a bit - looking good!

@NickCraver NickCraver merged commit 4871458 into main Oct 21, 2022
@NickCraver NickCraver deleted the http-tunnel branch October 21, 2022 15:23
{
var encoding = Encoding.ASCII;
var ep = Format.ToString(endpoint);
const string Prefix = "CONNECT ", Suffix = " HTTP/1.1\r\n\r\n", ExpectedResponse = "HTTP/1.1 200 OK\r\n\r\n";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mgravell According to https://datatracker.ietf.org/doc/html/draft-luotonen-web-proxy-tunneling-01#section-3.2, the expected response should be HTTP/1.1 200 Connection established instead of HTTP/1.1 200 OK. Currently it's not possible to use a HTTP proxy that correctly implements this behavior (e.g. Squid).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created a PR: #2448

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants