Allow the user to intercept the proxy tunnel connection response
See original GitHub issueI use a HTTP proxy that sends back some information in the response headers, i.e. before sending the response back to me, it adds a header with some information in it.
When we make a HTTPS connection over an HTTP proxy, a CONNECT request is sent to the proxy. This is when the proxy responds with an additional header.
The problem is there is currently no way (as far as I know) for the user to access the headers of the CONNECT response. I believe everything happens in RealConnection.createTunnel()
where the Response is dropped and the user has no way to intercept it:
https://github.com/square/okhttp/blob/95ae0cf421c0f9c5521578781952108d1a1e1bdd/okhttp/src/main/java/okhttp3/internal/connection/RealConnection.java#L375
https://github.com/square/okhttp/blob/95ae0cf421c0f9c5521578781952108d1a1e1bdd/okhttp/src/main/java/okhttp3/internal/connection/RealConnection.java#L397
Assuming I haven’t missed an obvious way to access this Response, does this constitute a valid feature request? What do you think would be the best way to implement this?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
@invodv nope, you can’t see those headers.
When authentication is complete, my proxy server responds in the tunnel with a 200 response code and puts some headers in that response that I need to grab.
As far as I understand, it is still not possible to inspect that proxy tunnel response (response code 200) because only authentication responses (response code 407) can be inspected with
Authenticator
. Is that correct @swankjesse? Or is there a way to do that I’m not seeing?