Uploaded image for project: 'Ivy'
  1. Ivy
  2. IVY-930

HttpClientHandler hanging in certain cases

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • 2.0-RC1
    • 2.0-RC2
    • None
    • None

    Description

      Using Commons HttpClient and an URL Resolver, it is possible for the HttpClientHandler to hang.

      The following seems to correct the problem:

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

      Attachments

        Issue Links

          Activity

            People

              maartenc Maarten Coene
              scoheb Scott Hebert
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: