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

docs(server): http_proxy example #1835

Closed
wants to merge 2 commits into from

Conversation

euclidr
Copy link
Contributor

@euclidr euclidr commented Jun 27, 2019

I added a CONNECT tunneling example #1759

// ```
//
// When HTTP method is CONNECT we should return an empty body
// then we can eventually upgrade the connection and talk a new protocal.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// then we can eventually upgrade the connection and talk a new protocal.
// then we can eventually upgrade the connection and talk a new protocol.

Copy link
Contributor

@ahmedcharles ahmedcharles left a comment

Choose a reason for hiding this comment

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

Looks good to me. Very educational.

@euclidr
Copy link
Contributor Author

euclidr commented Aug 25, 2019

@ahmedcharles there have been a lot of change since this example is written. split method of AsyncRead AsyncWrite in tokio-io is temporary removed, which make it hard to implement tunnel.

I found tokio has plan to get split back, see the issue. I will fix this example once the split is back. Or are there better ways to implement tunnel?

#1884

@ahmedcharles
Copy link
Contributor

See: https://github.com/ahmedcharles/hyper/commit/cc37f87d6ebfd5a3db618852fc1788b2c88db515

It's hacky but it works. (Though, h2 doesn't build at the moment, so when I rebased, it failed to build.)

@euclidr
Copy link
Contributor Author

euclidr commented Aug 25, 2019

@ahmedcharles thanks, it works! I changed your code a little, use tokio_tcp to use tokio_net::tcp, the example runs correctly.

@ahmedcharles
Copy link
Contributor

No problem.

@seanmonstar
Copy link
Member

Thanks for doing this, and sorry for taking so long, I've rebased and merged this into master manually!

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.

3 participants