You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by brownie74 <pb...@hotmail.com> on 2010/02/15 12:40:35 UTC

Downloading binaries through NTLM proxy

Hi,

I'm downloading binaries (jar files) from a website using HttpClient 4.0
with JCIFS for NTLM support. I'm going through an NTLM proxy using HTTP/1.1.

90% of the files download OK. The remainder are getting chopped off at 13K -
and this is the problem.

I am getting an EOF on the InputStream at 13K. No error code in the HTTP
response. Everything looks fine, except the jars are getting chopped at 13K.
When I use my browser to download the jars (also through same proxy), they
download in their entirety, OK.

These are not the largest jars that I am downloading either. Much much
larger ones are downloading with no issues. Much smaller ones are also
downloading fine.

I've also tried HTTP/1.0 in order to switch off chunked encoding. It made no
difference.

Here is the sort of code i'm doing to process the response:

      DefaultHttpClient httpclient = new DefaultHttpClient();

      ...

      HttpGet httpGet = makeURL();
      HttpResponse response = httpclient.execute(targetHost, httpGet);
      HttpEntity entity = response.getEntity();

      if (entity != null)
      {
         entity.consumeContent();
      }

      response = httpclient.execute(targetHost, httpGet);
      entity = response.getEntity();

      if(response.getStatusLine().getStatusCode()!=HttpStatus.SC_OK)
      {
    	  throw new
DownloadException(response.getStatusLine().getStatusCode());
      }

      if (entity != null)
      {
    	 File output = new File(directory, filename);
         FileOutputStream fos = new FileOutputStream(output);
         entity.writeTo(fos);
         fos.close();
      }

      httpclient.getConnectionManager().shutdown();


I've also tried removing the entity.writeTo and doing my own loop on
entity.getContent() ...
this made no difference.

This is reproducable.

Anybody seen anything similar?

Thanks,

brownie74



-- 
View this message in context: http://old.nabble.com/Downloading-binaries-through-NTLM-proxy-tp27592543p27592543.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org