-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
HTTP/2 CONNECT #8202
Comments
Is there a specific reason you are using the low level HTTP/2 Client? and not the higher level HttpClient with HTTP/2 support? |
Because I am following the ConnectTunnelTest.java example. Is it possible to use the higher level one? Also, I might want to do CONNECT UDP, if possible? |
@gsusanto the way it typically works is that the client issues a CONNECT to the proxy and the proxy opens a connection to the server. Typically the client wants to send a request to the server (through the tunnel) and the request is typically encrypted with TLS, so you would have to do that -- but that's a lot of work when using the low level HTTP/2 APIs. Fortunately we have done the work already and it's available out of the box in the high level Assuming that the proxy is non-secure and you want to send a request to
Note how the client uses the stream established with the proxy and uses DATA frames to wrap anything that wants to send to the server. The proxy unwraps the DATA frame and sends the body to the server. At the time we implemented this, not many proxies were able to support HTTP/2; now things may have changed. I don't know what do you mean by "CONNECT UDP", can you clarify? |
This issue has been automatically marked as stale because it has been a |
Closing as answered. |
Jetty version: 10.0.10
Java version: JavaSE-11 (JRE [17.0.3])
Question
HTTP/2 CONNECT method
This issue has actually been resolved here. I have been trying to use HTTP/2 CONNECT from the client side to connect to a proxy, then try to do a GET request through the proxy to google.com:433.
What I am trying to acomplish can be done by doing a curl command:
curl -x --http2 <proxy-ip>:<proxy-port> https://www.google.com
. This will return me a page from google.com/What I think this command does (by doing -v) is:
I might not get that detailed sequence of events right, but what I am trying to accomplish is build a tunnel using HTTP/2 CONNECT to communicate with a server through a proxy. The proxy I am using is h2o server.
I am trying to do the same thing using Jetty. The current code that I have written is:
Until this point, I have successfully sent a HTTP/2 CONNECT request to the proxy, get a response with 200 status code and no body, and openned a stream between my client and the proxy, and subsequently to google.com:443 server.
How do I actually proceed from here? Should I:
GET /
request (in the hope that I get a response from Google through the proxy), specifying the stream id of the stream I have already openned in the header? --> I tried this and the proxy sends back a 404 error probably because it does not service GET at its own/
endpointByteBuffer.wrap(headersFrame.toString()))
? And since stream is a bidirectional flow of frames, how can the client, say, print out the response from the proxy (and subsequently from the server)?I might not get the current code right. Even my understanding about HTTP/2 Connect might not been entirely accurate. But thank you in advance for the help!
The text was updated successfully, but these errors were encountered: