[httpcomponents-client] 01/04: Imported Upstream version 4.3.3

Emmanuel Bourg ebourg-guest at moszumanska.debian.org
Sat Mar 8 13:00:12 UTC 2014


This is an automated email from the git hooks/post-receive script.

ebourg-guest pushed a commit to branch master
in repository httpcomponents-client.

commit f3cac179dcafaafb6a3accba4b17a04023424aa2
Author: Emmanuel Bourg <ebourg at apache.org>
Date:   Sat Mar 8 10:41:18 2014 +0100

    Imported Upstream version 4.3.3
---
 RELEASE_NOTES.txt                                  |  33 +++++-
 fluent-hc/pom.xml                                  |   2 +-
 .../http/client/fluent/FluentResponseHandling.java |   4 +-
 .../org/apache/http/client/fluent/Content.java     |   4 +-
 .../org/apache/http/client/fluent/Executor.java    |   7 +-
 .../client/fluent/InternalByteArrayEntity.java     | 100 ++++++++++++++++++
 .../{Content.java => InternalFileEntity.java}      |  66 ++++++------
 .../http/client/fluent/InternalHttpRequest.java    | 113 +++++++++++++++++++++
 .../client/fluent/InternalInputStreamEntity.java   |  96 +++++++++++++++++
 .../org/apache/http/client/fluent/Request.java     |  78 ++++++++------
 .../org/apache/http/client/fluent/Response.java    |  14 ++-
 httpclient-cache/pom.xml                           |   2 +-
 .../http/impl/client/cache/CachingHttpClient.java  |  11 +-
 .../apache/http/impl/client/cache/CachingExec.java |   7 +-
 .../org/apache/http/impl/client/cache/IOUtils.java |  13 +++
 .../impl/client/cache/ManagedHttpCacheStorage.java |  42 ++++----
 .../client/cache/ResponseProtocolCompliance.java   |   3 +-
 .../impl/client/cache/ResponseProxyHandler.java    |   3 +-
 .../http/impl/client/cache/TestBasicHttpCache.java |   3 +-
 .../http/impl/client/cache/TestCachingExec.java    |   2 +-
 .../client/cache/TestHttpCacheJiraNumber1147.java  |   7 +-
 ...stStaleWhileRevalidationReleasesConnection.java |   8 +-
 httpclient-osgi/pom.xml                            |   2 +-
 httpclient/pom.xml                                 |   2 +-
 .../http/impl/client/DefaultRequestDirector.java   |  24 ++++-
 .../entity/LazyDecompressingInputStream.java       |  44 ++++++--
 .../client/SystemDefaultCredentialsProvider.java   |  31 +++++-
 .../impl/conn/HttpClientConnectionOperator.java    |   6 +-
 .../apache/http/impl/conn/LoggingInputStream.java  |  70 +++++++++----
 .../apache/http/impl/conn/LoggingOutputStream.java |  39 +++++--
 .../main/java/org/apache/http/impl/conn/Wire.java  |   8 --
 .../org/apache/http/impl/execchain/RetryExec.java  |  18 +++-
 .../execchain/ServiceUnavailableRetryExec.java     |   3 +
 httpmime/pom.xml                                   |   2 +-
 .../org/apache/http/entity/mime/FormBodyPart.java  |  24 +++--
 .../apache/http/entity/mime/TestMultipartForm.java |  34 +++++++
 pom.xml                                            |  11 +-
 src/docbkx/caching.xml                             |   2 +-
 src/docbkx/fundamentals.xml                        |   3 +-
 39 files changed, 742 insertions(+), 199 deletions(-)

diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 437a5b8..96b3faa 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -1,7 +1,38 @@
+Release 4.3.3
+-------------------
+
+HttpClient 4.3.3 (GA) is a bug fix release that fixes a regression introduced by the previous
+release causing a significant performance degradation in compressed content processing.
+
+Users of HttpClient 4.3 are encouraged to upgrade.
+
+Changelog:
+-------------------
+
+* [HTTPCLIENT-1466] FileBodyPart#generateContentType() ignores custom ContentType values.
+  Contributed by Oleg Kalnichevski <olegk at apache.org>
+
+* [HTTPCLIENT-1453] Thread safety regression in PoolingHttpClientConnectionManager
+  #closeExpiredConnections that can lead to ConcurrentModificationException. 
+  Contributed by Oleg Kalnichevski <olegk at apache.org>
+
+* [HTTPCLIENT-1461] fixed performance degradation in compressed content processing
+  introduced by HTTPCLIENT-1432.
+  Contributed by Oleg Kalnichevski <olegk at apache.org>
+
+* [HTTPCLIENT-1457] Incorrect handling of Windows (NT) credentials by
+  SystemDefaultCredentialsProvider.
+  Contributed by Oleg Kalnichevski <olegk at apache.org>
+
+* [HTTPCLIENT-1456] Request retrial after status 503 causes ClientProtocolException.
+  Contributed by Oleg Kalnichevski <olegk at apache.org>
+
+
+
 Release 4.3.2
 -------------------
 
-HttpClient 4.3.2 (GA) is a maintenance release that devliers a number of improvements 
+HttpClient 4.3.2 (GA) is a maintenance release that delivers a number of improvements 
 as well as bug fixes for issues reported since 4.3.1 release. SNI support for 
 Oracle JRE 1.7+ is being among the most notable improvements. 
 
diff --git a/fluent-hc/pom.xml b/fluent-hc/pom.xml
index 50c042e..3a1b135 100644
--- a/fluent-hc/pom.xml
+++ b/fluent-hc/pom.xml
@@ -28,7 +28,7 @@
   <parent>
     <groupId>org.apache.httpcomponents</groupId>
     <artifactId>httpcomponents-client</artifactId>
-    <version>4.3.2</version>
+    <version>4.3.3</version>
   </parent>
   <artifactId>fluent-hc</artifactId>
   <name>Fluent API for Apache HttpClient</name>
diff --git a/fluent-hc/src/examples/org/apache/http/client/fluent/FluentResponseHandling.java b/fluent-hc/src/examples/org/apache/http/client/fluent/FluentResponseHandling.java
index 4427ca4..602fb87 100644
--- a/fluent-hc/src/examples/org/apache/http/client/fluent/FluentResponseHandling.java
+++ b/fluent-hc/src/examples/org/apache/http/client/fluent/FluentResponseHandling.java
@@ -33,6 +33,7 @@ import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 
+import org.apache.http.Consts;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpResponse;
 import org.apache.http.StatusLine;
@@ -40,7 +41,6 @@ import org.apache.http.client.ClientProtocolException;
 import org.apache.http.client.HttpResponseException;
 import org.apache.http.client.ResponseHandler;
 import org.apache.http.entity.ContentType;
-import org.apache.http.protocol.HTTP;
 import org.w3c.dom.Document;
 import org.xml.sax.SAXException;
 
@@ -74,7 +74,7 @@ public class FluentResponseHandling {
                     }
                     Charset charset = contentType.getCharset();
                     if (charset == null) {
-                        charset = HTTP.DEF_CONTENT_CHARSET;
+                        charset = Consts.ISO_8859_1;
                     }
                     return docBuilder.parse(entity.getContent(), charset.name());
                 } catch (ParserConfigurationException ex) {
diff --git a/fluent-hc/src/main/java/org/apache/http/client/fluent/Content.java b/fluent-hc/src/main/java/org/apache/http/client/fluent/Content.java
index 9a2a58e..d69b181 100644
--- a/fluent-hc/src/main/java/org/apache/http/client/fluent/Content.java
+++ b/fluent-hc/src/main/java/org/apache/http/client/fluent/Content.java
@@ -31,8 +31,8 @@ import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 import java.nio.charset.Charset;
 
+import org.apache.http.Consts;
 import org.apache.http.entity.ContentType;
-import org.apache.http.protocol.HTTP;
 
 public class Content {
 
@@ -58,7 +58,7 @@ public class Content {
     public String asString() {
         Charset charset = this.type.getCharset();
         if (charset == null) {
-            charset = HTTP.DEF_CONTENT_CHARSET;
+            charset = Consts.ISO_8859_1;
         }
         try {
             return new String(this.raw, charset.name());
diff --git a/fluent-hc/src/main/java/org/apache/http/client/fluent/Executor.java b/fluent-hc/src/main/java/org/apache/http/client/fluent/Executor.java
index e4f2600..6ce9927 100644
--- a/fluent-hc/src/main/java/org/apache/http/client/fluent/Executor.java
+++ b/fluent-hc/src/main/java/org/apache/http/client/fluent/Executor.java
@@ -44,7 +44,6 @@ import org.apache.http.client.ClientProtocolException;
 import org.apache.http.client.CookieStore;
 import org.apache.http.client.CredentialsProvider;
 import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpRequestBase;
 import org.apache.http.client.protocol.HttpClientContext;
 import org.apache.http.config.Registry;
 import org.apache.http.config.RegistryBuilder;
@@ -125,7 +124,8 @@ public class Executor {
     }
 
     public Executor auth(final HttpHost host, final Credentials creds) {
-        final AuthScope authScope = host != null ? new AuthScope(host) : AuthScope.ANY;
+        final AuthScope authScope = host != null ?
+                new AuthScope(host.getHostName(), host.getPort()) : AuthScope.ANY;
         return auth(authScope, creds);
     }
 
@@ -202,8 +202,7 @@ public class Executor {
         localContext.setAttribute(HttpClientContext.CREDS_PROVIDER, this.credentialsProvider);
         localContext.setAttribute(HttpClientContext.AUTH_CACHE, this.authCache);
         localContext.setAttribute(HttpClientContext.COOKIE_STORE, this.cookieStore);
-        final HttpRequestBase httprequest = request.prepareRequest();
-        httprequest.reset();
+        final InternalHttpRequest httprequest = request.prepareRequest();
         return new Response(this.httpclient.execute(httprequest, localContext));
     }
 
diff --git a/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalByteArrayEntity.java b/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalByteArrayEntity.java
new file mode 100644
index 0000000..7fb270a
--- /dev/null
+++ b/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalByteArrayEntity.java
@@ -0,0 +1,100 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.client.fluent;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.apache.http.entity.AbstractHttpEntity;
+import org.apache.http.entity.ContentType;
+import org.apache.http.util.Args;
+
+class InternalByteArrayEntity extends AbstractHttpEntity implements Cloneable {
+
+    private final byte[] b;
+    private final int off, len;
+
+    public InternalByteArrayEntity(final byte[] b, final ContentType contentType) {
+        super();
+        Args.notNull(b, "Source byte array");
+        this.b = b;
+        this.off = 0;
+        this.len = this.b.length;
+        if (contentType != null) {
+            setContentType(contentType.toString());
+        }
+    }
+
+    public InternalByteArrayEntity(final byte[] b, final int off, final int len, final ContentType contentType) {
+        super();
+        Args.notNull(b, "Source byte array");
+        if ((off < 0) || (off > b.length) || (len < 0) ||
+                ((off + len) < 0) || ((off + len) > b.length)) {
+            throw new IndexOutOfBoundsException("off: " + off + " len: " + len + " b.length: " + b.length);
+        }
+        this.b = b;
+        this.off = off;
+        this.len = len;
+        if (contentType != null) {
+            setContentType(contentType.toString());
+        }
+    }
+
+    public InternalByteArrayEntity(final byte[] b) {
+        this(b, null);
+    }
+
+    public InternalByteArrayEntity(final byte[] b, final int off, final int len) {
+        this(b, off, len, null);
+    }
+
+    public boolean isRepeatable() {
+        return true;
+    }
+
+    public long getContentLength() {
+        return this.len;
+    }
+
+    public InputStream getContent() {
+        return new ByteArrayInputStream(this.b, this.off, this.len);
+    }
+
+    public void writeTo(final OutputStream outstream) throws IOException {
+        Args.notNull(outstream, "Output stream");
+        outstream.write(this.b, this.off, this.len);
+        outstream.flush();
+    }
+
+    public boolean isStreaming() {
+        return false;
+    }
+
+}
diff --git a/fluent-hc/src/main/java/org/apache/http/client/fluent/Content.java b/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalFileEntity.java
similarity index 52%
copy from fluent-hc/src/main/java/org/apache/http/client/fluent/Content.java
copy to fluent-hc/src/main/java/org/apache/http/client/fluent/InternalFileEntity.java
index 9a2a58e..4ebaa6c 100644
--- a/fluent-hc/src/main/java/org/apache/http/client/fluent/Content.java
+++ b/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalFileEntity.java
@@ -24,56 +24,60 @@
  * <http://www.apache.org/>.
  *
  */
+
 package org.apache.http.client.fluent;
 
-import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
 import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.nio.charset.Charset;
+import java.io.OutputStream;
 
+import org.apache.http.entity.AbstractHttpEntity;
 import org.apache.http.entity.ContentType;
-import org.apache.http.protocol.HTTP;
-
-public class Content {
+import org.apache.http.util.Args;
 
-    public static final Content NO_CONTENT = new Content(new byte[] {}, ContentType.DEFAULT_BINARY);
+class InternalFileEntity extends AbstractHttpEntity implements Cloneable {
 
-    private final byte[] raw;
-    private final ContentType type;
+    private final File file;
 
-    Content(final byte[] raw, final ContentType type) {
+    public InternalFileEntity(final File file, final ContentType contentType) {
         super();
-        this.raw = raw;
-        this.type = type;
+        this.file = Args.notNull(file, "File");
+        if (contentType != null) {
+            setContentType(contentType.toString());
+        }
     }
 
-    public ContentType getType() {
-        return this.type;
+    public boolean isRepeatable() {
+        return true;
     }
 
-    public byte[] asBytes() {
-        return this.raw.clone();
+    public long getContentLength() {
+        return this.file.length();
     }
 
-    public String asString() {
-        Charset charset = this.type.getCharset();
-        if (charset == null) {
-            charset = HTTP.DEF_CONTENT_CHARSET;
-        }
-        try {
-            return new String(this.raw, charset.name());
-        } catch (final UnsupportedEncodingException ex) {
-            return new String(this.raw);
-        }
+    public InputStream getContent() throws IOException {
+        return new FileInputStream(this.file);
     }
 
-    public InputStream asStream() {
-        return new ByteArrayInputStream(this.raw);
+    public void writeTo(final OutputStream outstream) throws IOException {
+        Args.notNull(outstream, "Output stream");
+        final InputStream instream = new FileInputStream(this.file);
+        try {
+            final byte[] tmp = new byte[4096];
+            int l;
+            while ((l = instream.read(tmp)) != -1) {
+                outstream.write(tmp, 0, l);
+            }
+            outstream.flush();
+        } finally {
+            instream.close();
+        }
     }
 
-    @Override
-    public String toString() {
-        return asString();
+    public boolean isStreaming() {
+        return false;
     }
 
 }
diff --git a/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalHttpRequest.java b/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalHttpRequest.java
new file mode 100644
index 0000000..0e86a0e
--- /dev/null
+++ b/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalHttpRequest.java
@@ -0,0 +1,113 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.client.fluent;
+
+import java.net.URI;
+
+import org.apache.http.HttpVersion;
+import org.apache.http.ProtocolVersion;
+import org.apache.http.RequestLine;
+import org.apache.http.annotation.NotThreadSafe;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.methods.Configurable;
+import org.apache.http.client.methods.HttpUriRequest;
+import org.apache.http.message.AbstractHttpMessage;
+import org.apache.http.message.BasicRequestLine;
+import org.apache.http.util.Args;
+
+ at NotThreadSafe
+class InternalHttpRequest extends AbstractHttpMessage implements HttpUriRequest, Configurable {
+
+    private final String method;
+    private ProtocolVersion version;
+    private URI uri;
+    private RequestConfig config;
+
+    InternalHttpRequest(final String method, final URI requestURI) {
+        Args.notBlank(method, "Method");
+        Args.notNull(requestURI, "Request URI");
+        this.method = method;
+        this.uri = requestURI;
+    }
+
+    public void setProtocolVersion(final ProtocolVersion version) {
+        this.version = version;
+    }
+
+    public ProtocolVersion getProtocolVersion() {
+        return version != null ? version : HttpVersion.HTTP_1_1;
+    }
+
+    public String getMethod() {
+        return this.method;
+    }
+
+    public URI getURI() {
+        return this.uri;
+    }
+
+    public void abort() throws UnsupportedOperationException {
+    }
+
+    public boolean isAborted() {
+        return false;
+    }
+
+    public RequestLine getRequestLine() {
+        final String method = getMethod();
+        final ProtocolVersion ver = getProtocolVersion();
+        final URI uri = getURI();
+        String uritext = null;
+        if (uri != null) {
+            uritext = uri.toASCIIString();
+        }
+        if (uritext == null || uritext.length() == 0) {
+            uritext = "/";
+        }
+        return new BasicRequestLine(method, uritext, ver);
+    }
+
+
+    public RequestConfig getConfig() {
+        return config;
+    }
+
+    public void setConfig(final RequestConfig config) {
+        this.config = config;
+    }
+
+    public void setURI(final URI uri) {
+        this.uri = uri;
+    }
+
+    @Override
+    public String toString() {
+        return getMethod() + " " + getURI() + " " + getProtocolVersion();
+    }
+
+}
diff --git a/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalInputStreamEntity.java b/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalInputStreamEntity.java
new file mode 100644
index 0000000..7d7da2b
--- /dev/null
+++ b/fluent-hc/src/main/java/org/apache/http/client/fluent/InternalInputStreamEntity.java
@@ -0,0 +1,96 @@
+/*
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.client.fluent;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.apache.http.entity.AbstractHttpEntity;
+import org.apache.http.entity.ContentType;
+import org.apache.http.util.Args;
+
+class InternalInputStreamEntity extends AbstractHttpEntity {
+
+    private final InputStream content;
+    private final long length;
+
+    public InternalInputStreamEntity(final InputStream instream, final long length, final ContentType contentType) {
+        super();
+        this.content = Args.notNull(instream, "Source input stream");
+        this.length = length;
+        if (contentType != null) {
+            setContentType(contentType.toString());
+        }
+    }
+
+    public boolean isRepeatable() {
+        return false;
+    }
+
+    public long getContentLength() {
+        return this.length;
+    }
+
+    public InputStream getContent() throws IOException {
+        return this.content;
+    }
+
+    public void writeTo(final OutputStream outstream) throws IOException {
+        Args.notNull(outstream, "Output stream");
+        final InputStream instream = this.content;
+        try {
+            final byte[] buffer = new byte[4096];
+            int l;
+            if (this.length < 0) {
+                // consume until EOF
+                while ((l = instream.read(buffer)) != -1) {
+                    outstream.write(buffer, 0, l);
+                }
+            } else {
+                // consume no more than length
+                long remaining = this.length;
+                while (remaining > 0) {
+                    l = instream.read(buffer, 0, (int)Math.min(4096, remaining));
+                    if (l == -1) {
+                        break;
+                    }
+                    outstream.write(buffer, 0, l);
+                    remaining -= l;
+                }
+            }
+        } finally {
+            instream.close();
+        }
+    }
+
+    public boolean isStreaming() {
+        return true;
+    }
+
+}
diff --git a/fluent-hc/src/main/java/org/apache/http/client/fluent/Request.java b/fluent-hc/src/main/java/org/apache/http/client/fluent/Request.java
index 5a91ce1..f1194e1 100644
--- a/fluent-hc/src/main/java/org/apache/http/client/fluent/Request.java
+++ b/fluent-hc/src/main/java/org/apache/http/client/fluent/Request.java
@@ -29,14 +29,18 @@ package org.apache.http.client.fluent;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
 import java.net.URI;
 import java.nio.charset.Charset;
 import java.text.SimpleDateFormat;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
+import java.util.List;
 import java.util.Locale;
 import java.util.TimeZone;
 
+import org.apache.http.Consts;
 import org.apache.http.Header;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpEntityEnclosingRequest;
@@ -45,20 +49,15 @@ import org.apache.http.HttpVersion;
 import org.apache.http.NameValuePair;
 import org.apache.http.client.ClientProtocolException;
 import org.apache.http.client.config.RequestConfig;
-import org.apache.http.client.entity.UrlEncodedFormEntity;
 import org.apache.http.client.methods.HttpDelete;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.client.methods.HttpHead;
 import org.apache.http.client.methods.HttpOptions;
 import org.apache.http.client.methods.HttpPost;
 import org.apache.http.client.methods.HttpPut;
-import org.apache.http.client.methods.HttpRequestBase;
 import org.apache.http.client.methods.HttpTrace;
-import org.apache.http.entity.ByteArrayEntity;
+import org.apache.http.client.utils.URLEncodedUtils;
 import org.apache.http.entity.ContentType;
-import org.apache.http.entity.FileEntity;
-import org.apache.http.entity.InputStreamEntity;
-import org.apache.http.entity.StringEntity;
 import org.apache.http.protocol.HTTP;
 
 public class Request {
@@ -67,74 +66,74 @@ public class Request {
     public static final Locale DATE_LOCALE = Locale.US;
     public static final TimeZone TIME_ZONE = TimeZone.getTimeZone("GMT");
 
-    private final HttpRequestBase request;
+    private final InternalHttpRequest request;
     private final RequestConfig.Builder configBuilder;
 
     private SimpleDateFormat dateFormatter;
 
     public static Request Get(final URI uri) {
-        return new Request(new HttpGet(uri));
+        return new Request(HttpGet.METHOD_NAME, uri);
     }
 
     public static Request Get(final String uri) {
-        return new Request(new HttpGet(uri));
+        return new Request(HttpGet.METHOD_NAME, URI.create(uri));
     }
 
     public static Request Head(final URI uri) {
-        return new Request(new HttpHead(uri));
+        return new Request(HttpHead.METHOD_NAME, uri);
     }
 
     public static Request Head(final String uri) {
-        return new Request(new HttpHead(uri));
+        return new Request(HttpHead.METHOD_NAME, URI.create(uri));
     }
 
     public static Request Post(final URI uri) {
-        return new Request(new HttpPost(uri));
+        return new Request(HttpPost.METHOD_NAME, uri);
     }
 
     public static Request Post(final String uri) {
-        return new Request(new HttpPost(uri));
+        return new Request(HttpPost.METHOD_NAME, URI.create(uri));
     }
 
     public static Request Put(final URI uri) {
-        return new Request(new HttpPut(uri));
+        return new Request(HttpPut.METHOD_NAME, uri);
     }
 
     public static Request Put(final String uri) {
-        return new Request(new HttpPut(uri));
+        return new Request(HttpPut.METHOD_NAME, URI.create(uri));
     }
 
     public static Request Trace(final URI uri) {
-        return new Request(new HttpTrace(uri));
+        return new Request(HttpTrace.METHOD_NAME, uri);
     }
 
     public static Request Trace(final String uri) {
-        return new Request(new HttpTrace(uri));
+        return new Request(HttpTrace.METHOD_NAME, URI.create(uri));
     }
 
     public static Request Delete(final URI uri) {
-        return new Request(new HttpDelete(uri));
+        return new Request(HttpDelete.METHOD_NAME, uri);
     }
 
     public static Request Delete(final String uri) {
-        return new Request(new HttpDelete(uri));
+        return new Request(HttpDelete.METHOD_NAME, URI.create(uri));
     }
 
     public static Request Options(final URI uri) {
-        return new Request(new HttpOptions(uri));
+        return new Request(HttpOptions.METHOD_NAME, uri);
     }
 
     public static Request Options(final String uri) {
-        return new Request(new HttpOptions(uri));
+        return new Request(HttpOptions.METHOD_NAME, URI.create(uri));
     }
 
-    Request(final HttpRequestBase request) {
+    Request(final String method, final URI requestURI) {
         super();
-        this.request = request;
+        this.request = new InternalHttpRequest(method, requestURI);
         this.configBuilder = RequestConfig.custom();
     }
 
-    HttpRequestBase prepareRequest() {
+    InternalHttpRequest prepareRequest() {
         this.request.setConfig(this.configBuilder.build());
         return this.request;
     }
@@ -304,39 +303,52 @@ public class Request {
     }
 
     public Request bodyForm(final Iterable <? extends NameValuePair> formParams, final Charset charset) {
-        return body(new UrlEncodedFormEntity(formParams, charset));
+        final List<NameValuePair> paramList = new ArrayList<NameValuePair>();
+        for (NameValuePair param : formParams) {
+            paramList.add(param);
+        }
+        final ContentType contentType = ContentType.create(URLEncodedUtils.CONTENT_TYPE, charset);
+        final String s = URLEncodedUtils.format(paramList, charset != null ? charset.name() : null);
+        return bodyString(s, contentType);
     }
 
     public Request bodyForm(final Iterable <? extends NameValuePair> formParams) {
-        return bodyForm(formParams, HTTP.DEF_CONTENT_CHARSET);
+        return bodyForm(formParams, Consts.ISO_8859_1);
     }
 
     public Request bodyForm(final NameValuePair... formParams) {
-        return bodyForm(Arrays.asList(formParams), HTTP.DEF_CONTENT_CHARSET);
+        return bodyForm(Arrays.asList(formParams), Consts.ISO_8859_1);
     }
 
     public Request bodyString(final String s, final ContentType contentType) {
-        return body(new StringEntity(s, contentType));
+        final Charset charset = contentType != null ? contentType.getCharset() : null;
+        byte[] raw;
+        try {
+            raw = charset != null ? s.getBytes(charset.name()) : s.getBytes();
+        } catch (UnsupportedEncodingException ex) {
+            raw = s.getBytes();
+        }
+        return body(new InternalByteArrayEntity(raw, contentType));
     }
 
     public Request bodyFile(final File file, final ContentType contentType) {
-        return body(new FileEntity(file, contentType));
+        return body(new InternalFileEntity(file, contentType));
     }
 
     public Request bodyByteArray(final byte[] b) {
-        return body(new ByteArrayEntity(b));
+        return body(new InternalByteArrayEntity(b));
     }
 
     public Request bodyByteArray(final byte[] b, final int off, final int len) {
-        return body(new ByteArrayEntity(b, off, len));
+        return body(new InternalByteArrayEntity(b, off, len));
     }
 
     public Request bodyStream(final InputStream instream) {
-        return body(new InputStreamEntity(instream, -1));
+        return body(new InternalInputStreamEntity(instream, -1, null));
     }
 
     public Request bodyStream(final InputStream instream, final ContentType contentType) {
-        return body(new InputStreamEntity(instream, -1, contentType));
+        return body(new InternalInputStreamEntity(instream, -1, contentType));
     }
 
     @Override
diff --git a/fluent-hc/src/main/java/org/apache/http/client/fluent/Response.java b/fluent-hc/src/main/java/org/apache/http/client/fluent/Response.java
index 147f4d8..76a6a98 100644
--- a/fluent-hc/src/main/java/org/apache/http/client/fluent/Response.java
+++ b/fluent-hc/src/main/java/org/apache/http/client/fluent/Response.java
@@ -29,6 +29,7 @@ package org.apache.http.client.fluent;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.InputStream;
 
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpResponse;
@@ -61,7 +62,11 @@ public class Response {
             return;
         }
         try {
-            EntityUtils.consume(this.response.getEntity());
+            final HttpEntity entity = this.response.getEntity();
+            final InputStream content = entity.getContent();
+            if (content != null) {
+                content.close();
+            }
         } catch (final Exception ignore) {
         } finally {
             this.consumed = true;
@@ -97,8 +102,11 @@ public class Response {
         try {
             final HttpEntity entity = this.response.getEntity();
             if (entity != null) {
-                this.response.setEntity(new ByteArrayEntity(EntityUtils.toByteArray(entity),
-                                ContentType.getOrDefault(entity)));
+                final ByteArrayEntity byteArrayEntity = new ByteArrayEntity(
+                        EntityUtils.toByteArray(entity));
+                final ContentType contentType = ContentType.getOrDefault(entity);
+                byteArrayEntity.setContentType(contentType.toString());
+                this.response.setEntity(byteArrayEntity);
             }
             return this.response;
         } finally {
diff --git a/httpclient-cache/pom.xml b/httpclient-cache/pom.xml
index dcfd00b..b988d05 100644
--- a/httpclient-cache/pom.xml
+++ b/httpclient-cache/pom.xml
@@ -28,7 +28,7 @@
   <parent>
     <groupId>org.apache.httpcomponents</groupId>
     <artifactId>httpcomponents-client</artifactId>
-    <version>4.3.2</version>
+    <version>4.3.3</version>
   </parent>
   <artifactId>httpclient-cache</artifactId>
   <name>Apache HttpClient Cache</name>
diff --git a/httpclient-cache/src/main/java-deprecated/org/apache/http/impl/client/cache/CachingHttpClient.java b/httpclient-cache/src/main/java-deprecated/org/apache/http/impl/client/cache/CachingHttpClient.java
index 76a7be2..63f8e83 100644
--- a/httpclient-cache/src/main/java-deprecated/org/apache/http/impl/client/cache/CachingHttpClient.java
+++ b/httpclient-cache/src/main/java-deprecated/org/apache/http/impl/client/cache/CachingHttpClient.java
@@ -78,7 +78,6 @@ import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HTTP;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.util.Args;
-import org.apache.http.util.EntityUtils;
 import org.apache.http.util.VersionInfo;
 
 /**
@@ -381,7 +380,7 @@ public class CachingHttpClient implements HttpClient {
         } catch (final Exception t) {
             final HttpEntity entity = response.getEntity();
             try {
-                EntityUtils.consume(entity);
+                IOUtils.consume(entity);
             } catch (final Exception t2) {
                 // Log this exception. The original exception is more
                 // important and will be thrown to the caller.
@@ -399,7 +398,7 @@ public class CachingHttpClient implements HttpClient {
         // Handling the response was successful. Ensure that the content has
         // been fully consumed.
         final HttpEntity entity = response.getEntity();
-        EntityUtils.consume(entity);
+        IOUtils.consume(entity);
         return result;
     }
 
@@ -804,7 +803,7 @@ public class CachingHttpClient implements HttpClient {
         final HttpCacheEntry matchedEntry = matchingVariant.getEntry();
 
         if (revalidationResponseIsTooOld(backendResponse, matchedEntry)) {
-            EntityUtils.consume(backendResponse.getEntity());
+            IOUtils.consume(backendResponse.getEntity());
             return retryRequestUnconditionally(target, request, context,
                     matchedEntry);
         }
@@ -875,7 +874,7 @@ public class CachingHttpClient implements HttpClient {
         Date responseDate = getCurrentDate();
 
         if (revalidationResponseIsTooOld(backendResponse, cacheEntry)) {
-            EntityUtils.consume(backendResponse.getEntity());
+            IOUtils.consume(backendResponse.getEntity());
             final HttpRequest unconditional = conditionalRequestBuilder
                 .buildUnconditionalRequest(request, cacheEntry);
             requestDate = getCurrentDate();
@@ -907,7 +906,7 @@ public class CachingHttpClient implements HttpClient {
             cachedResponse.addHeader(HeaderConstants.WARNING, "110 localhost \"Response is stale\"");
             final HttpEntity errorBody = backendResponse.getEntity();
             if (errorBody != null) {
-                EntityUtils.consume(errorBody);
+                IOUtils.consume(errorBody);
             }
             return cachedResponse;
         }
diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingExec.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingExec.java
index c86b33d..f488251 100644
--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingExec.java
+++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachingExec.java
@@ -64,7 +64,6 @@ import org.apache.http.message.BasicHttpResponse;
 import org.apache.http.protocol.HTTP;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.util.Args;
-import org.apache.http.util.EntityUtils;
 import org.apache.http.util.VersionInfo;
 
 /**
@@ -634,7 +633,7 @@ public class CachingExec implements ClientExecChain {
             final Header resultEtagHeader = backendResponse.getFirstHeader(HeaderConstants.ETAG);
             if (resultEtagHeader == null) {
                 log.warn("304 response did not contain ETag");
-                EntityUtils.consume(backendResponse.getEntity());
+                IOUtils.consume(backendResponse.getEntity());
                 backendResponse.close();
                 return callBackend(route, request, context, execAware);
             }
@@ -643,7 +642,7 @@ public class CachingExec implements ClientExecChain {
             final Variant matchingVariant = variants.get(resultEtag);
             if (matchingVariant == null) {
                 log.debug("304 response did not contain ETag matching one sent in If-None-Match");
-                EntityUtils.consume(backendResponse.getEntity());
+                IOUtils.consume(backendResponse.getEntity());
                 backendResponse.close();
                 return callBackend(route, request, context, execAware);
             }
@@ -651,7 +650,7 @@ public class CachingExec implements ClientExecChain {
             final HttpCacheEntry matchedEntry = matchingVariant.getEntry();
 
             if (revalidationResponseIsTooOld(backendResponse, matchedEntry)) {
-                EntityUtils.consume(backendResponse.getEntity());
+                IOUtils.consume(backendResponse.getEntity());
                 backendResponse.close();
                 return retryRequestUnconditionally(route, request, context, execAware, matchedEntry);
             }
diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/IOUtils.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/IOUtils.java
index 44ee62b..b255d0f 100644
--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/IOUtils.java
+++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/IOUtils.java
@@ -34,11 +34,24 @@ import java.io.OutputStream;
 import java.io.RandomAccessFile;
 import java.nio.channels.FileChannel;
 
+import org.apache.http.HttpEntity;
 import org.apache.http.annotation.Immutable;
 
 @Immutable
 class IOUtils {
 
+    static void consume(final HttpEntity entity) throws IOException {
+        if (entity == null) {
+            return;
+        }
+        if (entity.isStreaming()) {
+            final InputStream instream = entity.getContent();
+            if (instream != null) {
+                instream.close();
+            }
+        }
+    }
+
     static void copy(final InputStream in, final OutputStream out) throws IOException {
         final byte[] buf = new byte[2048];
         int len;
diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ManagedHttpCacheStorage.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ManagedHttpCacheStorage.java
index 315e397..44e333f 100644
--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ManagedHttpCacheStorage.java
+++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ManagedHttpCacheStorage.java
@@ -31,6 +31,7 @@ import java.io.IOException;
 import java.lang.ref.ReferenceQueue;
 import java.util.HashSet;
 import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.http.annotation.ThreadSafe;
 import org.apache.http.client.cache.HttpCacheEntry;
@@ -60,18 +61,18 @@ public class ManagedHttpCacheStorage implements HttpCacheStorage, Closeable {
     private final CacheMap entries;
     private final ReferenceQueue<HttpCacheEntry> morque;
     private final Set<ResourceReference> resources;
-
-    private volatile boolean shutdown;
+    private final AtomicBoolean active;
 
     public ManagedHttpCacheStorage(final CacheConfig config) {
         super();
         this.entries = new CacheMap(config.getMaxCacheEntries());
         this.morque = new ReferenceQueue<HttpCacheEntry>();
         this.resources = new HashSet<ResourceReference>();
+        this.active = new AtomicBoolean(true);
     }
 
     private void ensureValidState() throws IllegalStateException {
-        if (this.shutdown) {
+        if (!this.active.get()) {
             throw new IllegalStateException("Cache has been shut down");
         }
     }
@@ -130,30 +131,27 @@ public class ManagedHttpCacheStorage implements HttpCacheStorage, Closeable {
     }
 
     public void cleanResources() {
-        if (this.shutdown) {
-            return;
-        }
-        ResourceReference ref;
-        while ((ref = (ResourceReference) this.morque.poll()) != null) {
-            synchronized (this) {
-                this.resources.remove(ref);
+        if (this.active.get()) {
+            ResourceReference ref;
+            while ((ref = (ResourceReference) this.morque.poll()) != null) {
+                synchronized (this) {
+                    this.resources.remove(ref);
+                }
+                ref.getResource().dispose();
             }
-            ref.getResource().dispose();
         }
     }
 
     public void shutdown() {
-        if (this.shutdown) {
-            return;
-        }
-        this.shutdown = true;
-        synchronized (this) {
-            this.entries.clear();
-            for (final ResourceReference ref: this.resources) {
-                ref.getResource().dispose();
-            }
-            this.resources.clear();
-            while (this.morque.poll() != null) {
+        if (this.active.compareAndSet(true, false)) {
+            synchronized (this) {
+                this.entries.clear();
+                for (final ResourceReference ref: this.resources) {
+                    ref.getResource().dispose();
+                }
+                this.resources.clear();
+                while (this.morque.poll() != null) {
+                }
             }
         }
     }
diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseProtocolCompliance.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseProtocolCompliance.java
index c567bdd..bde392d 100644
--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseProtocolCompliance.java
+++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseProtocolCompliance.java
@@ -46,7 +46,6 @@ import org.apache.http.client.methods.HttpRequestWrapper;
 import org.apache.http.client.utils.DateUtils;
 import org.apache.http.message.BasicHeader;
 import org.apache.http.protocol.HTTP;
-import org.apache.http.util.EntityUtils;
 
 /**
  * @since 4.1
@@ -94,7 +93,7 @@ class ResponseProtocolCompliance {
     private void consumeBody(final HttpResponse response) throws IOException {
         final HttpEntity body = response.getEntity();
         if (body != null) {
-            EntityUtils.consume(body);
+            IOUtils.consume(body);
         }
     }
 
diff --git a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseProxyHandler.java b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseProxyHandler.java
index 4e5ffe9..9130d9b 100644
--- a/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseProxyHandler.java
+++ b/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ResponseProxyHandler.java
@@ -35,7 +35,6 @@ import java.lang.reflect.Method;
 
 import org.apache.http.HttpResponse;
 import org.apache.http.annotation.NotThreadSafe;
-import org.apache.http.util.EntityUtils;
 
 /**
  * A proxy class that can enhance an arbitrary {@link HttpResponse} with
@@ -64,7 +63,7 @@ class ResponseProxyHandler implements InvocationHandler {
     }
 
     public void close() throws IOException {
-        EntityUtils.consume(original.getEntity());
+        IOUtils.consume(original.getEntity());
     }
 
     public Object invoke(
diff --git a/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestBasicHttpCache.java b/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestBasicHttpCache.java
index a24f718..f457671 100644
--- a/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestBasicHttpCache.java
+++ b/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestBasicHttpCache.java
@@ -62,7 +62,6 @@ import org.apache.http.entity.BasicHttpEntity;
 import org.apache.http.entity.ByteArrayEntity;
 import org.apache.http.message.BasicHeader;
 import org.apache.http.message.BasicHttpResponse;
-import org.apache.http.util.EntityUtils;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -510,7 +509,7 @@ public class TestBasicHttpCache {
         originResponse.setHeader("ETag", "\"etag\"");
 
         final HttpResponse result = impl.cacheAndReturnResponse(host, request, originResponse, requestSent, responseReceived);
-        EntityUtils.consume(result.getEntity());
+        IOUtils.consume(result.getEntity());
         assertTrue(inputStream.wasClosed());
     }
 
diff --git a/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingExec.java b/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingExec.java
index f161512..2683c93 100644
--- a/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingExec.java
+++ b/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingExec.java
@@ -341,7 +341,7 @@ public class TestCachingExec extends TestCachingExecChain {
                 }
                 return 'y';
             }
-        }));
+        }, -1));
 
         final CloseableHttpResponse resp = mockBackend.execute(
                 EasyMock.isA(HttpRoute.class),
diff --git a/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestHttpCacheJiraNumber1147.java b/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestHttpCacheJiraNumber1147.java
index a30ec24..99b78b8 100644
--- a/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestHttpCacheJiraNumber1147.java
+++ b/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestHttpCacheJiraNumber1147.java
@@ -38,11 +38,10 @@ import org.apache.http.client.methods.HttpExecutionAware;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.client.methods.HttpRequestWrapper;
 import org.apache.http.client.protocol.HttpClientContext;
-import org.apache.http.conn.routing.HttpRoute;
 import org.apache.http.client.utils.DateUtils;
+import org.apache.http.conn.routing.HttpRoute;
 import org.apache.http.impl.execchain.ClientExecChain;
 import org.apache.http.message.BasicHttpResponse;
-import org.apache.http.util.EntityUtils;
 import org.easymock.EasyMock;
 import org.junit.After;
 import org.junit.Assert;
@@ -116,7 +115,7 @@ public class TestHttpCacheJiraNumber1147 {
 
         final HttpResponse response1 = t.execute(route, get, context, null);
         Assert.assertEquals(200, response1.getStatusLine().getStatusCode());
-        EntityUtils.consume(response1.getEntity());
+        IOUtils.consume(response1.getEntity());
 
         EasyMock.verify(backend);
 
@@ -132,7 +131,7 @@ public class TestHttpCacheJiraNumber1147 {
 
         final HttpResponse response2 = t.execute(route, get, context, null);
         Assert.assertEquals(200, response2.getStatusLine().getStatusCode());
-        EntityUtils.consume(response2.getEntity());
+        IOUtils.consume(response2.getEntity());
 
         EasyMock.verify(backend);
     }
diff --git a/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestStaleWhileRevalidationReleasesConnection.java b/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestStaleWhileRevalidationReleasesConnection.java
index 0a4abf2..88f962b 100644
--- a/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestStaleWhileRevalidationReleasesConnection.java
+++ b/httpclient-cache/src/test/java/org/apache/http/impl/client/cache/TestStaleWhileRevalidationReleasesConnection.java
@@ -26,12 +26,12 @@
  */
 package org.apache.http.impl.client.cache;
 
+import org.apache.http.Header;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpException;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
 import org.apache.http.MethodNotSupportedException;
-import org.apache.http.Header;
 import org.apache.http.client.ClientProtocolException;
 import org.apache.http.client.HttpClient;
 import org.apache.http.client.cache.CacheResponseStatus;
@@ -41,10 +41,10 @@ import org.apache.http.client.methods.HttpGet;
 import org.apache.http.entity.ByteArrayEntity;
 import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.localserver.LocalTestServer;
 import org.apache.http.protocol.BasicHttpContext;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpRequestHandler;
-import org.apache.http.util.EntityUtils;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -53,10 +53,8 @@ import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.util.Locale;
 
-
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
-import org.apache.http.localserver.LocalTestServer;
 
 /**
  * Test that after background validation that a subsequent request for non cached
@@ -205,7 +203,7 @@ public class TestStaleWhileRevalidationReleasesConnection {
             if(response!=null) {
                 final HttpEntity entity = response.getEntity();
                 try {
-                    EntityUtils.consume(entity);
+                    IOUtils.consume(entity);
                 } catch (final IOException e) {
                     e.printStackTrace();
                 }
diff --git a/httpclient-osgi/pom.xml b/httpclient-osgi/pom.xml
index 5d7ca76..d712738 100644
--- a/httpclient-osgi/pom.xml
+++ b/httpclient-osgi/pom.xml
@@ -28,7 +28,7 @@
   <parent>
     <groupId>org.apache.httpcomponents</groupId>
     <artifactId>httpcomponents-client</artifactId>
-    <version>4.3.2</version>
+    <version>4.3.3</version>
   </parent>
   <artifactId>httpclient-osgi</artifactId>
   <name>Apache HttpClient OSGi bundle</name>
diff --git a/httpclient/pom.xml b/httpclient/pom.xml
index 4d99712..19e3f59 100644
--- a/httpclient/pom.xml
+++ b/httpclient/pom.xml
@@ -28,7 +28,7 @@
   <parent>
     <groupId>org.apache.httpcomponents</groupId>
     <artifactId>httpcomponents-client</artifactId>
-    <version>4.3.2</version>
+    <version>4.3.3</version>
   </parent>
   <artifactId>httpclient</artifactId>
   <name>Apache HttpClient</name>
diff --git a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/DefaultRequestDirector.java b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/DefaultRequestDirector.java
index 056d3f5..3a6ee0c 100644
--- a/httpclient/src/main/java-deprecated/org/apache/http/impl/client/DefaultRequestDirector.java
+++ b/httpclient/src/main/java-deprecated/org/apache/http/impl/client/DefaultRequestDirector.java
@@ -42,6 +42,7 @@ import org.apache.http.HttpException;
 import org.apache.http.HttpHost;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
+import org.apache.http.NoHttpResponseException;
 import org.apache.http.ProtocolException;
 import org.apache.http.ProtocolVersion;
 import org.apache.http.annotation.NotThreadSafe;
@@ -621,12 +622,14 @@ public class DefaultRequestDirector implements RequestDirector {
                 if (retryHandler.retryRequest(ex, connectCount, context)) {
                     if (this.log.isInfoEnabled()) {
                         this.log.info("I/O exception ("+ ex.getClass().getName() +
-                                ") caught when connecting to the target host: "
+                                ") caught when connecting to "
+                                + route +
+                                ": "
                                 + ex.getMessage());
                         if (this.log.isDebugEnabled()) {
                             this.log.debug(ex.getMessage(), ex);
                         }
-                        this.log.info("Retrying connect");
+                        this.log.info("Retrying connect to " + route);
                     }
                 } else {
                     throw ex;
@@ -691,16 +694,27 @@ public class DefaultRequestDirector implements RequestDirector {
                 if (retryHandler.retryRequest(ex, wrapper.getExecCount(), context)) {
                     if (this.log.isInfoEnabled()) {
                         this.log.info("I/O exception ("+ ex.getClass().getName() +
-                                ") caught when processing request: "
+                                ") caught when processing request to "
+                                + route +
+                                ": "
                                 + ex.getMessage());
                     }
                     if (this.log.isDebugEnabled()) {
                         this.log.debug(ex.getMessage(), ex);
                     }
-                    this.log.info("Retrying request");
+                    if (this.log.isInfoEnabled()) {
+                        this.log.info("Retrying request to " + route);
+                    }
                     retryReason = ex;
                 } else {
-                    throw ex;
+                    if (ex instanceof NoHttpResponseException) {
+                        final NoHttpResponseException updatedex = new NoHttpResponseException(
+                                route.getTargetHost().toHostString() + " failed to respond");
+                        updatedex.setStackTrace(ex.getStackTrace());
+                        throw updatedex;
+                    } else {
+                        throw ex;
+                    }
                 }
             }
         }
diff --git a/httpclient/src/main/java/org/apache/http/client/entity/LazyDecompressingInputStream.java b/httpclient/src/main/java/org/apache/http/client/entity/LazyDecompressingInputStream.java
index 26e4981..fb0e43b 100644
--- a/httpclient/src/main/java/org/apache/http/client/entity/LazyDecompressingInputStream.java
+++ b/httpclient/src/main/java/org/apache/http/client/entity/LazyDecompressingInputStream.java
@@ -50,6 +50,12 @@ class LazyDecompressingInputStream extends InputStream {
         this.decompressingEntity = decompressingEntity;
     }
 
+    private void initWrapper() throws IOException {
+        if (wrapperStream == null) {
+            wrapperStream = decompressingEntity.decorate(wrappedStream);
+        }
+    }
+
     @Override
     public int read() throws IOException {
         initWrapper();
@@ -57,23 +63,43 @@ class LazyDecompressingInputStream extends InputStream {
     }
 
     @Override
-    public int available() throws IOException {
+    public int read(final byte[] b) throws IOException {
         initWrapper();
-        return wrapperStream.available();
+        return wrapperStream.read(b);
     }
 
-    private void initWrapper() throws IOException {
-        if (wrapperStream == null) {
-            wrapperStream = decompressingEntity.decorate(wrappedStream);
-        }
+    @Override
+    public int read(final byte[] b, final int off, final int len) throws IOException {
+        initWrapper();
+        return wrapperStream.read(b, off, len);
+    }
+
+    @Override
+    public long skip(final long n) throws IOException {
+        initWrapper();
+        return wrapperStream.skip(n);
+    }
+
+    @Override
+    public boolean markSupported() {
+        return false;
+    }
+
+    @Override
+    public int available() throws IOException {
+        initWrapper();
+        return wrapperStream.available();
     }
 
     @Override
     public void close() throws IOException {
-        if (wrapperStream != null) {
-            wrapperStream.close();
+        try {
+            if (wrapperStream != null) {
+                wrapperStream.close();
+            }
+        } finally {
+            wrappedStream.close();
         }
-        wrappedStream.close();
     }
 
 }
diff --git a/httpclient/src/main/java/org/apache/http/impl/client/SystemDefaultCredentialsProvider.java b/httpclient/src/main/java/org/apache/http/impl/client/SystemDefaultCredentialsProvider.java
index 9af52f8..f7dd918 100644
--- a/httpclient/src/main/java/org/apache/http/impl/client/SystemDefaultCredentialsProvider.java
+++ b/httpclient/src/main/java/org/apache/http/impl/client/SystemDefaultCredentialsProvider.java
@@ -35,6 +35,7 @@ import java.util.concurrent.ConcurrentHashMap;
 import org.apache.http.annotation.ThreadSafe;
 import org.apache.http.auth.AuthScope;
 import org.apache.http.auth.Credentials;
+import org.apache.http.auth.NTCredentials;
 import org.apache.http.auth.UsernamePasswordCredentials;
 import org.apache.http.client.CredentialsProvider;
 import org.apache.http.client.config.AuthSchemes;
@@ -85,11 +86,14 @@ public class SystemDefaultCredentialsProvider implements CredentialsProvider {
     private static PasswordAuthentication getSystemCreds(
             final AuthScope authscope,
             final Authenticator.RequestorType requestorType) {
+        final String hostname = authscope.getHost();
+        final int port = authscope.getPort();
+        final String protocol = port == 443 ? "https" : "http";
         return Authenticator.requestPasswordAuthentication(
-                authscope.getHost(),
+                hostname,
                 null,
-                authscope.getPort(),
-                "http",
+                port,
+                protocol,
                 null,
                 translateScheme(authscope.getScheme()),
                 null,
@@ -110,8 +114,25 @@ public class SystemDefaultCredentialsProvider implements CredentialsProvider {
                         authscope, Authenticator.RequestorType.PROXY);
             }
             if (systemcreds != null) {
-                return new UsernamePasswordCredentials(
-                        systemcreds.getUserName(), new String(systemcreds.getPassword()));
+                final String domain = System.getProperty("http.auth.ntlm.domain");
+                if (domain != null) {
+                    return new NTCredentials(
+                            systemcreds.getUserName(),
+                            new String(systemcreds.getPassword()),
+                            null, domain);
+                } else {
+                    if (AuthSchemes.NTLM.equalsIgnoreCase(authscope.getScheme())) {
+                        // Domian may be specified in a fully qualified user name
+                        return new NTCredentials(
+                                systemcreds.getUserName(),
+                                new String(systemcreds.getPassword()),
+                                null, null);
+                    } else {
+                        return new UsernamePasswordCredentials(
+                                systemcreds.getUserName(),
+                                new String(systemcreds.getPassword()));
+                    }
+                }
             }
         }
         return null;
diff --git a/httpclient/src/main/java/org/apache/http/impl/conn/HttpClientConnectionOperator.java b/httpclient/src/main/java/org/apache/http/impl/conn/HttpClientConnectionOperator.java
index 3a5b33d..7acb9e7 100644
--- a/httpclient/src/main/java/org/apache/http/impl/conn/HttpClientConnectionOperator.java
+++ b/httpclient/src/main/java/org/apache/http/impl/conn/HttpClientConnectionOperator.java
@@ -42,7 +42,6 @@ import org.apache.http.config.Lookup;
 import org.apache.http.config.SocketConfig;
 import org.apache.http.conn.ConnectTimeoutException;
 import org.apache.http.conn.DnsResolver;
-import org.apache.http.conn.HttpClientConnectionManager;
 import org.apache.http.conn.HttpHostConnectException;
 import org.apache.http.conn.ManagedHttpClientConnection;
 import org.apache.http.conn.SchemePortResolver;
@@ -57,7 +56,7 @@ class HttpClientConnectionOperator {
 
     static final String SOCKET_FACTORY_REGISTRY = "http.socket-factory-registry";
 
-    private final Log log = LogFactory.getLog(HttpClientConnectionManager.class);
+    private final Log log = LogFactory.getLog(getClass());
 
     private final Lookup<ConnectionSocketFactory> socketFactoryRegistry;
     private final SchemePortResolver schemePortResolver;
@@ -124,6 +123,9 @@ class HttpClientConnectionOperator {
                     sock.setSoLinger(linger > 0, linger);
                 }
                 conn.bind(sock);
+                if (this.log.isDebugEnabled()) {
+                    this.log.debug("Connection established " + conn);
+                }
                 return;
             } catch (final SocketTimeoutException ex) {
                 if (last) {
diff --git a/httpclient/src/main/java/org/apache/http/impl/conn/LoggingInputStream.java b/httpclient/src/main/java/org/apache/http/impl/conn/LoggingInputStream.java
index f53cf9b..d42a183 100644
--- a/httpclient/src/main/java/org/apache/http/impl/conn/LoggingInputStream.java
+++ b/httpclient/src/main/java/org/apache/http/impl/conn/LoggingInputStream.java
@@ -51,48 +51,79 @@ class LoggingInputStream extends InputStream {
 
     @Override
     public int read() throws IOException {
-        final int b = in.read();
-        if (b != -1) {
-            wire.input(b);
+        try {
+            final int b = in.read();
+            if (b == -1) {
+                wire.input("end of stream");
+            } else {
+                wire.input(b);
+            }
+            return b;
+        } catch (IOException ex) {
+            wire.input("[read] I/O error: " + ex.getMessage());
+            throw ex;
         }
-        return b;
     }
 
     @Override
     public int read(final byte[] b) throws IOException {
-        final int bytesRead = in.read(b);
-        if (bytesRead != -1) {
-            wire.input(b, 0, bytesRead);
+        try {
+            final int bytesRead = in.read(b);
+            if (bytesRead == -1) {
+                wire.input("end of stream");
+            } else if (bytesRead > 0) {
+                wire.input(b, 0, bytesRead);
+            }
+            return bytesRead;
+        } catch (IOException ex) {
+            wire.input("[read] I/O error: " + ex.getMessage());
+            throw ex;
         }
-        return bytesRead;
     }
 
     @Override
     public int read(final byte[] b, final int off, final int len) throws IOException {
-        final int bytesRead = in.read(b, off, len);
-        if (bytesRead != -1) {
-            wire.input(b, off, bytesRead);
+        try {
+            final int bytesRead = in.read(b, off, len);
+            if (bytesRead == -1) {
+                wire.input("end of stream");
+            } else if (bytesRead > 0) {
+                wire.input(b, off, bytesRead);
+            }
+            return bytesRead;
+        } catch (IOException ex) {
+            wire.input("[read] I/O error: " + ex.getMessage());
+            throw ex;
         }
-        return bytesRead;
     }
 
     @Override
     public long skip(final long n) throws IOException {
-        return super.skip(n);
+        try {
+            return super.skip(n);
+        } catch (IOException ex) {
+            wire.input("[skip] I/O error: " + ex.getMessage());
+            throw ex;
+        }
     }
 
     @Override
     public int available() throws IOException {
-        return in.available();
+        try {
+            return in.available();
+        } catch (IOException ex) {
+            wire.input("[available] I/O error : " + ex.getMessage());
+            throw ex;
+        }
     }
 
     @Override
-    public synchronized void mark(final int readlimit) {
+    public void mark(final int readlimit) {
         super.mark(readlimit);
     }
 
     @Override
-    public synchronized void reset() throws IOException {
+    public void reset() throws IOException {
         super.reset();
     }
 
@@ -103,7 +134,12 @@ class LoggingInputStream extends InputStream {
 
     @Override
     public void close() throws IOException {
-        in.close();
+        try {
+            in.close();
+        } catch (IOException ex) {
+            wire.input("[close] I/O error: " + ex.getMessage());
+            throw ex;
+        }
     }
 
 }
diff --git a/httpclient/src/main/java/org/apache/http/impl/conn/LoggingOutputStream.java b/httpclient/src/main/java/org/apache/http/impl/conn/LoggingOutputStream.java
index db882cf..c70cb17 100644
--- a/httpclient/src/main/java/org/apache/http/impl/conn/LoggingOutputStream.java
+++ b/httpclient/src/main/java/org/apache/http/impl/conn/LoggingOutputStream.java
@@ -51,29 +51,54 @@ class LoggingOutputStream extends OutputStream {
 
     @Override
     public void write(final int b) throws IOException {
-        wire.output(b);
+        try {
+            wire.output(b);
+        } catch (IOException ex) {
+            wire.output("[write] I/O error: " + ex.getMessage());
+            throw ex;
+        }
     }
 
     @Override
     public void write(final byte[] b) throws IOException {
-        wire.output(b);
-        out.write(b);
+        try {
+            wire.output(b);
+            out.write(b);
+        } catch (IOException ex) {
+            wire.output("[write] I/O error: " + ex.getMessage());
+            throw ex;
+        }
     }
 
     @Override
     public void write(final byte[] b, final int off, final int len) throws IOException {
-        wire.output(b, off, len);
-        out.write(b, off, len);
+        try {
+            wire.output(b, off, len);
+            out.write(b, off, len);
+        } catch (IOException ex) {
+            wire.output("[write] I/O error: " + ex.getMessage());
+            throw ex;
+        }
     }
 
     @Override
     public void flush() throws IOException {
-        out.flush();
+        try {
+            out.flush();
+        } catch (IOException ex) {
+            wire.output("[flush] I/O error: " + ex.getMessage());
+            throw ex;
+        }
     }
 
     @Override
     public void close() throws IOException {
-        out.close();
+        try {
+            out.close();
+        } catch (IOException ex) {
+            wire.output("[close] I/O error: " + ex.getMessage());
+            throw ex;
+        }
     }
 
 }
diff --git a/httpclient/src/main/java/org/apache/http/impl/conn/Wire.java b/httpclient/src/main/java/org/apache/http/impl/conn/Wire.java
index 692c695..e3bffd3 100644
--- a/httpclient/src/main/java/org/apache/http/impl/conn/Wire.java
+++ b/httpclient/src/main/java/org/apache/http/impl/conn/Wire.java
@@ -138,20 +138,12 @@ public class Wire {
         input(new byte[] {(byte) b});
     }
 
-    /**
-     * @deprecated (4.1)  do not use
-     */
-    @Deprecated
     public void output(final String s)
       throws IOException {
         Args.notNull(s, "Output");
         output(s.getBytes());
     }
 
-    /**
-     * @deprecated (4.1)  do not use
-     */
-    @Deprecated
     public void input(final String s)
       throws IOException {
         Args.notNull(s, "Input");
diff --git a/httpclient/src/main/java/org/apache/http/impl/execchain/RetryExec.java b/httpclient/src/main/java/org/apache/http/impl/execchain/RetryExec.java
index 79f6c5e..ed0465c 100644
--- a/httpclient/src/main/java/org/apache/http/impl/execchain/RetryExec.java
+++ b/httpclient/src/main/java/org/apache/http/impl/execchain/RetryExec.java
@@ -33,6 +33,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.http.Header;
 import org.apache.http.HttpException;
+import org.apache.http.NoHttpResponseException;
 import org.apache.http.annotation.Immutable;
 import org.apache.http.client.HttpRequestRetryHandler;
 import org.apache.http.client.NonRepeatableRequestException;
@@ -91,7 +92,9 @@ public class RetryExec implements ClientExecChain {
                 if (retryHandler.retryRequest(ex, execCount, context)) {
                     if (this.log.isInfoEnabled()) {
                         this.log.info("I/O exception ("+ ex.getClass().getName() +
-                                ") caught when processing request: "
+                                ") caught when processing request to "
+                                + route +
+                                ": "
                                 + ex.getMessage());
                     }
                     if (this.log.isDebugEnabled()) {
@@ -103,9 +106,18 @@ public class RetryExec implements ClientExecChain {
                                 "with a non-repeatable request entity", ex);
                     }
                     request.setHeaders(origheaders);
-                    this.log.info("Retrying request");
+                    if (this.log.isInfoEnabled()) {
+                        this.log.info("Retrying request to " + route);
+                    }
                 } else {
-                    throw ex;
+                    if (ex instanceof NoHttpResponseException) {
+                        final NoHttpResponseException updatedex = new NoHttpResponseException(
+                                route.getTargetHost().toHostString() + " failed to respond");
+                        updatedex.setStackTrace(ex.getStackTrace());
+                        throw updatedex;
+                    } else {
+                        throw ex;
+                    }
                 }
             }
         }
diff --git a/httpclient/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java b/httpclient/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java
index 9e4b475..549b61d 100644
--- a/httpclient/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java
+++ b/httpclient/src/main/java/org/apache/http/impl/execchain/ServiceUnavailableRetryExec.java
@@ -32,6 +32,7 @@ import java.io.InterruptedIOException;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.http.Header;
 import org.apache.http.HttpException;
 import org.apache.http.annotation.Immutable;
 import org.apache.http.client.ServiceUnavailableRetryStrategy;
@@ -76,6 +77,7 @@ public class ServiceUnavailableRetryExec implements ClientExecChain {
             final HttpRequestWrapper request,
             final HttpClientContext context,
             final HttpExecutionAware execAware) throws IOException, HttpException {
+        final Header[] origheaders = request.getAllHeaders();
         for (int c = 1;; c++) {
             final CloseableHttpResponse response = this.requestExecutor.execute(
                     route, request, context, execAware);
@@ -92,6 +94,7 @@ public class ServiceUnavailableRetryExec implements ClientExecChain {
                             throw new InterruptedIOException();
                         }
                     }
+                    request.setHeaders(origheaders);
                 } else {
                     return response;
                 }
diff --git a/httpmime/pom.xml b/httpmime/pom.xml
index 052c62a..fe3fe30 100644
--- a/httpmime/pom.xml
+++ b/httpmime/pom.xml
@@ -28,7 +28,7 @@
   <parent>
     <groupId>org.apache.httpcomponents</groupId>
     <artifactId>httpcomponents-client</artifactId>
-    <version>4.3.2</version>
+    <version>4.3.3</version>
   </parent>
   <artifactId>httpmime</artifactId>
   <name>Apache HttpClient Mime</name>
diff --git a/httpmime/src/main/java/org/apache/http/entity/mime/FormBodyPart.java b/httpmime/src/main/java/org/apache/http/entity/mime/FormBodyPart.java
index 59735e9..b7cb7b6 100644
--- a/httpmime/src/main/java/org/apache/http/entity/mime/FormBodyPart.java
+++ b/httpmime/src/main/java/org/apache/http/entity/mime/FormBodyPart.java
@@ -27,6 +27,8 @@
 
 package org.apache.http.entity.mime;
 
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.mime.content.AbstractContentBody;
 import org.apache.http.entity.mime.content.ContentBody;
 import org.apache.http.util.Args;
 
@@ -88,13 +90,23 @@ public class FormBodyPart {
     }
 
     protected void generateContentType(final ContentBody body) {
-        final StringBuilder buffer = new StringBuilder();
-        buffer.append(body.getMimeType()); // MimeType cannot be null
-        if (body.getCharset() != null) { // charset may legitimately be null
-            buffer.append("; charset=");
-            buffer.append(body.getCharset());
+        final ContentType contentType;
+        if (body instanceof AbstractContentBody) {
+            contentType = ((AbstractContentBody) body).getContentType();
+        } else {
+            contentType = null;
+        }
+        if (contentType != null) {
+            addField(MIME.CONTENT_TYPE, contentType.toString());
+        } else {
+            final StringBuilder buffer = new StringBuilder();
+            buffer.append(body.getMimeType()); // MimeType cannot be null
+            if (body.getCharset() != null) { // charset may legitimately be null
+                buffer.append("; charset=");
+                buffer.append(body.getCharset());
+            }
+            addField(MIME.CONTENT_TYPE, buffer.toString());
         }
-        addField(MIME.CONTENT_TYPE, buffer.toString());
     }
 
     protected void generateTransferEncoding(final ContentBody body) {
diff --git a/httpmime/src/test/java/org/apache/http/entity/mime/TestMultipartForm.java b/httpmime/src/test/java/org/apache/http/entity/mime/TestMultipartForm.java
index 170c7d3..840a8c0 100644
--- a/httpmime/src/test/java/org/apache/http/entity/mime/TestMultipartForm.java
+++ b/httpmime/src/test/java/org/apache/http/entity/mime/TestMultipartForm.java
@@ -100,6 +100,40 @@ public class TestMultipartForm {
     }
 
     @Test
+    public void testMultipartFormCustomContentType() throws Exception {
+        final FormBodyPart p1 = new FormBodyPart(
+                "field1",
+                new StringBody("this stuff", ContentType.DEFAULT_TEXT));
+        final FormBodyPart p2 = new FormBodyPart(
+                "field2",
+                new StringBody("that stuff", ContentType.parse("stuff/plain; param=value")));
+        final HttpStrictMultipart multipart = new HttpStrictMultipart("form-data", null, "foo",
+                Arrays.asList(p1, p2));
+
+        final ByteArrayOutputStream out = new ByteArrayOutputStream();
+        multipart.writeTo(out);
+        out.close();
+
+        final String expected =
+                "--foo\r\n" +
+                        "Content-Disposition: form-data; name=\"field1\"\r\n" +
+                        "Content-Type: text/plain; charset=ISO-8859-1\r\n" +
+                        "Content-Transfer-Encoding: 8bit\r\n" +
+                        "\r\n" +
+                        "this stuff\r\n" +
+                        "--foo\r\n" +
+                        "Content-Disposition: form-data; name=\"field2\"\r\n" +
+                        "Content-Type: stuff/plain; param=value\r\n" +
+                        "Content-Transfer-Encoding: 8bit\r\n" +
+                        "\r\n" +
+                        "that stuff\r\n" +
+                        "--foo--\r\n";
+        final String s = out.toString("US-ASCII");
+        Assert.assertEquals(expected, s);
+        Assert.assertEquals(s.length(), multipart.getTotalLength());
+    }
+
+    @Test
     public void testMultipartFormBinaryParts() throws Exception {
         tmpfile = File.createTempFile("tmp", ".bin");
         final Writer writer = new FileWriter(tmpfile);
diff --git a/pom.xml b/pom.xml
index 3f28abc..5caa9ad 100644
--- a/pom.xml
+++ b/pom.xml
@@ -33,7 +33,7 @@
   <modelVersion>4.0.0</modelVersion>
   <artifactId>httpcomponents-client</artifactId>
   <name>HttpComponents Client</name>
-  <version>4.3.2</version>
+  <version>4.3.3</version>
   <description>Apache HttpComponents Client is a library of components for building client side HTTP services</description>
   <url>http://hc.apache.org/httpcomponents-client</url>
   <inceptionYear>1999</inceptionYear>
@@ -58,13 +58,13 @@
   </issueManagement>
 
   <scm>
-    <connection>scm:svn:https://svn.apache.org/repos/asf/httpcomponents/httpclient/tags/4.3.2</connection>
-    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/httpcomponents/httpclient/tags/4.3.2</developerConnection>
-    <url>https://svn.apache.org/repos/asf/httpcomponents/httpclient/tags/4.3.2</url>
+    <connection>scm:svn:https://svn.apache.org/repos/asf/httpcomponents/httpclient/tags/4.3.3</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/httpcomponents/httpclient/tags/4.3.3</developerConnection>
+    <url>https://svn.apache.org/repos/asf/httpcomponents/httpclient/tags/4.3.3</url>
   </scm>
 
   <properties>
-    <httpcore.version>4.3.1</httpcore.version>
+    <httpcore.version>4.3.2</httpcore.version>
     <commons-logging.version>1.1.3</commons-logging.version>
     <commons-codec.version>1.6</commons-codec.version>
     <ehcache.version>2.2.0</ehcache.version>
@@ -164,7 +164,6 @@
     <module>httpmime</module>
     <module>fluent-hc</module>
     <module>httpclient-cache</module>
-    <!--module>httpclient-win</module-->
     <module>httpclient-osgi</module>
   </modules>
 
diff --git a/src/docbkx/caching.xml b/src/docbkx/caching.xml
index 6cd06c6..aa13d27 100644
--- a/src/docbkx/caching.xml
+++ b/src/docbkx/caching.xml
@@ -151,7 +151,7 @@ RequestConfig requestConfig = RequestConfig.custom()
         .setConnectTimeout(30000)
         .setSocketTimeout(30000)
         .build();
-CloseableHttpClient cachingClient = caching HttpClients.custom()
+CloseableHttpClient cachingClient = CachingHttpClients.custom()
         .setCacheConfig(cacheConfig)
         .setDefaultRequestConfig(requestConfig)
         .build();
diff --git a/src/docbkx/fundamentals.xml b/src/docbkx/fundamentals.xml
index 6e1ffc4..7fd52d2 100644
--- a/src/docbkx/fundamentals.xml
+++ b/src/docbkx/fundamentals.xml
@@ -394,7 +394,8 @@ if (entity != null) {
                 <classname>FileEntity</classname>.</para>
             <programlisting><![CDATA[
 File file = new File("somefile.txt");
-FileEntity entity = new FileEntity(file, ContentType.create("text/plain", "UTF-8"));        
+FileEntity entity = new FileEntity(file, 
+    ContentType.create("text/plain", "UTF-8"));        
 
 HttpPost httppost = new HttpPost("http://localhost/action.do");
 httppost.setEntity(entity);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/httpcomponents-client.git



More information about the pkg-java-commits mailing list