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

Example for establishing a full connection of ohttp #38

Open
YKunDong opened this issue Nov 8, 2024 · 5 comments
Open

Example for establishing a full connection of ohttp #38

YKunDong opened this issue Nov 8, 2024 · 5 comments

Comments

@YKunDong
Copy link

YKunDong commented Nov 8, 2024

I am trying to implement the ohttp recently. Although there are project of relay, and project for client and server (https://github.com/martinthomson/ohttp), I find it difficult to make them work together.

Is it possible to show an example to establish a full connection of ohtttp, like, combining these two project?

Any suggestion or help will be appreciated.

@DanGould
Copy link
Collaborator

Hey @YKunDong thanks for your interest in OHTTP 🦸‍♂️ I agree, the resources on how to actually use OHTTP in practice are limited, and cloudflare's ohttp relay is the only implementation one I know of besides the ohttp-relay we maintain in this organization.

Please find a full example of an OHTTP client using this library to transmit its message over an ohttp relay to an ohttp gateway and finally target in this e2e test. There's a lot of other application code in there, but between e2e and this integration test suite you should be able to find what you're looking for.

I do think an actual dead-simple example is needed in the ohttp-relay crate. That would require someone write up the gateway and target servers inside an example, and call ohttp_relay to listen as a proxy in between. Let me know if you find what you're looking for in these tests.

@YKunDong
Copy link
Author

Thanks for the material provided. Having the relay running, which listens on tcp://0.0.0.0:3000 in my test. I set the proxy as following, and the connection between client - relay - gateway is successfully established.

HTTPS_PROXY=http://127.0.0.1:3000
HTTP_PROXY=http://127.0.0.1:3000

@Jonaschwe
Copy link

Hey bro @YKunDong Did you still use the client and server from https://github.com/martinthomson/ohttp in your test? I found that the server cannot identify the CONNECT request from the relay. So how do you address it?

Thank you for your assistance and support!

@YKunDong
Copy link
Author

Hi, I do use that project. But I don’t quite understand your question. Could you provide more detail?

@Jonaschwe
Copy link

Now it seems to be working perfectly again, and I'm not sure what caused that error initially. Previously, after the client sent 'CONNECT localhost:9443 HTTP/1.1' to the relay, the relay responded with 'HTTP/1.1 400 Bad Request'.

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

No branches or pull requests

3 participants