HttpClientHandler hanging in certain cases
------------------------------------------
Key: IVY-930
URL: https://issues.apache.org/jira/browse/IVY-930
Project: Ivy
Issue Type: Bug
Affects Versions: 2.0-RC1
Reporter: Scott Hebert
Priority: Blocker
Using Commons HttpClient and an URL Resolver, it is possible for the
HttpClientHandler to hang.
The following seems to correct the problem:
{code:java}
public InputStream openStream(URL url) throws IOException {
GetMethod get = doGet(url);
if (!checkStatusCode(url, get)) {
// Make sure the number of connections does not get exhausted
get.releaseConnection();
//
throw new IOException(
"The HTTP response code for " + url + " did not indicate a
success."
+ " See log for more detail.");
}
return new GETInputStream(get);
}
public void download(URL src, File dest, CopyProgressListener l) throws
IOException {
GetMethod get = doGet(src);
// We can only figure the content we got is want we want if the status
is success.
if (!checkStatusCode(src, get)) {
// Make sure the number of connections does not get exhausted
get.releaseConnection();
//
throw new IOException(
"The HTTP response code for " + src + " did not indicate a
success."
+ " See log for more detail.");
}
FileUtil.copy(get.getResponseBodyAsStream(), dest, l);
dest.setLastModified(getLastModified(get));
get.releaseConnection();
}
{code}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.