All,
Using HttpClient 3.0.1, I'm getting the following stack trace when
trying an SSL get request through an NTLM proxy:
Exception in thread "main" java.lang.IllegalStateException: Connection
is not open
at
org.apache.commons.httpclient.HttpConnection.assertOpen(HttpConnection.j
ava:1269)
at
org.apache.commons.httpclient.HttpConnection.setSocketTimeout(HttpConnec
tion.java:641)
at
org.apache.commons.httpclient.HttpMethodDirector.applyConnectionParams(H
ttpMethodDirector.java:350)
at
org.apache.commons.httpclient.HttpMethodDirector.executeConnect(HttpMeth
odDirector.java:481)
at
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMe
thodDirector.java:386)
at
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMetho
dDirector.java:168)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:3
93)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:3
24)
at
com.rabobank.upload.HttpClientExample.getProxySsl(HttpClientExample.java
:176)
at
com.rabobank.upload.HttpClientExample.main(HttpClientExample.java:30)
This is identical to the following mail archive item:
http://mail-archives.apache.org/mod_mbox/jakarta-httpclient-user/200505.
mbox/[EMAIL PROTECTED]
Which was supposed to be addressed by this patch (and is definitely in
the 3.0.1 source):
http://issues.apache.org/bugzilla/show_bug.cgi?id=34740
Source code is:
public void getProxySsl() {
HttpClient httpclient = new HttpClient();
httpclient.getHostConfiguration().setProxy("proxyserver", 8080);
httpclient.getParams().setAuthenticationPreemptive(true);
httpclient.getState().setProxyCredentials(
AuthScope.ANY,
new NTCredentials("fred", "mypassword", "", "DOMAIN1"));
GetMethod httpget = new GetMethod("https://www.verisign.com");
try {
// this results in:
// Exception in thread "main"
java.lang.IllegalStateException: Connection is not open
int statusCode = httpclient.executeMethod(httpget);
if (statusCode != HttpStatus.SC_OK) {
System.err.println("Method failed: " +
httpget.getStatusLine());
}
String strOutput = httpget.getResponseBodyAsString();
System.out.println(httpget.getStatusLine());
System.out.println(strOutput);
}
catch (HttpException e) {
e.printStackTrace();
}
catch (IOException e) {
e.printStackTrace();
}
finally {
httpget.releaseConnection();
}
}
When I replace https://www.verisign.com with any http url, it works
fine. Any ideas?
Thanks in advance,
Fred
_____________________________________________________________
This email (including any attachments to it) is confidential, legally
privileged, subject to copyright and is sent for the personal attention of the
intended recipient only. If you have received this email in error, please
advise us immediately and delete it. You are notified that disclosing, copying,
distributing or taking any action in reliance on the contents of this
information is strictly prohibited. Although we have taken reasonable
precautions to ensure no viruses are present in this email, we cannot accept
responsibility for any loss or damage arising from the viruses in this email or
attachments. We exclude any liability for the content of this email, or for the
consequences of any actions taken on the basis of the information provided in
this email or its attachments, unless that information is subsequently
confirmed in writing. If this email contains an offer, that should be
considered as an invitation to treat.
_____________________________________________________________