vertx-web
vertx-web copied to clipboard
Allow custom Proxy-Authorization header when CONNECT request.
Describe the feature
Create an HttpRequest and add the Proxy-Authorization header, but the proxy server cannot get the Proxy-Authorization header value when CONNECT request. Because webClient only supports username and password authentication to connect to the proxy server.
webClient.getAbs("https://www.github.com/")
.putHeader("Proxy-Authorization", "Basic c2lnbj0yMDIwNjI5MjgwODMxODA5RDE0NjUweHh4eHh4eCZvcmRlcm5vPVpGMjAxNzIzMDE1MXh4eHh4eHgmdGltZXN0YW1wPTE0ODc3NTM1MjE=")
.send(ar -> {
if (ar.succeeded()) {
System.out.println(ar.result().bodyAsString());
} else {
ar.cause().printStackTrace();
}
});
@aomsweet the current API, allows something like:
httpRequest.authentication(new UsernamePasswordCredentials("username", "password"));
I think we should have a second method:
httpRequest.proxyAuthentication(new UsernamePasswordCredentials("username", "password"));
That uses: Proxy-Authorization as the header instead of Authorization
Using the credentials object means it will cover the Basic, 'Digest, Bearer` out of the box and with custom implementation, also the remaining IANA schemes.
The Fix is simple (add the method to the interface + implement like the existing one and switching the header name).
Are you will to make a pull request?
@pmlopes
Thanks for your suggestions and help, I will try to complete this feature and make a pull request.