On Thu, 2022-02-17 at 15:21 +0000, Jhonny Knaak de Vargas wrote:
> 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 <[email protected]>
> > Subject: Proxy authorization not being sent.
> > Date: 17 February 2022 at 15:13:53 GMT
> > To: [email protected]
> > 
> > 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?
> > 

HttpClient does not use preemptive authentication by default (which is
by design). It have got to force it to do. 

It is however recommended to use auth state caching instead.


> > Is there any difference between setting the proxy at the HttpClient
> > level from the one available at the RequestConfig?
> > 

No, there is not.

Oleg

> > 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);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to