Just sending this email again because I was not subscribed the first time I 
sent.
Not sure if this has any kind of impact.

> Begin forwarded message:
> 
> From: Jhonny Knaak de Vargas <jho...@evervault.com>
> Subject: Proxy authorization not being sent.
> Date: 17 February 2022 at 15:13:53 GMT
> To: httpclient-users@hc.apache.org
> 
> I was not able to send the proxy user and password to the proxy using the 
> code at the bottom of this email.
> I got some questions,
> 
> Does the library send a first connection without a user/pass attempting to 
> get back a PROXY-AUTHENTICATE BASIC for example?
> 
> Is there any difference between setting the proxy at the HttpClient level 
> from the one available at the RequestConfig?
> 
> Thanks.
> Jhonny
> 
> 
> code used:
> 
> var credsProvider = new BasicCredentialsProvider();
> 
> credsProvider.setCredentials(new AuthScope("localhost", 8080),
>         new UsernamePasswordCredentials("someUser", "somePass"));
> 
> var proxyHost = new HttpHost("localhost", 8080, "http");
> 
> var httpclient = 
> HttpClients.custom().setDefaultCredentialsProvider(credsProvider)
>         .setSSLContext(new SSLContextBuilder().loadTrustMaterial(null, 
> TrustAllStrategy.INSTANCE).build())
>         .setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE)
>         //.setProxy(proxyHost)
>         .build();
> 
> //Create the target and proxy hosts
> var targetHost = new HttpHost("enssc1aqsjv0g.x.pipedream.net 
> <http://enssc1aqsjv0g.x.pipedream.net/>", 443, "https");
> 
> //Setting the proxy
> var config = RequestConfig.custom().setProxy(proxyHost).build();
> 
> //Create the HttpGet request object
> var httpget = new HttpGet("/");
> 
> //Setting the config to the request
> httpget.setConfig(config);
> 
> //Printing the status line
> var response = httpclient.execute(targetHost, httpget);
> 
> var result = response.getStatusLine();
> 
> assertNotNull(result);

Reply via email to