Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It's your AuthScope:</p> <pre><code>// You set proxyServer here vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv credsProvider.setCredentials(new AuthScope(proxyServer, proxyPort), new UsernamePasswordCredentials(proxyUser, proxyPassword)); httpClient.setCredentialsProvider(credsProvider); // But here you are looking for the indexof https to determine if it is an SSL proxy // is the String returned from getProxyServer() above a URL or a host name? HttpHost proxy = new HttpHost(proxyServer, proxyPort, (proxyServer.indexOf("https") != 0) ? "http" : "https"); httpClient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy); </code></pre> <p>Buried in my comment above - is the string returned by getProxyServer() a URL or a hostname?</p> <p><strong>EDIT</strong></p> <p>I think I have figured out what is going on. Basic Auth has to be sent on every request for it to work. If you are making multiple executions you are going to need to have some mechanism to cache the authentication data. By executing the client in the fashion you are right now, there is no "context" that can store that as one is created on every request.</p> <p>The other item to look at is the <a href="http://hc.apache.org/httpcomponents-client-ga/tutorial/html/authentication.html" rel="nofollow">client tutorial</a> sections 4.7 and 4.8. If you are looking to completely eliminate the 407 error followed by a request with the BASIC authentication, then make sure you read section 4.8.</p> <p>Pay very close attention to the "localcontext" variable they have defined as this acts as a state container for your client.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload