From 22b412f880b41651d4e8718f108d0c30b832b73a Mon Sep 17 00:00:00 2001
From: Oleg Kalnichevski
Date: Sun, 24 May 2015 13:01:39 +0000
Subject: [PATCH 001/204] HttpClient 4.5.x branch
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1681444 13f79535-47bb-0310-9956-ffa450edef68
From 1fc51847e7ba824ef8d0616b9d16b2861a9978f9 Mon Sep 17 00:00:00 2001
From: Oleg Kalnichevski
Date: Tue, 26 May 2015 18:59:46 +0000
Subject: [PATCH 002/204] HTTPCLIENT-1650: fluent Executor to create a local
CredentialsProvide instance only if credentials are explicitly set
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1681815 13f79535-47bb-0310-9956-ffa450edef68
---
.../apache/http/client/fluent/Executor.java | 49 +++++++++++++++----
1 file changed, 40 insertions(+), 9 deletions(-)
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 fa2184b7c2..187cf89587 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
@@ -111,19 +111,28 @@ public static Executor newInstance(final HttpClient httpclient) {
}
private final HttpClient httpclient;
- private final AuthCache authCache;
- private final CredentialsProvider credentialsProvider;
-
+ private volatile AuthCache authCache;
+ private volatile CredentialsProvider credentialsProvider;
private volatile CookieStore cookieStore;
Executor(final HttpClient httpclient) {
super();
this.httpclient = httpclient;
- this.credentialsProvider = new BasicCredentialsProvider();
this.authCache = new BasicAuthCache();
}
+ /**
+ * @since 4.5
+ */
+ public Executor use(final CredentialsProvider credentialsProvider) {
+ this.credentialsProvider = credentialsProvider;
+ return this;
+ }
+
public Executor auth(final AuthScope authScope, final Credentials creds) {
+ if (this.credentialsProvider == null) {
+ this.credentialsProvider = new BasicCredentialsProvider();
+ }
this.credentialsProvider.setCredentials(authScope, creds);
return this;
}
@@ -200,17 +209,33 @@ public Executor auth(final HttpHost host,
}
public Executor clearAuth() {
- this.credentialsProvider.clear();
+ if (this.credentialsProvider != null) {
+ this.credentialsProvider.clear();
+ }
return this;
}
+ /**
+ * @deprecated (4.5) Use {@link #use(CookieStore)}.
+ */
+ @Deprecated
public Executor cookieStore(final CookieStore cookieStore) {
this.cookieStore = cookieStore;
return this;
}
+ /**
+ * @since 4.5
+ */
+ public Executor use(final CookieStore cookieStore) {
+ this.cookieStore = cookieStore;
+ return this;
+ }
+
public Executor clearCookies() {
- this.cookieStore.clear();
+ if (this.cookieStore != null) {
+ this.cookieStore.clear();
+ }
return this;
}
@@ -225,9 +250,15 @@ public Executor clearCookies() {
public Response execute(
final Request request) throws ClientProtocolException, IOException {
final HttpClientContext localContext = HttpClientContext.create();
- localContext.setAttribute(HttpClientContext.CREDS_PROVIDER, this.credentialsProvider);
- localContext.setAttribute(HttpClientContext.AUTH_CACHE, this.authCache);
- localContext.setAttribute(HttpClientContext.COOKIE_STORE, this.cookieStore);
+ if (this.credentialsProvider != null) {
+ localContext.setAttribute(HttpClientContext.CREDS_PROVIDER, this.credentialsProvider);
+ }
+ if (this.authCache != null) {
+ localContext.setAttribute(HttpClientContext.AUTH_CACHE, this.authCache);
+ }
+ if (this.cookieStore != null) {
+ localContext.setAttribute(HttpClientContext.COOKIE_STORE, this.cookieStore);
+ }
return new Response(request.internalExecute(this.httpclient, localContext));
}
From 0ad9857ed81747249f710c6519a638d3b0b6a5d0 Mon Sep 17 00:00:00 2001
From: Oleg Kalnichevski
Date: Wed, 27 May 2015 14:22:21 +0000
Subject: [PATCH 003/204] Fixed regresson in a deprecated method of FileBody
Contributed by Andrey Pohilko
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1682040 13f79535-47bb-0310-9956-ffa450edef68
---
.../http/entity/mime/content/FileBody.java | 2 +-
.../http/entity/mime/FormBodyPartTest.java | 45 +++++++++++++++++++
2 files changed, 46 insertions(+), 1 deletion(-)
create mode 100644 httpmime/src/test/java/org/apache/http/entity/mime/FormBodyPartTest.java
diff --git a/httpmime/src/main/java/org/apache/http/entity/mime/content/FileBody.java b/httpmime/src/main/java/org/apache/http/entity/mime/content/FileBody.java
index 877dcc4462..9236fe915a 100644
--- a/httpmime/src/main/java/org/apache/http/entity/mime/content/FileBody.java
+++ b/httpmime/src/main/java/org/apache/http/entity/mime/content/FileBody.java
@@ -96,7 +96,7 @@ public FileBody(final File file, final ContentType contentType, final String fil
super(contentType);
Args.notNull(file, "File");
this.file = file;
- this.filename = filename;
+ this.filename = filename == null ? file.getName() : filename;
}
/**
diff --git a/httpmime/src/test/java/org/apache/http/entity/mime/FormBodyPartTest.java b/httpmime/src/test/java/org/apache/http/entity/mime/FormBodyPartTest.java
new file mode 100644
index 0000000000..5f7f5c06cd
--- /dev/null
+++ b/httpmime/src/test/java/org/apache/http/entity/mime/FormBodyPartTest.java
@@ -0,0 +1,45 @@
+/*
+ * ====================================================================
+ * 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
+ * .
+ *
+ */
+
+package org.apache.http.entity.mime;
+
+import org.apache.http.entity.mime.content.FileBody;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.File;
+
+public class FormBodyPartTest {
+
+ @Test
+ public void testConstructorCompat() throws Exception {
+ final File tmp= File.createTempFile("test", "test");
+ tmp.deleteOnExit();
+ final FileBody obj=new FileBody(tmp, "application/octet-stream");
+ Assert.assertEquals(tmp.getName(), obj.getFilename());
+ }
+}
\ No newline at end of file
From ed396445436a0c30cd9e078e2cea1298ac595c6d Mon Sep 17 00:00:00 2001
From: Michael Osipov
Date: Thu, 28 May 2015 13:47:24 +0000
Subject: [PATCH 004/204] Fixed typo in exception message
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1682244 13f79535-47bb-0310-9956-ffa450edef68
---
.../apache/http/client/protocol/ResponseContentEncoding.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/httpclient/src/main/java/org/apache/http/client/protocol/ResponseContentEncoding.java b/httpclient/src/main/java/org/apache/http/client/protocol/ResponseContentEncoding.java
index 9e4c19aea0..9cb4adbbec 100644
--- a/httpclient/src/main/java/org/apache/http/client/protocol/ResponseContentEncoding.java
+++ b/httpclient/src/main/java/org/apache/http/client/protocol/ResponseContentEncoding.java
@@ -143,7 +143,7 @@ public void process(
response.removeHeaders("Content-MD5");
} else {
if (!"identity".equals(codecname) && !ignoreUnknown) {
- throw new HttpException("Unsupported Content-Coding: " + codec.getName());
+ throw new HttpException("Unsupported Content-Encoding: " + codec.getName());
}
}
}
From 6cd90f89bef50517312e7d027ea6094821566480 Mon Sep 17 00:00:00 2001
From: Michael Osipov
Date: Sat, 30 May 2015 19:38:50 +0000
Subject: [PATCH 005/204] HTTPCLIENT-1651: Add ability to disable content
compression on a request basis
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1682646 13f79535-47bb-0310-9956-ffa450edef68
---
.../http/client/config/RequestConfig.java | 33 ++++++++++++++++---
.../protocol/RequestAcceptEncoding.java | 6 +++-
.../http/client/config/TestRequestConfig.java | 3 ++
3 files changed, 37 insertions(+), 5 deletions(-)
diff --git a/httpclient/src/main/java/org/apache/http/client/config/RequestConfig.java b/httpclient/src/main/java/org/apache/http/client/config/RequestConfig.java
index c3b707152c..08c27a1b77 100644
--- a/httpclient/src/main/java/org/apache/http/client/config/RequestConfig.java
+++ b/httpclient/src/main/java/org/apache/http/client/config/RequestConfig.java
@@ -59,12 +59,13 @@ public class RequestConfig implements Cloneable {
private final int connectTimeout;
private final int socketTimeout;
private final boolean decompressionEnabled;
+ private final boolean contentCompressionEnabled;
/**
* Intended for CDI compatibility
*/
protected RequestConfig() {
- this(false, null, null, false, null, false, false, false, 0, false, null, null, 0, 0, 0, false);
+ this(false, null, null, false, null, false, false, false, 0, false, null, null, 0, 0, 0, false, false);
}
RequestConfig(
@@ -83,7 +84,8 @@ protected RequestConfig() {
final int connectionRequestTimeout,
final int connectTimeout,
final int socketTimeout,
- final boolean decompressionEnabled) {
+ final boolean decompressionEnabled,
+ final boolean contentCompressionEnabled) {
super();
this.expectContinueEnabled = expectContinueEnabled;
this.proxy = proxy;
@@ -101,6 +103,7 @@ protected RequestConfig() {
this.connectTimeout = connectTimeout;
this.socketTimeout = socketTimeout;
this.decompressionEnabled = decompressionEnabled;
+ this.contentCompressionEnabled = contentCompressionEnabled;
}
/**
@@ -317,6 +320,18 @@ public boolean isDecompressionEnabled() {
return decompressionEnabled;
}
+ /**
+ * Determines whether the target server is requested to compress content.
+ *
+ * Default: {@code true}
+ *
+ *
+ * @since 4.5
+ */
+ public boolean isContentCompressionEnabled() {
+ return contentCompressionEnabled;
+ }
+
@Override
protected RequestConfig clone() throws CloneNotSupportedException {
return (RequestConfig) super.clone();
@@ -341,6 +356,7 @@ public String toString() {
builder.append(", connectTimeout=").append(connectTimeout);
builder.append(", socketTimeout=").append(socketTimeout);
builder.append(", decompressionEnabled=").append(decompressionEnabled);
+ builder.append(", contentCompressionEnabled=").append(contentCompressionEnabled);
builder.append("]");
return builder.toString();
}
@@ -367,7 +383,8 @@ public static RequestConfig.Builder copy(final RequestConfig config) {
.setConnectionRequestTimeout(config.getConnectionRequestTimeout())
.setConnectTimeout(config.getConnectTimeout())
.setSocketTimeout(config.getSocketTimeout())
- .setDecompressionEnabled(config.isDecompressionEnabled());
+ .setDecompressionEnabled(config.isDecompressionEnabled())
+ .setContentCompressionEnabled(config.isContentCompressionEnabled());
}
public static class Builder {
@@ -388,6 +405,7 @@ public static class Builder {
private int connectTimeout;
private int socketTimeout;
private boolean decompressionEnabled;
+ private boolean contentCompressionEnabled;
Builder() {
super();
@@ -400,6 +418,7 @@ public static class Builder {
this.connectTimeout = -1;
this.socketTimeout = -1;
this.decompressionEnabled = true;
+ this.contentCompressionEnabled = true;
}
public Builder setExpectContinueEnabled(final boolean expectContinueEnabled) {
@@ -487,6 +506,11 @@ public Builder setDecompressionEnabled(final boolean decompressionEnabled) {
return this;
}
+ public Builder setContentCompressionEnabled(final boolean contentCompressionEnabled) {
+ this.contentCompressionEnabled = contentCompressionEnabled;
+ return this;
+ }
+
public RequestConfig build() {
return new RequestConfig(
expectContinueEnabled,
@@ -504,7 +528,8 @@ public RequestConfig build() {
connectionRequestTimeout,
connectTimeout,
socketTimeout,
- decompressionEnabled);
+ decompressionEnabled,
+ contentCompressionEnabled);
}
}
diff --git a/httpclient/src/main/java/org/apache/http/client/protocol/RequestAcceptEncoding.java b/httpclient/src/main/java/org/apache/http/client/protocol/RequestAcceptEncoding.java
index 9209ac8b7b..9b260e2066 100644
--- a/httpclient/src/main/java/org/apache/http/client/protocol/RequestAcceptEncoding.java
+++ b/httpclient/src/main/java/org/apache/http/client/protocol/RequestAcceptEncoding.java
@@ -33,6 +33,7 @@
import org.apache.http.HttpRequest;
import org.apache.http.HttpRequestInterceptor;
import org.apache.http.annotation.Immutable;
+import org.apache.http.client.config.RequestConfig;
import org.apache.http.protocol.HttpContext;
/**
@@ -76,8 +77,11 @@ public void process(
final HttpRequest request,
final HttpContext context) throws HttpException, IOException {
+ final HttpClientContext clientContext = HttpClientContext.adapt(context);
+ final RequestConfig requestConfig = clientContext.getRequestConfig();
+
/* Signal support for Accept-Encoding transfer encodings. */
- if (!request.containsHeader("Accept-Encoding")) {
+ if (!request.containsHeader("Accept-Encoding") && requestConfig.isContentCompressionEnabled()) {
request.addHeader("Accept-Encoding", acceptEncoding);
}
}
diff --git a/httpclient/src/test/java/org/apache/http/client/config/TestRequestConfig.java b/httpclient/src/test/java/org/apache/http/client/config/TestRequestConfig.java
index f37f64d244..68c70fc8b3 100644
--- a/httpclient/src/test/java/org/apache/http/client/config/TestRequestConfig.java
+++ b/httpclient/src/test/java/org/apache/http/client/config/TestRequestConfig.java
@@ -59,6 +59,7 @@ public void testDefaults() {
Assert.assertEquals(null, config.getProxy());
Assert.assertEquals(null, config.getTargetPreferredAuthSchemes());
Assert.assertEquals(null, config.getProxyPreferredAuthSchemes());
+ Assert.assertEquals(true, config.isContentCompressionEnabled());
}
@Test
@@ -78,6 +79,7 @@ public void testBuildAndCopy() throws Exception {
.setProxy(new HttpHost("someproxy"))
.setTargetPreferredAuthSchemes(Arrays.asList(AuthSchemes.NTLM))
.setProxyPreferredAuthSchemes(Arrays.asList(AuthSchemes.DIGEST))
+ .setContentCompressionEnabled(false)
.build();
final RequestConfig config = RequestConfig.copy(config0).build();
Assert.assertEquals(22, config.getSocketTimeout());
@@ -94,6 +96,7 @@ public void testBuildAndCopy() throws Exception {
Assert.assertEquals(new HttpHost("someproxy"), config.getProxy());
Assert.assertEquals(Arrays.asList(AuthSchemes.NTLM), config.getTargetPreferredAuthSchemes());
Assert.assertEquals(Arrays.asList(AuthSchemes.DIGEST), config.getProxyPreferredAuthSchemes());
+ Assert.assertEquals(false, config.isContentCompressionEnabled());
}
}
From 8501cb9b0c029fb488a7701a11513ce789422105 Mon Sep 17 00:00:00 2001
From: Michael Osipov
Date: Sat, 30 May 2015 19:43:22 +0000
Subject: [PATCH 006/204] git-svn-id:
https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1682647
13f79535-47bb-0310-9956-ffa450edef68
---
RELEASE_NOTES.txt | 362 +++++++++++++++++++++++-----------------------
1 file changed, 182 insertions(+), 180 deletions(-)
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 8cc7589284..e0fdcfc8ae 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -25,6 +25,8 @@ Changelog:
* [HTTPCLIENT-1613]: Support for private domains in Mozilla Public Suffix List.
Contributed by Oleg Kalnichevski
+* [HTTPCLIENT-1651]: Add ability to disable content compression on a request basis
+ Contributed by Michael Osipov
Release 4.4.1
@@ -61,18 +63,18 @@ Release 4.4 Final
This is the first stable (GA) release of HttpClient 4.4. Notable features and enhancements included
in 4.4 series are:
-* Support for the latest HTTP state management specification (RFC 6265). Please note that the old
-cookie policy is still used by default for compatibility reasons. RFC 6265 compliant cookie
-policies need to be explicitly configured by the user. Please also note that as of next feature
-release support for Netscape draft, RFC 2109 and RFC 2965 cookie policies will be deprecated
-and disabled by default. It is recommended to use RFC 6265 compliant policies for new applications
-unless compatibility with RFC 2109 and RFC 2965 is required and to migrate existing applications
+* Support for the latest HTTP state management specification (RFC 6265). Please note that the old
+cookie policy is still used by default for compatibility reasons. RFC 6265 compliant cookie
+policies need to be explicitly configured by the user. Please also note that as of next feature
+release support for Netscape draft, RFC 2109 and RFC 2965 cookie policies will be deprecated
+and disabled by default. It is recommended to use RFC 6265 compliant policies for new applications
+unless compatibility with RFC 2109 and RFC 2965 is required and to migrate existing applications
to the default cookie policy.
* Enhanced, redesigned and rewritten default SSL hostname verifier with improved RFC 2818
compliance
-* Default SSL hostname verifier and default cookie policy now validate certificate identity
+* Default SSL hostname verifier and default cookie policy now validate certificate identity
and cookie domain of origin against the public suffix list maintained by Mozilla.org
@@ -103,28 +105,28 @@ Changelog:
Contributed by Oleg Kalnichevski
* [HTTPCLIENT-1515] Caching of responses to HEAD requests
- Contributed by Tyrone Cutajar and
- Francois-Xavier Bonnet
+ Contributed by Tyrone Cutajar and
+ Francois-Xavier Bonnet
* [HTTPCLIENT-1560] Native Windows auth improvements
Contributed by Michael Osipov
-* Update Apache Commons Logging version from 1.1.3 to 1.2.
+* Update Apache Commons Logging version from 1.1.3 to 1.2.
Contributed by Gary Gregory
-* Update Apache Commons Codec version from 1.6 to 1.9.
+* Update Apache Commons Codec version from 1.6 to 1.9.
Contributed by Gary Gregory
-* Update Ehcache version from 2.2.0 to 2.6.9.
+* Update Ehcache version from 2.2.0 to 2.6.9.
Contributed by Gary Gregory
-* Update Ehcache version from 2.2.0 to 2.6.9.
+* Update Ehcache version from 2.2.0 to 2.6.9.
Contributed by Gary Gregory
-* Update Spymemcached version from 2.6 to 2.11.4.
+* Update Spymemcached version from 2.6 to 2.11.4.
Contributed by Gary Gregory
-* Update SLF4J version from 1.5.11 to 1.7.7.
+* Update SLF4J version from 1.5.11 to 1.7.7.
Contributed by Gary Gregory
@@ -140,7 +142,7 @@ in 4.4 series are:
* Enhanced redesigned and rewritten default SSL hostname verifier with improved RFC 2818
compliance
-* Default SSL hostname verifier and default cookie policy now validate certificate identity
+* Default SSL hostname verifier and default cookie policy now validate certificate identity
and cookie domain of origin against the public suffix list maintained by Mozilla.org
@@ -245,7 +247,7 @@ Changelog:
* [HTTPCLIENT-1454] Make connection operator APIs public.
Contributed by Tamas Cservenak
-* Update JUnit to version 4.11 from 4.9
+* Update JUnit to version 4.11 from 4.9
Contributed by Gary Gregory
@@ -253,9 +255,9 @@ Changelog:
Release 4.3.4
-------------------
-HttpClient 4.3.4 (GA) is a maintenance release that improves performance in high concurrency
-scenarios. This version replaces dynamic proxies with custom proxy classes and eliminates thread
-contention in java.reflect.Proxy.newInstance() when leasing connections from the connection pool
+HttpClient 4.3.4 (GA) is a maintenance release that improves performance in high concurrency
+scenarios. This version replaces dynamic proxies with custom proxy classes and eliminates thread
+contention in java.reflect.Proxy.newInstance() when leasing connections from the connection pool
and processing response messages.
@@ -272,7 +274,7 @@ Changelog:
* [HTTPCLIENT-1474] Fixed broken entity enclosing requests in HC Fluent.
Contributed by Oleg Kalnichevski
-* [HTTPCLIENT-1470] CachingExec(ClientExecChain, HttpCache, CacheConfig, AsynchronousValidator)
+* [HTTPCLIENT-1470] CachingExec(ClientExecChain, HttpCache, CacheConfig, AsynchronousValidator)
throws NPE if config is null
@@ -293,7 +295,7 @@ Changelog:
Contributed by Oleg Kalnichevski
* [HTTPCLIENT-1453] Thread safety regression in PoolingHttpClientConnectionManager
- #closeExpiredConnections that can lead to ConcurrentModificationException.
+ #closeExpiredConnections that can lead to ConcurrentModificationException.
Contributed by Oleg Kalnichevski
* [HTTPCLIENT-1461] fixed performance degradation in compressed content processing
@@ -311,9 +313,9 @@ Changelog:
Release 4.3.2
-------------------
-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.
+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.
Users of HttpClient 4.3 are encouraged to upgrade.
@@ -322,7 +324,7 @@ Changelog:
* [HTTPCLIENT-1447] Clients created with HttpClients.createMinimal do not work with absolute URIs
Contributed by Joseph Walton
-
+
* [HTTPCLIENT-1446] NTLM proxy + BASIC target auth fails with 'Unexpected state:
MSG_TYPE3_GENERATED'.
Contributed by Oleg Kalnichevski
@@ -344,7 +346,7 @@ Changelog:
Contributed by Oleg Kalnichevski
* [HTTPCLIENT-1119] SNI support (Oracle Java 1.7+ only).
- Contributed by Bruno Harbulot
+ Contributed by Bruno Harbulot
* [HTTPCLIENT-1435] Fluent Executor ignores custom request properties.
Contributed by Oleg Kalnichevski
@@ -357,7 +359,7 @@ Changelog:
a custom LayeredSchemeSocketFactory.
Contributed by Oleg Kalnichevski
-* [HTTPCLIENT-1425] Fixed socket closed exception thrown by caching HttpClient when the origin
+* [HTTPCLIENT-1425] Fixed socket closed exception thrown by caching HttpClient when the origin
server sends a long chunked response.
Contributed by James Leigh
@@ -373,8 +375,8 @@ Changelog:
Release 4.3.1
-------------------
-HttpClient 4.3.1 (GA) is a bug fix release that addresses a number of issues reported since
-release 4.3.
+HttpClient 4.3.1 (GA) is a bug fix release that addresses a number of issues reported since
+release 4.3.
Users of HttpClient 4.3 are strongly encouraged to upgrade.
@@ -392,7 +394,7 @@ Changelog
Contributed by Oleg Kalnichevski
* [HTTPCLIENT-1402] Cache default User-Agent value.
- Contributed by yuexiaojun
+ Contributed by yuexiaojun
* [HTTPCLIENT-1398] Fixed invalid OSGi metadata caused by corrupted Maven bundle plugin metadata.
Contributed by Oleg Kalnichevski
@@ -406,32 +408,32 @@ Changelog
Release 4.3 Final
-------------------
-This is the first stable (GA) release of HttpClient 4.3. The most notable enhancements included
+This is the first stable (GA) release of HttpClient 4.3. The most notable enhancements included
in this release are:
* Support for Java 7 try-with-resources for resource management (connection release.)
-* Added fluent Builder classes for HttpEntity, HttpRequest, HttpClient and SSLContext instances.
+* Added fluent Builder classes for HttpEntity, HttpRequest, HttpClient and SSLContext instances.
* Deprecation of preference and configuration API based on HttpParams interface in favor of
constructor injection and plain configuration objects.
-* Reliance on object immutability instead of access synchronization for thread safety.
+* Reliance on object immutability instead of access synchronization for thread safety.
Several old classes whose instances can be shared by multiple request exchanges have
-been replaced by immutable equivalents.
+been replaced by immutable equivalents.
-* DefaultHttpClient, DecompressingHttpClient, CachingHttpClient and similar classes are
-deprecated in favor of builder classes that produce immutable HttpClient instances.
+* DefaultHttpClient, DecompressingHttpClient, CachingHttpClient and similar classes are
+deprecated in favor of builder classes that produce immutable HttpClient instances.
-* HttpClient builders now dynamically construct a request execution pipeline tailored
+* HttpClient builders now dynamically construct a request execution pipeline tailored
specifically to the user configuration by physically excluding unnecessary protocol components.
-* There is now an option to construct a minimal HttpClient implementation that can only execute
+* There is now an option to construct a minimal HttpClient implementation that can only execute
basic HTTP message exchanges without redirects, authentication, state management or proxy support.
-This feature might be of particular use in web crawler development.
+This feature might be of particular use in web crawler development.
-* There is now option to avoid strict URI syntax for request URIs by executing HTTP requests
-with an explicitly specified target host. HttpClient will no longer attempt to parse the request
+* There is now option to avoid strict URI syntax for request URIs by executing HTTP requests
+with an explicitly specified target host. HttpClient will no longer attempt to parse the request
URI if it does not need to extract the target host from it.
This release also includes all fixes from the stable 4.2.x release branch.
@@ -443,11 +445,11 @@ Changelog
Contributed by James Leigh
* [HTTPCLIENT-1394] Support for Native windows Negotiate/NTLM via JNA
- Contributed by Ryan McKinley
+ Contributed by Ryan McKinley
* [HTTPCLIENT-1384] Expose CacheInvalidator interface.
Contributed by Nicolas Richeton
-
+
* [HTTPCLIENT-1385] Fixed path normalization in CacheKeyGenerator
Contributed by James Leigh
@@ -458,8 +460,8 @@ Changelog
* [HTTPCLIENT-1373] OPTIONS and TRACE should not invalidate cache
Contributed by James Leigh
-* [HTTPCLIENT-1383] HttpClient enters an infinite loop during NTLM authentication if the opposite
- endpoint keeps responding with a type 2 NTLM response after type 3 MTLM message has already been
+* [HTTPCLIENT-1383] HttpClient enters an infinite loop during NTLM authentication if the opposite
+ endpoint keeps responding with a type 2 NTLM response after type 3 MTLM message has already been
sent by the client.
Contributed by Oleg Kalnichevski
@@ -467,7 +469,7 @@ Changelog
are no longer constrained to ASCII values.
Contributed by Karl Wright
-* [HTTPCLIENT-1377] User principal for non-NTLM authentication is incorrectly generated when using
+* [HTTPCLIENT-1377] User principal for non-NTLM authentication is incorrectly generated when using
user credentials are specified as NTCredentials
Contributed by Gary Gregory
@@ -476,12 +478,12 @@ Changelog
Release 4.3 BETA2
-------------------
-This is the second BETA release of HttpClient 4.3. The most notable features and improvements
-in the 4.3 branch are: Support for Java 7 try-with-resources for resource management (connection
-release); fluent Builder classes for HttpEntity, HttpRequest and HttpClient instances, deprecation
-of preference and configuration API based on HttpParams interface in favor of constructor injection
-and plain configuration objects, reliance on object immutability instead of access synchronization
-for thread safety.
+This is the second BETA release of HttpClient 4.3. The most notable features and improvements
+in the 4.3 branch are: Support for Java 7 try-with-resources for resource management (connection
+release); fluent Builder classes for HttpEntity, HttpRequest and HttpClient instances, deprecation
+of preference and configuration API based on HttpParams interface in favor of constructor injection
+and plain configuration objects, reliance on object immutability instead of access synchronization
+for thread safety.
This release also includes all fixes from the stable 4.2.x release branch.
@@ -495,7 +497,7 @@ Changelog
* [HTTPCLIENT-1365] NPE when ManagedHttpClientConnectionFactory.create(ConnectionConfig) is called with null.
Contributed by Gary Gregory
-* [HTTPCLIENT-1362] Better error messages for connect timed out and connection refused
+* [HTTPCLIENT-1362] Better error messages for connect timed out and connection refused
exceptions.
Contributed by Oleg Kalnichevski
@@ -511,17 +513,17 @@ Changelog
* [HTTPCLIENT-1351] Added utility method to resolve final location from original request,
target host and a list of redirects.
- Contributed by James Leigh
+ Contributed by James Leigh
-* [HTTPCLIENT-1344] Userinfo credentials in URI should not default to preemptive BASIC
- authentication.
+* [HTTPCLIENT-1344] Userinfo credentials in URI should not default to preemptive BASIC
+ authentication.
Contributed by Oleg Kalnichevski
-* [HTTPCLIENT-1345] Useinfo credentials ignored in redirect location header.
+* [HTTPCLIENT-1345] Useinfo credentials ignored in redirect location header.
Contributed by Oleg Kalnichevski
-* [HTTPCLIENT-1294] HttpClient to rewrite host name of the redirect location URI in order
- to avoid circular redirect exception due to host name case mismatch.
+* [HTTPCLIENT-1294] HttpClient to rewrite host name of the redirect location URI in order
+ to avoid circular redirect exception due to host name case mismatch.
Contributed by Oleg Kalnichevski
* [HTTPCLIENT-1264] Add support for multiple levels of browser compatibility
@@ -529,26 +531,26 @@ Changelog
argument for IE medium-security compatibility.
Contributed by Karl Wright (kwright at apache.org)
-* [HTTPCLIENT-1349] SSLSocketFactory incorrectly identifies key passed with keystore as
+* [HTTPCLIENT-1349] SSLSocketFactory incorrectly identifies key passed with keystore as
the keystore password.
Contributed by David Graff
* [HTTPCLIENT-1346] Ensure propagation of SSL handshake exceptions.
Contributed by Pasi Eronen
-* [HTTPCLIENT-1343] SSLSocketFactory optional parameters for supported SSL protocols and cipher
- suites.
+* [HTTPCLIENT-1343] SSLSocketFactory optional parameters for supported SSL protocols and cipher
+ suites.
Contributed by Oleg Kalnichevski
* [HTTPCLIENT-1238] Contribute Bundle Activator And Central Proxy Configuration.
- Contributed by Simone Tripodi
+ Contributed by Simone Tripodi
-* [HTTPCLIENT-1299] (regression) cache incorrectly disposes of the underlying cache resource
+* [HTTPCLIENT-1299] (regression) cache incorrectly disposes of the underlying cache resource
when storing variant entry.
- Contributed by James Leigh
+ Contributed by James Leigh
* [HTTPCLIENT-1342] Redirects with underscore character in the location hostname cause
- "java.lang.IllegalArgumentException: Host name may not be null".
+ "java.lang.IllegalArgumentException: Host name may not be null".
Contributed by Oleg Kalnichevski
@@ -557,10 +559,10 @@ Release 4.3 BETA1
-------------------
This is the first BETA release of HttpClient 4.3. The 4.3 branch enhances HttpClient in several
-key areas and includes several notable features and improvements: Support for Java 7
-try-with-resources for resource management (connection release); fluent Builder classes for
-HttpEntity, HttpRequest and HttpClient instances, deprecation of preference and configuration API
-based on HttpParams interface in favor of constructor injection and plain configuration objects,
+key areas and includes several notable features and improvements: Support for Java 7
+try-with-resources for resource management (connection release); fluent Builder classes for
+HttpEntity, HttpRequest and HttpClient instances, deprecation of preference and configuration API
+based on HttpParams interface in favor of constructor injection and plain configuration objects,
reliance on object immutability instead of access synchronization for thread safety.
This release also includes all fixes from the stable 4.2.x release branch.
@@ -569,10 +571,10 @@ This release also includes all fixes from the stable 4.2.x release branch.
Changelog
-------------------
-* [HTTPCLIENT-1317] InetAddressUtils should handle IPv6 Addresses with Embedded IPv4 Addresses
+* [HTTPCLIENT-1317] InetAddressUtils should handle IPv6 Addresses with Embedded IPv4 Addresses
Contributed Sebastian Bazley .
-* [HTTPCLIENT-1320] Leverage javax.net.ssl.SSLSocketFactory#getDefault() to initialize SSL context
+* [HTTPCLIENT-1320] Leverage javax.net.ssl.SSLSocketFactory#getDefault() to initialize SSL context
based on system defaults instead of using an internal custom routine.
Contributed by Abe Backus and Oleg Kalnichevski
@@ -580,7 +582,7 @@ Changelog
Contributed Sebastian Bazley .
* [HTTPCLIENT-1307] Future based asynchronous request execution.
- Contributed by Jilles van Gurp
+ Contributed by Jilles van Gurp
* [HTTPCLIENT-1313] Fixed IllegalStateException in deprecated ThreadSafeClientConnManager.
Contributed by Oleg Kalnichevski
@@ -594,14 +596,14 @@ Release 4.3 ALPHA1
-------------------
This is the first ALPHA release of HttpClient 4.3. The 4.3 branch enhances HttpClient in several
-key areas and includes several notable features and improvements: Support for Java 7
-try-with-resources for resource management (connection release); fluent Builder classes for
-HttpEntity, HttpRequest and HttpClient instances, deprecation of preference and configuration API
-based on HttpParams interface in favor of constructor injection and plain configuration objects,
-reliance on object immutability instead of access synchronization for thread safety.
+key areas and includes several notable features and improvements: Support for Java 7
+try-with-resources for resource management (connection release); fluent Builder classes for
+HttpEntity, HttpRequest and HttpClient instances, deprecation of preference and configuration API
+based on HttpParams interface in favor of constructor injection and plain configuration objects,
+reliance on object immutability instead of access synchronization for thread safety.
-We are kindly asking all upstream projects to review API changes and help us improve
-the APIs by providing feedback and sharing ideas on dev@hc.apache.org.
+We are kindly asking all upstream projects to review API changes and help us improve
+the APIs by providing feedback and sharing ideas on dev@hc.apache.org.
This release also includes all fixes from the stable 4.2.x release branch.
@@ -612,24 +614,24 @@ their API may change in the future 4.3 alpha and beta releases.
Changelog
-------------------
-* [HTTPCLIENT-1250] Allow query string to be ignored when determining cacheability for
+* [HTTPCLIENT-1250] Allow query string to be ignored when determining cacheability for
HTTP 1.0 responses.
- Contributed by Don Brown
+ Contributed by Don Brown
* [HTTPCLIENT-1261] Make SystemDefaultHttpClient honor http.agent system property.
Contributed by Oleg Kalnichevski
-* [HTTPCLIENT-900] Don't enforce URI syntax for messages with an explicit target host.
+* [HTTPCLIENT-900] Don't enforce URI syntax for messages with an explicit target host.
Contributed by Oleg Kalnichevski
* [HTTPCLIENT-1190] HttpClient cache does not support "Vary: Cookie"
Contributed by Oleg Kalnichevski
-* [HTTPCLIENT-1259] Calling #abort() on requests executed with DecompressingHttpClient has no
+* [HTTPCLIENT-1259] Calling #abort() on requests executed with DecompressingHttpClient has no
effect.
Contributed by Oleg Kalnichevski
-* [HTTPCLIENT-1253] URIBuilder setParameter() method could exceed the HTTP header size.
+* [HTTPCLIENT-1253] URIBuilder setParameter() method could exceed the HTTP header size.
Contributed by Oleg Kalnichevski
* [HTTPCLIENT-1216] Added method to force clean thread-local used by DateUtils.
@@ -639,9 +641,9 @@ Changelog
Release 4.2.3
-------------------
-HttpClient 4.2.3 (GA) is a bug fix release that addresses a number of issues reported since
-release 4.2.2. This release also includes a thoroughly reworked NTLM authentication engine
-which should result in a better compatibility with the newest Microsoft products.
+HttpClient 4.2.3 (GA) is a bug fix release that addresses a number of issues reported since
+release 4.2.2. This release also includes a thoroughly reworked NTLM authentication engine
+which should result in a better compatibility with the newest Microsoft products.
Users of HttpClient 4.x are advised to upgrade.
@@ -652,70 +654,70 @@ Changelog
that has a -1 value for the port.
Contributed by Karl Wright
-* [HTTPCLIENT-1290] 304 cached response never reused with If-modified-since conditional
- requests.
+* [HTTPCLIENT-1290] 304 cached response never reused with If-modified-since conditional
+ requests.
Contributed by Francois-Xavier Bonnet
-* [HTTPCLIENT-1291] Absolute request URIs without an explicitly specified path are rewritten
- to have "/" path).
+* [HTTPCLIENT-1291] Absolute request URIs without an explicitly specified path are rewritten
+ to have "/" path).
Contributed by Oleg Kalnichevski
-* [HTTPCLIENT-1286] Request URI rewriting is inconsistent - URI fragments are not removed
- from absolute request URIs.
+* [HTTPCLIENT-1286] Request URI rewriting is inconsistent - URI fragments are not removed
+ from absolute request URIs.
Contributed by Oleg Kalnichevski
* [HTTPCLIENT-1284] HttpClient incorrectly generates Host header when physical connection
- route differs from the host name specified in the request URI.
+ route differs from the host name specified in the request URI.
Contributed by Oleg Kalnichevski
-* [HTTPCLIENT-1293] Kerberos and SPNego auth schemes use incorrect authorization header name
+* [HTTPCLIENT-1293] Kerberos and SPNego auth schemes use incorrect authorization header name
when authenticating with a proxy.
Contributed by Oleg Kalnichevski
* [HTTPCLIENT-1283] NTLM needs to use Locale-independent form of
toUpperCase().
- Contributed by Karl Wright
+ Contributed by Karl Wright
-* [HTTPCLIENT-1279] Target host responding with status 407 (proxy authentication required)
- causes an NPE.
+* [HTTPCLIENT-1279] Target host responding with status 407 (proxy authentication required)
+ causes an NPE.
Contributed by Oleg Kalnichevski
-* [HTTPCLIENT-1281] GzipDecompressingEntity does not release InputStream when an IOException
- occurs while reading the Gzip header
- Contributed by Francois-Xavier Bonnet
+* [HTTPCLIENT-1281] GzipDecompressingEntity does not release InputStream when an IOException
+ occurs while reading the Gzip header
+ Contributed by Francois-Xavier Bonnet
* [HTTPCLIENT-1277] Caching client sends a 304 to an unconditional request.
Contributed by Francois-Xavier Bonnet
* [HTTPCLIENT-1278] Update NTLM documentation.
- Contributed by Karl Wright
+ Contributed by Karl Wright
* SystemDefaultHttpClient misinterprets 'http.keepAlive' default value and disables
connection persistence if the system property is not set. This causes connection
based authentication schemes such as NTLM to fail.
-* [HTTPCLIENT-1276] cache update on a 304 response causes NPE.
- Contributed by Francois-Xavier Bonnet
+* [HTTPCLIENT-1276] cache update on a 304 response causes NPE.
+ Contributed by Francois-Xavier Bonnet
-* [HTTPCLIENT-1273] DecompressingHttpClient does not automatically consume response
- content in case of an i/o, HTTP or runtime exception thrown by the decompressing
- protocol interceptor leading to a potential connection leak.
+* [HTTPCLIENT-1273] DecompressingHttpClient does not automatically consume response
+ content in case of an i/o, HTTP or runtime exception thrown by the decompressing
+ protocol interceptor leading to a potential connection leak.
Contributed by Oleg Kalnichevski
* [HTTPCLIENT-1268] NTLM engine refactor fix, to correct a buffer overrun, and get NTLMv2
flags right.
- Contributed by Karl Wright
+ Contributed by Karl Wright
* [HTTPCLIENT-1266] NTLM engine refactoring and compatibility improvements.
- Contributed by Karl Wright
+ Contributed by Karl Wright
-* [HTTPCLIENT-1263] BrowserCompatSpec: attribute values containing spaces or special characters
+* [HTTPCLIENT-1263] BrowserCompatSpec: attribute values containing spaces or special characters
should be enclosed with quotes marks for version 1 cookies.
- Contributed by Francois-Xavier Bonnet
+ Contributed by Francois-Xavier Bonnet
* [HTTPCLIENT-1263] CachingHttpClient fails to release connections back to the connection
- manager for some type of HTTP response messages when used together with DecompressingHttpClient.
- Contributed by Francois-Xavier Bonnet
+ manager for some type of HTTP response messages when used together with DecompressingHttpClient.
+ Contributed by Francois-Xavier Bonnet
* [HTTPCLIENT-1258] Fixed NullPointerException in NTLMEngineImpl caused by null NT domain
attribute.
@@ -729,10 +731,10 @@ Changelog
-Release 4.2.2
+Release 4.2.2
-------------------
-HttpClient 4.2.2 (GA) is a bug fix release that addresses a number of issues reported since
+HttpClient 4.2.2 (GA) is a bug fix release that addresses a number of issues reported since
release 4.2.1.
Users of HttpClient 4.2 are advised to upgrade.
@@ -741,25 +743,25 @@ Changelog
-------------------
* [HTTPCLIENT-1248] Default and lax redirect strategies should not convert requests redirected
- with 307 status to GET method.
+ with 307 status to GET method.
Contributed by Oleg Kalnichevski
* [HTTPCLIENT-1215] BasicAuthCache does not take default ports into consideration when
looking up cached authentication details by HttpHost key.
Contributed by Oleg Kalnichevski
-* [HTTPCLIENT-1241] (regression) Preemptive BASIC authentication failure should be considered
- final and no further attempts to re-authenticate using the same credentials should be made.
+* [HTTPCLIENT-1241] (regression) Preemptive BASIC authentication failure should be considered
+ final and no further attempts to re-authenticate using the same credentials should be made.
Contributed by Oleg Kalnichevski
* [HTTPCLIENT-1229] Fixed NPE in BasicClientConnectionManager that can be triggered by releasing
- connection after the connection manager has already been shut down.
+ connection after the connection manager has already been shut down.
Contributed by Oleg Kalnichevski
* [HTTPCLIENT-1227] Date parsing in DateUtils made more efficient.
Contributed by Patrick Linskey
-* [HTTPCLIENT-1224] (regression) NTLM auth not retried after a redirect over a non-persistent
+* [HTTPCLIENT-1224] (regression) NTLM auth not retried after a redirect over a non-persistent
connection.
Contributed by Oleg Kalnichevski
@@ -767,16 +769,16 @@ Changelog
from Content-Location. Contributed by Jon Moore .
Contributed by Jon Moore
-* [HTTPCLIENT-1217] AutoRetryHttpClient does not release connection used by the previous response
+* [HTTPCLIENT-1217] AutoRetryHttpClient does not release connection used by the previous response
when request is retried
Contributed by Oleg Kalnichevski
-Release 4.2.1
+Release 4.2.1
-------------------
-HttpClient 4.2.1 (GA) is a bug fix release that addresses a number of issues reported since
+HttpClient 4.2.1 (GA) is a bug fix release that addresses a number of issues reported since
release 4.2.
Users of HttpClient 4.2 are advised to upgrade.
@@ -798,7 +800,7 @@ Changelog
Contributed by Jon Moore
* [HTTPCLIENT-1200] DecompressingHttpClient fails to generate correct HttpHost context attribute.
- Contributed by Guillaume Castagnino
+ Contributed by Guillaume Castagnino
* [HTTPCLIENT-1192] URIBuilder encodes query parameters twice.
Contributed by Oleg Kalnichevski and Sebastian Bazley .
@@ -806,14 +808,14 @@ Changelog
* [HTTPCLIENT-1196] Fixed NPE in UrlEncodedFormEntity constructor thrown if charset is null.
Contributed by Oleg Kalnichevski
-* [HTTPCLIENT-1193] Fixed regression in the route tracking logic of the default connection manager
+* [HTTPCLIENT-1193] Fixed regression in the route tracking logic of the default connection manager
causing cross-site redirect failures.
Contributed by Oleg Kalnichevski
Release 4.2
-------------------
-This is the first stable (GA) release of HttpClient 4.2. The most notable enhancements included
+This is the first stable (GA) release of HttpClient 4.2. The most notable enhancements included
in this release are:
* New facade API for HttpClient based on the concept of a fluent interface. The fluent API exposes
@@ -821,7 +823,7 @@ in this release are:
that do not require the full flexibility of HttpClient. However, the fluent API almost fully
relieves the users from having to deal with connection management and resource deallocation.
-* Redesigned and rewritten connection management code.
+* Redesigned and rewritten connection management code.
* Enhanced HTTP authentication API that enables HttpClient to handle more complex authentication
scenarios. HttpClient 4.2 is now capable of making use of multiple authentication challenges
@@ -833,14 +835,14 @@ in this release are:
Changelog
-------------------
-* [HTTPCLIENT-1187] If a revalidation response is deemed too old CachingHttpClient fails to
+* [HTTPCLIENT-1187] If a revalidation response is deemed too old CachingHttpClient fails to
consume its content resulting in a connection leak.
Contributed by Oleg Kalnichevski
-* [HTTPCLIENT-1186] State of newly created connections in the connection pool is not always
- correctly updated potentially allowing those connections to be leased to users with a different
- security context.
- Contributed by Ralf Poehlmann
+* [HTTPCLIENT-1186] State of newly created connections in the connection pool is not always
+ correctly updated potentially allowing those connections to be leased to users with a different
+ security context.
+ Contributed by Ralf Poehlmann
* [HTTPCLIENT-1179] Upgraded Commons Codec dependency to version 1.6
Contributed by Oleg Kalnichevski
@@ -904,23 +906,23 @@ Changelog
* [HTTPCLIENT-1154] MemcachedHttpCacheStorage should allow client to
specify custom prefix string for keys.
Contributed by Jon Moore .
-
+
* [HTTPCLIENT-1153] MemcachedHttpCacheStorage uses URL as cache key;
shouldn't due to fixed maximum-length memcached keys.
Contributed by Jon Moore .
-
+
* [HTTPCLIENT-1157] MemcachedHttpCacheStroage should throw IOExceptions
instead of RuntimeExceptions.
Contributed by James Miller .
-
+
* [HTTPCLIENT-1152] MemcachedHttpCacheStorage should verify class of
returned object before casting.
Contributed by Rajika Kumarasiri .
-* [HTTPCLIENT-1155] CachingHttpClient fails to ensure that the response content gets fully consumed
+* [HTTPCLIENT-1155] CachingHttpClient fails to ensure that the response content gets fully consumed
when using a ResponseHandler, which can potentially lead to connection leaks.
Contributed by James Miller
-
+
* [HTTPCLIENT-1147] When HttpClient-Cache cannot open cache file, should act like miss.
Contributed by Joe Campbell
@@ -929,7 +931,7 @@ Changelog
* [HTTPCLIENT-1142] Infinite loop on NTLM authentication failure.
Contributed by Oleg Kalnichevski
-
+
* [HTTPCLIENT-1143] CachingHttpClient leaks connections with stale-if-error.
Contributed by James Miller
@@ -1027,20 +1029,20 @@ Changelog
Release 4.1.2
-------------------
-The HttpClient 4.1.2 is a bug fix release that addresses a number of non-critical issues reported
+The HttpClient 4.1.2 is a bug fix release that addresses a number of non-critical issues reported
since release 4.1.1.
* [HTTPCLIENT-1100] Missing Content-Length header makes cached entry invalid
Contributed by Bart Robeyns
-* [HTTPCLIENT-1098] Avoid expensive reverse DNS lookup on connect timeout exception.
+* [HTTPCLIENT-1098] Avoid expensive reverse DNS lookup on connect timeout exception.
Contributed by Thomas Boettcher
-* [HTTPCLIENT-1097] BrowserCompatHostnameVerifier and StrictHostnameVerifier should handle
+* [HTTPCLIENT-1097] BrowserCompatHostnameVerifier and StrictHostnameVerifier should handle
wildcards in SSL certificates better.
Contributed by Sebastian Bazley
-* [HTTPCLIENT-1092] If ClientPNames.VIRTUAL_HOST does not provide the port, derive it from the
+* [HTTPCLIENT-1092] If ClientPNames.VIRTUAL_HOST does not provide the port, derive it from the
current request.
Contributed by Sebastian Bazley
@@ -1049,15 +1051,15 @@ since release 4.1.1.
Contributed by Oleg Kalnichevski
* [HTTPCLIENT-1079] Fixed Kerberos cross-realm support
- Contributed by Michael Osipov <1983-01-06 at gmx.net>
+ Contributed by Michael Osipov <1983-01-06 at gmx.net>
-* [HTTPCLIENT-1078] Decompressing entities (DeflateDecompressingEntity, GzipDecompressingEntity)
+* [HTTPCLIENT-1078] Decompressing entities (DeflateDecompressingEntity, GzipDecompressingEntity)
do not close content stream in #writeTo() method.
Contributed by Oleg Kalnichevski
-* [HTTPCLIENT-1075] Decompressing entities (DeflateDecompressingEntity, GzipDecompressingEntity)
+* [HTTPCLIENT-1075] Decompressing entities (DeflateDecompressingEntity, GzipDecompressingEntity)
do not correctly handle content streaming.
- Contributed by James Abley
+ Contributed by James Abley
* [HTTPCLIENT-1051] Avoid reverse DNS lookups when opening SSL connections by IP address.
Contributed by Oleg Kalnichevski
@@ -1066,18 +1068,18 @@ since release 4.1.1.
Release 4.1.1
-------------------
-HttpClient v4.1.1 is a bug fix release that addresses a number of issues reported since
-release 4.1, including one critical security issue (HTTPCLIENT-1061). All users of HttpClient 4.0.x
+HttpClient v4.1.1 is a bug fix release that addresses a number of issues reported since
+release 4.1, including one critical security issue (HTTPCLIENT-1061). All users of HttpClient 4.0.x
and 4.1 are strongly encouraged to upgrade.
-* [HTTPCLIENT-1069] HttpHostConnectException not correctly retried for direct and non-tunnelled
- proxy connections.
+* [HTTPCLIENT-1069] HttpHostConnectException not correctly retried for direct and non-tunnelled
+ proxy connections.
Contributed by Oleg Kalnichevski
* [HTTPCLIENT-1066] Changed the way URIUtils#rewriteURI handles multiple consecutive slashes in the
URI path component: multiple leading slashes will be replaced by one slash in order to avoid
- confusion with the authority component. The remaining content of the path will not be modified.
- (also see HTTPCLIENT-929).
+ confusion with the authority component. The remaining content of the path will not be modified.
+ (also see HTTPCLIENT-929).
Contributed by Oleg Kalnichevski
* [HTTPCLIENT-1061] Fixed critical bug causing Proxy-Authorization header to be sent to the target
@@ -1085,10 +1087,10 @@ and 4.1 are strongly encouraged to upgrade.
Contributed by Oleg Kalnichevski
* [HTTPCLIENT-1056] Fixed bug causing the RequestAuthCache protocol interceptor to generate
- an invalid AuthScope instance when looking up user credentials for preemptive authentication.
+ an invalid AuthScope instance when looking up user credentials for preemptive authentication.
Contributed by Oleg Kalnichevski
-* [HTTPCLIENT-1053] Fixed the way DigestScheme generates nonce-count values.
+* [HTTPCLIENT-1053] Fixed the way DigestScheme generates nonce-count values.
Contributed by Oleg Kalnichevski
@@ -1101,7 +1103,7 @@ functional improvements and popular features.
* Response caching conditionally compliant with HTTP/1.1 specification (full compliance with
MUST requirements, partial compliance with SHOULD requirements)
-* Full support for NTLMv1, NTLMv2, and NTLM2 Session authentication. The NTLM protocol code
+* Full support for NTLMv1, NTLMv2, and NTLM2 Session authentication. The NTLM protocol code
was kindly contributed by the Lucene Connector Framework project.
* Support for SPNEGO/Kerberos authentication.
@@ -1109,12 +1111,12 @@ functional improvements and popular features.
* Persistence of authentication data between request executions within the same execution context.
* Support for preemptive authentication for BASIC and DIGEST schemes.
-
-* Support for transparent content encoding. Please note transparent content encoding is not
- enabled per default in order to avoid conflicts with already existing custom content encoding
+
+* Support for transparent content encoding. Please note transparent content encoding is not
+ enabled per default in order to avoid conflicts with already existing custom content encoding
solutions.
-* Mechanism to bypass the standard certificate trust verification (useful when dealing with
+* Mechanism to bypass the standard certificate trust verification (useful when dealing with
self-signed certificates).
* Simplified configuration for connection managers.
@@ -1127,7 +1129,7 @@ maintained and supported by the Apache HttpComponents project.
Changelog
-------------------
* The public API for the caching module had a minor change between 4.1-beta and 4.1-GA to the
- HttpCacheEntry class - the deprecated public Set getVariantURIs() method and constructor
+ HttpCacheEntry class - the deprecated public Set getVariantURIs() method and constructor
public HttpCacheEntry(Date requestDate, Date responseDate,
StatusLine statusLine, Header[] responseHeaders,
Resource resource, Set variants)
@@ -1136,11 +1138,11 @@ Changelog
* Changed Browser-Compatibility and Best-Match cookie policies to emulate the behaviour of FireFox
more closely when parsing Netscape style cookies. Comma will no longer be treated as a header
- element separator if Set-Cookie does not contain a Version attribute mandated by the
+ element separator if Set-Cookie does not contain a Version attribute mandated by the
RFC2109 / RFC 2965 cookie specifications.
Contributed by Oleg Kalnichevski
-* [HTTPCLIENT-1036] StringBody has incorrect default for characterset. (Default changed
+* [HTTPCLIENT-1036] StringBody has incorrect default for characterset. (Default changed
to US-ASCII)
Contributed by Sebastian Bazley
@@ -1149,7 +1151,7 @@ Changelog
Michajlo Matijkiw , and
Matthew Hawthorne .
-* [HTTPCLIENT-1033] HttpRoute.equals(Object o) is quite inefficient, as it does not take full
+* [HTTPCLIENT-1033] HttpRoute.equals(Object o) is quite inefficient, as it does not take full
advantage of shortcut logic.
Contributed by Sebastian Bazley
@@ -1160,8 +1162,8 @@ Release 4.1 BETA1
-------------------
HttpClient 4.1 BETA1 finalizes the 4.1 API and brings a number of major improvements to the HTTP
-caching module. This release also adds full support for NTLMv1, NTLMv2, and NTLM2 Session
-authentication. The NTLM protocol code was kindly contributed by the Lucene Connector Framework
+caching module. This release also adds full support for NTLMv1, NTLMv2, and NTLM2 Session
+authentication. The NTLM protocol code was kindly contributed by the Lucene Connector Framework
project.
Changelog
@@ -1176,14 +1178,14 @@ Changelog
Contributed by Karl Wright
* [HTTPCLIENT-1008] Send all variants' ETags on "variant miss".
- Contributed by Michajlo Matijkiw and
+ Contributed by Michajlo Matijkiw and
Mohammed Azeem Uddin
* [HTTPCLIENT-1011] Handling of IOExceptions thrown by cache components.
Contributed by Jonathan Moore
* [HTTPCLIENT-1003] Handle conditional requests in cache.
- Contributed by Michajlo Matijkiw and
+ Contributed by Michajlo Matijkiw and
Mohammed Azeem Uddin
* [HTTPCLIENT-1002] Stale connection check fails if wire logging is on.
@@ -1197,28 +1199,28 @@ Changelog
Contributed by Oleg Kalnichevski
* [HTTPCLIENT-998] Cache should use both Last-Modified and ETag for validations when available.
- Contributed by Jonathan Moore
+ Contributed by Jonathan Moore
-* [HTTPCLIENT-997] Cache module should handle out-of-order validations properly and unconditionally
+* [HTTPCLIENT-997] Cache module should handle out-of-order validations properly and unconditionally
refresh.
- Contributed by Jonathan Moore
+ Contributed by Jonathan Moore
-* [HTTPCLIENT-994] Cache does not allow client to override origin-specified freshness using
+* [HTTPCLIENT-994] Cache does not allow client to override origin-specified freshness using
max-stale.
Contributed by Jonathan Moore
-* [HTTPCLIENT-995] Cache returns cached responses even if validators not consistent with all
+* [HTTPCLIENT-995] Cache returns cached responses even if validators not consistent with all
conditional headers.
Contributed by Jonathan Moore
* [HTTPCLIENT-977] Memcached implementation for HttpCache.
Contributed by Mohammed Azeem Uddin
-* [HTTPCLIENT-992] cache should not generate stale responses to requests explicitly requesting
+* [HTTPCLIENT-992] cache should not generate stale responses to requests explicitly requesting
first-hand or fresh ones.
Contributed by Jonathan Moore
-* [HTTPCLIENT-991] cache module produces improperly formatted Warning header when revalidation
+* [HTTPCLIENT-991] cache module produces improperly formatted Warning header when revalidation
fails.
Contributed by Jonathan Moore
@@ -1238,18 +1240,18 @@ Changelog
* [HTTPCLIENT-985] cache module should populate Via header to capture upstream and downstream protocols
Contributed by Jonathan Moore
-* [HTTPCLIENT-984] Additional conditional compliance tests for the caching module for
+* [HTTPCLIENT-984] Additional conditional compliance tests for the caching module for
Content-Encoding, Content-Location, Date, Expires, Server, Transfer-Encoding, and Vary headers.
Contributed by Jonathan Moore
* [HTTPCLIENT-978] HTTP cache update exception handling
Contributed by Michajlo Matijkiw
-* [HTTPCLIENT-981] CachingHttpClient returns a 411 respones when executing a POST (HttpPost)
+* [HTTPCLIENT-981] CachingHttpClient returns a 411 respones when executing a POST (HttpPost)
request.
Contributed by Joe Campbell
-* [HTTPCLIENT-980] CachingHttpClient returns a 503 response when the backend HttpClient produces
+* [HTTPCLIENT-980] CachingHttpClient returns a 503 response when the backend HttpClient produces
an IOException.
Contributed by Jonathan Moore
@@ -1258,7 +1260,7 @@ Changelog
* [HTTPCLIENT-967] support for non-shared (private) caches
Contributed by Jonathan Moore
-
+
* [HTTPCLIENT-969] BasicCookieStore#getCookies() to return a copy of Cookie list
Contributed by David Smiley
From 4ab8948dc527569aa9cac31f3deec9f3e1ba8f71 Mon Sep 17 00:00:00 2001
From: Michael Osipov
Date: Sat, 30 May 2015 19:45:10 +0000
Subject: [PATCH 007/204] Unintentionally removed empty lines
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1682648 13f79535-47bb-0310-9956-ffa450edef68
---
RELEASE_NOTES.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index e0fdcfc8ae..fb7c288052 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -29,6 +29,7 @@ Changelog:
Contributed by Michael Osipov
+
Release 4.4.1
-------------------
From eb4a62f60993db199f05932cfbc3f62034abb514 Mon Sep 17 00:00:00 2001
From: Michael Osipov
Date: Sat, 30 May 2015 20:11:17 +0000
Subject: [PATCH 008/204] HTTPCLIENT-1654: Deprecate/remove
RequestConfig#decompressionEnabled in favor of #contentCompressionEnabled
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1682650 13f79535-47bb-0310-9956-ffa450edef68
---
.../java/org/apache/http/client/config/RequestConfig.java | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/httpclient/src/main/java/org/apache/http/client/config/RequestConfig.java b/httpclient/src/main/java/org/apache/http/client/config/RequestConfig.java
index 08c27a1b77..459a0c7a41 100644
--- a/httpclient/src/main/java/org/apache/http/client/config/RequestConfig.java
+++ b/httpclient/src/main/java/org/apache/http/client/config/RequestConfig.java
@@ -315,7 +315,9 @@ public int getSocketTimeout() {
*
*
* @since 4.4
+ * @deprecated (4.5) Use {@link #isContentCompressionEnabled()}
*/
+ @Deprecated
public boolean isDecompressionEnabled() {
return decompressionEnabled;
}
@@ -501,6 +503,11 @@ public Builder setSocketTimeout(final int socketTimeout) {
return this;
}
+ /**
+ * @deprecated (4.5) Set {@link #setContentCompressionEnabled(boolean)} to {@code false} and
+ * add the {@code Accept-Encoding} request header.
+ */
+ @Deprecated
public Builder setDecompressionEnabled(final boolean decompressionEnabled) {
this.decompressionEnabled = decompressionEnabled;
return this;
From 2227d18696aa5a9ce3cb341ddbf8c5a5f735dc66 Mon Sep 17 00:00:00 2001
From: Michael Osipov
Date: Sat, 30 May 2015 20:27:58 +0000
Subject: [PATCH 009/204] Added HTTPCLIENT-1654 to release notes
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1682652 13f79535-47bb-0310-9956-ffa450edef68
---
RELEASE_NOTES.txt | 3 +++
1 file changed, 3 insertions(+)
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index fb7c288052..5cabfbaa6d 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -28,6 +28,9 @@ Changelog:
* [HTTPCLIENT-1651]: Add ability to disable content compression on a request basis
Contributed by Michael Osipov
+* [HTTPCLIENT-1654]: Deprecate/remove RequestConfig#decompressionEnabled in favor of #contentCompressionEnabled
+ Contributed by Michael Osipov
+
Release 4.4.1
From ea21ed26a76177bbf7ee4274de640ab579e13850 Mon Sep 17 00:00:00 2001
From: Oleg Kalnichevski
Date: Sun, 31 May 2015 10:46:03 +0000
Subject: [PATCH 010/204] HTTPCLIENT-1654: better backward compatibility
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1682713 13f79535-47bb-0310-9956-ffa450edef68
---
.../apache/http/client/config/RequestConfig.java | 13 +++----------
.../client/protocol/ResponseContentEncoding.java | 2 +-
2 files changed, 4 insertions(+), 11 deletions(-)
diff --git a/httpclient/src/main/java/org/apache/http/client/config/RequestConfig.java b/httpclient/src/main/java/org/apache/http/client/config/RequestConfig.java
index 459a0c7a41..87f772ff61 100644
--- a/httpclient/src/main/java/org/apache/http/client/config/RequestConfig.java
+++ b/httpclient/src/main/java/org/apache/http/client/config/RequestConfig.java
@@ -58,14 +58,13 @@ public class RequestConfig implements Cloneable {
private final int connectionRequestTimeout;
private final int connectTimeout;
private final int socketTimeout;
- private final boolean decompressionEnabled;
private final boolean contentCompressionEnabled;
/**
* Intended for CDI compatibility
*/
protected RequestConfig() {
- this(false, null, null, false, null, false, false, false, 0, false, null, null, 0, 0, 0, false, false);
+ this(false, null, null, false, null, false, false, false, 0, false, null, null, 0, 0, 0, true);
}
RequestConfig(
@@ -84,7 +83,6 @@ protected RequestConfig() {
final int connectionRequestTimeout,
final int connectTimeout,
final int socketTimeout,
- final boolean decompressionEnabled,
final boolean contentCompressionEnabled) {
super();
this.expectContinueEnabled = expectContinueEnabled;
@@ -102,7 +100,6 @@ protected RequestConfig() {
this.connectionRequestTimeout = connectionRequestTimeout;
this.connectTimeout = connectTimeout;
this.socketTimeout = socketTimeout;
- this.decompressionEnabled = decompressionEnabled;
this.contentCompressionEnabled = contentCompressionEnabled;
}
@@ -319,7 +316,7 @@ public int getSocketTimeout() {
*/
@Deprecated
public boolean isDecompressionEnabled() {
- return decompressionEnabled;
+ return contentCompressionEnabled;
}
/**
@@ -357,7 +354,6 @@ public String toString() {
builder.append(", connectionRequestTimeout=").append(connectionRequestTimeout);
builder.append(", connectTimeout=").append(connectTimeout);
builder.append(", socketTimeout=").append(socketTimeout);
- builder.append(", decompressionEnabled=").append(decompressionEnabled);
builder.append(", contentCompressionEnabled=").append(contentCompressionEnabled);
builder.append("]");
return builder.toString();
@@ -406,7 +402,6 @@ public static class Builder {
private int connectionRequestTimeout;
private int connectTimeout;
private int socketTimeout;
- private boolean decompressionEnabled;
private boolean contentCompressionEnabled;
Builder() {
@@ -419,7 +414,6 @@ public static class Builder {
this.connectionRequestTimeout = -1;
this.connectTimeout = -1;
this.socketTimeout = -1;
- this.decompressionEnabled = true;
this.contentCompressionEnabled = true;
}
@@ -509,7 +503,7 @@ public Builder setSocketTimeout(final int socketTimeout) {
*/
@Deprecated
public Builder setDecompressionEnabled(final boolean decompressionEnabled) {
- this.decompressionEnabled = decompressionEnabled;
+ this.contentCompressionEnabled = decompressionEnabled;
return this;
}
@@ -535,7 +529,6 @@ public RequestConfig build() {
connectionRequestTimeout,
connectTimeout,
socketTimeout,
- decompressionEnabled,
contentCompressionEnabled);
}
diff --git a/httpclient/src/main/java/org/apache/http/client/protocol/ResponseContentEncoding.java b/httpclient/src/main/java/org/apache/http/client/protocol/ResponseContentEncoding.java
index 9cb4adbbec..c4d0cfc9fe 100644
--- a/httpclient/src/main/java/org/apache/http/client/protocol/ResponseContentEncoding.java
+++ b/httpclient/src/main/java/org/apache/http/client/protocol/ResponseContentEncoding.java
@@ -129,7 +129,7 @@ public void process(
final RequestConfig requestConfig = clientContext.getRequestConfig();
// entity can be null in case of 304 Not Modified, 204 No Content or similar
// check for zero length entity.
- if (requestConfig.isDecompressionEnabled() && entity != null && entity.getContentLength() != 0) {
+ if (requestConfig.isContentCompressionEnabled() && entity != null && entity.getContentLength() != 0) {
final Header ceheader = entity.getContentEncoding();
if (ceheader != null) {
final HeaderElement[] codecs = ceheader.getElements();
From 20e3f42df25aad30df097aa12d8b52ad10eeb3bc Mon Sep 17 00:00:00 2001
From: Oleg Kalnichevski
Date: Thu, 4 Jun 2015 07:38:42 +0000
Subject: [PATCH 011/204] Cache request line in HttpRequestWrapper Contributed
by Dmitry Potapov
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1683475 13f79535-47bb-0310-9956-ffa450edef68
---
.../client/methods/HttpRequestWrapper.java | 24 ++++++++++++-------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/httpclient/src/main/java/org/apache/http/client/methods/HttpRequestWrapper.java b/httpclient/src/main/java/org/apache/http/client/methods/HttpRequestWrapper.java
index a593cecc73..3df8bbb5b6 100644
--- a/httpclient/src/main/java/org/apache/http/client/methods/HttpRequestWrapper.java
+++ b/httpclient/src/main/java/org/apache/http/client/methods/HttpRequestWrapper.java
@@ -56,6 +56,7 @@ public class HttpRequestWrapper extends AbstractHttpMessage implements HttpUriRe
private final HttpRequest original;
private final HttpHost target;
private final String method;
+ private RequestLine requestLine;
private ProtocolVersion version;
private URI uri;
@@ -80,6 +81,7 @@ public ProtocolVersion getProtocolVersion() {
public void setProtocolVersion(final ProtocolVersion version) {
this.version = version;
+ this.requestLine = null;
}
@Override
@@ -89,6 +91,7 @@ public URI getURI() {
public void setURI(final URI uri) {
this.uri = uri;
+ this.requestLine = null;
}
@Override
@@ -108,16 +111,19 @@ public boolean isAborted() {
@Override
public RequestLine getRequestLine() {
- String requestUri = null;
- if (this.uri != null) {
- requestUri = this.uri.toASCIIString();
- } else {
- requestUri = this.original.getRequestLine().getUri();
- }
- if (requestUri == null || requestUri.isEmpty()) {
- requestUri = "/";
+ if (this.requestLine == null) {
+ String requestUri;
+ if (this.uri != null) {
+ requestUri = this.uri.toASCIIString();
+ } else {
+ requestUri = this.original.getRequestLine().getUri();
+ }
+ if (requestUri == null || requestUri.isEmpty()) {
+ requestUri = "/";
+ }
+ this.requestLine = new BasicRequestLine(this.method, requestUri, getProtocolVersion());
}
- return new BasicRequestLine(this.method, requestUri, getProtocolVersion());
+ return this.requestLine;
}
public HttpRequest getOriginal() {
From 12482402c405cf0ed38ea4d29f00a6ec9cbb2ea7 Mon Sep 17 00:00:00 2001
From: Oleg Kalnichevski
Date: Thu, 4 Jun 2015 08:41:39 +0000
Subject: [PATCH 012/204] Upgraded HttpClient version to 4.5.1-SNAPSHOT
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1683489 13f79535-47bb-0310-9956-ffa450edef68
---
fluent-hc/pom.xml | 2 +-
httpclient-cache/pom.xml | 2 +-
httpclient-osgi/pom.xml | 2 +-
httpclient-win/pom.xml | 2 +-
httpclient/pom.xml | 2 +-
httpmime/pom.xml | 2 +-
pom.xml | 8 ++++----
7 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/fluent-hc/pom.xml b/fluent-hc/pom.xml
index bfb2714325..e2b351628d 100644
--- a/fluent-hc/pom.xml
+++ b/fluent-hc/pom.xml
@@ -28,7 +28,7 @@
org.apache.httpcomponentshttpcomponents-client
- 4.5-alpha1-SNAPSHOT
+ 4.5.1-SNAPSHOTfluent-hcApache HttpClient Fluent API
diff --git a/httpclient-cache/pom.xml b/httpclient-cache/pom.xml
index dac5d39355..d2a84ff5e9 100644
--- a/httpclient-cache/pom.xml
+++ b/httpclient-cache/pom.xml
@@ -28,7 +28,7 @@
org.apache.httpcomponentshttpcomponents-client
- 4.5-alpha1-SNAPSHOT
+ 4.5.1-SNAPSHOThttpclient-cacheApache HttpClient Cache
diff --git a/httpclient-osgi/pom.xml b/httpclient-osgi/pom.xml
index 1a01dea8fc..dfd1402a50 100644
--- a/httpclient-osgi/pom.xml
+++ b/httpclient-osgi/pom.xml
@@ -28,7 +28,7 @@
org.apache.httpcomponentshttpcomponents-client
- 4.5-alpha1-SNAPSHOT
+ 4.5.1-SNAPSHOThttpclient-osgiApache HttpClient OSGi bundle
diff --git a/httpclient-win/pom.xml b/httpclient-win/pom.xml
index 71dbda60e0..e7208bdaa8 100644
--- a/httpclient-win/pom.xml
+++ b/httpclient-win/pom.xml
@@ -28,7 +28,7 @@
org.apache.httpcomponentshttpcomponents-client
- 4.5-alpha1-SNAPSHOT
+ 4.5.1-SNAPSHOThttpclient-winApache HttpClient Windows features
diff --git a/httpclient/pom.xml b/httpclient/pom.xml
index 7b12c31867..117a838332 100644
--- a/httpclient/pom.xml
+++ b/httpclient/pom.xml
@@ -28,7 +28,7 @@
org.apache.httpcomponentshttpcomponents-client
- 4.5-alpha1-SNAPSHOT
+ 4.5.1-SNAPSHOThttpclientApache HttpClient
diff --git a/httpmime/pom.xml b/httpmime/pom.xml
index dbedf8d825..3a0618fe2d 100644
--- a/httpmime/pom.xml
+++ b/httpmime/pom.xml
@@ -28,7 +28,7 @@
org.apache.httpcomponentshttpcomponents-client
- 4.5-alpha1-SNAPSHOT
+ 4.5.1-SNAPSHOThttpmimeApache HttpClient Mime
diff --git a/pom.xml b/pom.xml
index 0a02cfc3fa..815cce92c7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -33,7 +33,7 @@
4.0.0httpcomponents-clientApache HttpComponents Client
- 4.5-alpha1-SNAPSHOT
+ 4.5.1-SNAPSHOTApache HttpComponents Client is a library of components for building client side HTTP serviceshttp://hc.apache.org/httpcomponents-client1999
@@ -58,9 +58,9 @@
- scm:svn:https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk
- scm:svn:https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk
- https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk
+ scm:svn:https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x
+ scm:svn:https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x
+ https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x
From 78cf770aec88b6bfad9dfbdc12d8b92df2d84616 Mon Sep 17 00:00:00 2001
From: Oleg Kalnichevski
Date: Fri, 5 Jun 2015 09:17:41 +0000
Subject: [PATCH 013/204] HTTPCLIENT-1655: HttpClient sends RST instead of FIN
ACK sequence when using non-persistant connections
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1683684 13f79535-47bb-0310-9956-ffa450edef68
---
.../http/conn/ConnectionReleaseTrigger.java | 3 +-
.../http/impl/execchain/ConnectionHolder.java | 73 ++++++++++---------
.../impl/execchain/HttpResponseProxy.java | 2 +-
.../impl/execchain/ResponseEntityProxy.java | 34 +++++++--
.../impl/execchain/TestMainClientExec.java | 2 +-
.../impl/execchain/TestMinimalClientExec.java | 2 +-
.../execchain/TestResponseEntityWrapper.java | 2 +-
7 files changed, 68 insertions(+), 50 deletions(-)
diff --git a/httpclient/src/main/java/org/apache/http/conn/ConnectionReleaseTrigger.java b/httpclient/src/main/java/org/apache/http/conn/ConnectionReleaseTrigger.java
index 1317c227d1..8a47637228 100644
--- a/httpclient/src/main/java/org/apache/http/conn/ConnectionReleaseTrigger.java
+++ b/httpclient/src/main/java/org/apache/http/conn/ConnectionReleaseTrigger.java
@@ -31,8 +31,7 @@
/**
* Interface for releasing a connection. This can be implemented by various
* "trigger" objects which are associated with a connection, for example
- * a {@link EofSensorInputStream stream} or an {@link BasicManagedEntity entity}
- * or the {@link ManagedClientConnection connection} itself.
+ * a {@link EofSensorInputStream} or the {@link ManagedHttpClientConnection} itself.
*
* The methods in this interface can safely be called multiple times.
* The first invocation releases the connection, subsequent calls
diff --git a/httpclient/src/main/java/org/apache/http/impl/execchain/ConnectionHolder.java b/httpclient/src/main/java/org/apache/http/impl/execchain/ConnectionHolder.java
index 1ebf02daea..0f6e4f3e85 100644
--- a/httpclient/src/main/java/org/apache/http/impl/execchain/ConnectionHolder.java
+++ b/httpclient/src/main/java/org/apache/http/impl/execchain/ConnectionHolder.java
@@ -30,6 +30,7 @@
import java.io.Closeable;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.commons.logging.Log;
import org.apache.http.HttpClientConnection;
@@ -50,13 +51,12 @@ class ConnectionHolder implements ConnectionReleaseTrigger, Cancellable, Closeab
private final HttpClientConnectionManager manager;
private final HttpClientConnection managedConn;
+ private final AtomicBoolean released;
private volatile boolean reusable;
private volatile Object state;
private volatile long validDuration;
private volatile TimeUnit tunit;
- private volatile boolean released;
-
public ConnectionHolder(
final Log log,
final HttpClientConnectionManager manager,
@@ -65,6 +65,7 @@ public ConnectionHolder(
this.log = log;
this.manager = manager;
this.managedConn = managedConn;
+ this.released = new AtomicBoolean(false);
}
public boolean isReusable() {
@@ -90,19 +91,40 @@ public void setValidFor(final long duration, final TimeUnit tunit) {
}
}
+ private void releaseConnection(final boolean reusable) {
+ if (this.released.compareAndSet(false, true)) {
+ synchronized (this.managedConn) {
+ if (reusable) {
+ this.manager.releaseConnection(this.managedConn,
+ this.state, this.validDuration, this.tunit);
+ } else {
+ try {
+ this.managedConn.close();
+ log.debug("Connection discarded");
+ } catch (final IOException ex) {
+ if (this.log.isDebugEnabled()) {
+ this.log.debug(ex.getMessage(), ex);
+ }
+ } finally {
+ this.manager.releaseConnection(
+ this.managedConn, null, 0, TimeUnit.MILLISECONDS);
+ }
+ }
+ }
+ }
+ }
+
@Override
public void releaseConnection() {
- synchronized (this.managedConn) {
- if (this.released) {
- return;
- }
- this.released = true;
- if (this.reusable) {
- this.manager.releaseConnection(this.managedConn,
- this.state, this.validDuration, this.tunit);
- } else {
+ releaseConnection(this.reusable);
+ }
+
+ @Override
+ public void abortConnection() {
+ if (this.released.compareAndSet(false, true)) {
+ synchronized (this.managedConn) {
try {
- this.managedConn.close();
+ this.managedConn.shutdown();
log.debug("Connection discarded");
} catch (final IOException ex) {
if (this.log.isDebugEnabled()) {
@@ -116,42 +138,21 @@ public void releaseConnection() {
}
}
- @Override
- public void abortConnection() {
- synchronized (this.managedConn) {
- if (this.released) {
- return;
- }
- this.released = true;
- try {
- this.managedConn.shutdown();
- log.debug("Connection discarded");
- } catch (final IOException ex) {
- if (this.log.isDebugEnabled()) {
- this.log.debug(ex.getMessage(), ex);
- }
- } finally {
- this.manager.releaseConnection(
- this.managedConn, null, 0, TimeUnit.MILLISECONDS);
- }
- }
- }
-
@Override
public boolean cancel() {
- final boolean alreadyReleased = this.released;
+ final boolean alreadyReleased = this.released.get();
log.debug("Cancelling request execution");
abortConnection();
return !alreadyReleased;
}
public boolean isReleased() {
- return this.released;
+ return this.released.get();
}
@Override
public void close() throws IOException {
- abortConnection();
+ releaseConnection(false);
}
}
diff --git a/httpclient/src/main/java/org/apache/http/impl/execchain/HttpResponseProxy.java b/httpclient/src/main/java/org/apache/http/impl/execchain/HttpResponseProxy.java
index 4a6ca05b70..0184ec2500 100644
--- a/httpclient/src/main/java/org/apache/http/impl/execchain/HttpResponseProxy.java
+++ b/httpclient/src/main/java/org/apache/http/impl/execchain/HttpResponseProxy.java
@@ -61,7 +61,7 @@ public HttpResponseProxy(final HttpResponse original, final ConnectionHolder con
@Override
public void close() throws IOException {
if (this.connHolder != null) {
- this.connHolder.abortConnection();
+ this.connHolder.close();
}
}
diff --git a/httpclient/src/main/java/org/apache/http/impl/execchain/ResponseEntityProxy.java b/httpclient/src/main/java/org/apache/http/impl/execchain/ResponseEntityProxy.java
index 9f66de65cd..7f2c42d35f 100644
--- a/httpclient/src/main/java/org/apache/http/impl/execchain/ResponseEntityProxy.java
+++ b/httpclient/src/main/java/org/apache/http/impl/execchain/ResponseEntityProxy.java
@@ -61,7 +61,13 @@ public static void enchance(final HttpResponse response, final ConnectionHolder
this.connHolder = connHolder;
}
- private void cleanup() {
+ private void cleanup() throws IOException {
+ if (this.connHolder != null) {
+ this.connHolder.close();
+ }
+ }
+
+ private void abortConnection() throws IOException {
if (this.connHolder != null) {
this.connHolder.abortConnection();
}
@@ -69,13 +75,7 @@ private void cleanup() {
public void releaseConnection() throws IOException {
if (this.connHolder != null) {
- try {
- if (this.connHolder.isReusable()) {
- this.connHolder.releaseConnection();
- }
- } finally {
- cleanup();
- }
+ this.connHolder.releaseConnection();
}
}
@@ -100,6 +100,12 @@ public void writeTo(final OutputStream outstream) throws IOException {
try {
this.wrappedEntity.writeTo(outstream);
releaseConnection();
+ } catch (IOException ex) {
+ abortConnection();
+ throw ex;
+ } catch (RuntimeException ex) {
+ abortConnection();
+ throw ex;
} finally {
cleanup();
}
@@ -112,6 +118,12 @@ public boolean eofDetected(final InputStream wrapped) throws IOException {
// reading trailers after the response body:
wrapped.close();
releaseConnection();
+ } catch (IOException ex) {
+ abortConnection();
+ throw ex;
+ } catch (RuntimeException ex) {
+ abortConnection();
+ throw ex;
} finally {
cleanup();
}
@@ -132,6 +144,12 @@ public boolean streamClosed(final InputStream wrapped) throws IOException {
throw ex;
}
}
+ } catch (IOException ex) {
+ abortConnection();
+ throw ex;
+ } catch (RuntimeException ex) {
+ abortConnection();
+ throw ex;
} finally {
cleanup();
}
diff --git a/httpclient/src/test/java/org/apache/http/impl/execchain/TestMainClientExec.java b/httpclient/src/test/java/org/apache/http/impl/execchain/TestMainClientExec.java
index 70e23a815a..2261da82ba 100644
--- a/httpclient/src/test/java/org/apache/http/impl/execchain/TestMainClientExec.java
+++ b/httpclient/src/test/java/org/apache/http/impl/execchain/TestMainClientExec.java
@@ -305,7 +305,7 @@ public void testExecRequestConnectionRelease() throws Exception {
Mockito.verify(connManager, Mockito.times(1)).releaseConnection(
managedConn, null, 0, TimeUnit.MILLISECONDS);
- Mockito.verify(managedConn, Mockito.times(1)).shutdown();
+ Mockito.verify(managedConn, Mockito.times(1)).close();
}
@Test
diff --git a/httpclient/src/test/java/org/apache/http/impl/execchain/TestMinimalClientExec.java b/httpclient/src/test/java/org/apache/http/impl/execchain/TestMinimalClientExec.java
index 7c79f148ba..9a96ba686c 100644
--- a/httpclient/src/test/java/org/apache/http/impl/execchain/TestMinimalClientExec.java
+++ b/httpclient/src/test/java/org/apache/http/impl/execchain/TestMinimalClientExec.java
@@ -202,7 +202,7 @@ public void testExecRequestConnectionRelease() throws Exception {
Mockito.verify(connManager, Mockito.times(1)).releaseConnection(
managedConn, null, 0, TimeUnit.MILLISECONDS);
- Mockito.verify(managedConn, Mockito.times(1)).shutdown();
+ Mockito.verify(managedConn, Mockito.times(1)).close();
}
@Test
diff --git a/httpclient/src/test/java/org/apache/http/impl/execchain/TestResponseEntityWrapper.java b/httpclient/src/test/java/org/apache/http/impl/execchain/TestResponseEntityWrapper.java
index 00c06d1606..803cb94cd9 100644
--- a/httpclient/src/test/java/org/apache/http/impl/execchain/TestResponseEntityWrapper.java
+++ b/httpclient/src/test/java/org/apache/http/impl/execchain/TestResponseEntityWrapper.java
@@ -85,7 +85,7 @@ public void testEntityStreamClosedIOErrorAlreadyReleased() throws Exception {
Mockito.when(connHolder.isReleased()).thenReturn(true);
Mockito.doThrow(new SocketException()).when(instream).close();
EntityUtils.consume(wrapper);
- Mockito.verify(connHolder).abortConnection();
+ Mockito.verify(connHolder).close();
}
@Test
From c6be20feb0a5e2a9c24fc68653b2e315b73f0f7c Mon Sep 17 00:00:00 2001
From: Oleg Kalnichevski
Date: Sat, 13 Jun 2015 16:31:15 +0000
Subject: [PATCH 014/204] HTTPCLIENT-1658: fixed regression in
RequestBuilder#copy
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1685285 13f79535-47bb-0310-9956-ffa450edef68
---
.../http/client/methods/RequestBuilder.java | 21 ++-----------------
.../client/methods/TestRequestBuilder.java | 21 ++++++++++++-------
2 files changed, 16 insertions(+), 26 deletions(-)
diff --git a/httpclient/src/main/java/org/apache/http/client/methods/RequestBuilder.java b/httpclient/src/main/java/org/apache/http/client/methods/RequestBuilder.java
index 763bcb5119..dcd3e6989a 100644
--- a/httpclient/src/main/java/org/apache/http/client/methods/RequestBuilder.java
+++ b/httpclient/src/main/java/org/apache/http/client/methods/RequestBuilder.java
@@ -293,26 +293,9 @@ private RequestBuilder doCopy(final HttpRequest request) {
final URI originalUri;
if (request instanceof HttpUriRequest) {
- originalUri = ((HttpUriRequest) request).getURI();
+ uri = ((HttpUriRequest) request).getURI();
} else {
- originalUri = URI.create(request.getRequestLine().getUri());
- }
-
- final URIBuilder uriBuilder = new URIBuilder(originalUri);
- if (parameters == null) {
- final List queryParams = uriBuilder.getQueryParams();
- if (!queryParams.isEmpty()) {
- parameters = queryParams;
- uriBuilder.clearParameters();
- } else {
- parameters = null;
- }
- }
- try {
- uri = uriBuilder.build();
- } catch (URISyntaxException ex) {
- // Should never happen
- uri = originalUri;
+ uri = URI.create(request.getRequestLine().getUri());
}
if (request instanceof Configurable) {
diff --git a/httpclient/src/test/java/org/apache/http/client/methods/TestRequestBuilder.java b/httpclient/src/test/java/org/apache/http/client/methods/TestRequestBuilder.java
index f839268983..84fea770d3 100644
--- a/httpclient/src/test/java/org/apache/http/client/methods/TestRequestBuilder.java
+++ b/httpclient/src/test/java/org/apache/http/client/methods/TestRequestBuilder.java
@@ -33,6 +33,7 @@
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpEntityEnclosingRequest;
+import org.apache.http.HttpRequest;
import org.apache.http.HttpVersion;
import org.apache.http.NameValuePair;
import org.apache.http.client.config.RequestConfig;
@@ -168,10 +169,8 @@ public void testCopyWithQueryParams() throws Exception {
final RequestBuilder builder = RequestBuilder.copy(get);
final List parameters = builder.getParameters();
Assert.assertNotNull(parameters);
- Assert.assertEquals(2, parameters.size());
- Assert.assertEquals(new BasicNameValuePair("p1", "this"), parameters.get(0));
- Assert.assertEquals(new BasicNameValuePair("p2", "that"), parameters.get(1));
- Assert.assertEquals(new URI("/stuff"), builder.getUri());
+ Assert.assertEquals(0, parameters.size());
+ Assert.assertEquals(new URI("/stuff?p1=this&p2=that"), builder.getUri());
}
@Test
@@ -196,12 +195,20 @@ public void testCopyWithStringEntity() throws Exception {
final RequestBuilder builder = RequestBuilder.copy(post);
final List parameters = builder.getParameters();
Assert.assertNotNull(parameters);
- Assert.assertEquals(1, parameters.size());
- Assert.assertEquals(new BasicNameValuePair("p1", "wtf"), parameters.get(0));
- Assert.assertEquals(new URI("/stuff"), builder.getUri());
+ Assert.assertEquals(0, parameters.size());
+ Assert.assertEquals(new URI("/stuff?p1=wtf"), builder.getUri());
Assert.assertSame(entity, builder.getEntity());
}
+ @Test
+ public void testCopyAndSetUri() throws Exception {
+ final URI uri1 = URI.create("http://host1.com/path?param=something");
+ final URI uri2 = URI.create("http://host2.com/path?param=somethingdifferent");
+ final HttpRequest request1 = new HttpGet(uri1);
+ final HttpUriRequest request2 = RequestBuilder.copy(request1).setUri(uri2).build();
+ Assert.assertEquals(request2.getURI(), uri2);
+ }
+
@Test
public void testGettersAndMutators() throws Exception {
final HttpEntity entity = new StringEntity("stuff");
From 3b94921d03316330de1180b4bacb16ebf7eb99d0 Mon Sep 17 00:00:00 2001
From: Oleg Kalnichevski
Date: Thu, 23 Jul 2015 15:25:56 +0000
Subject: [PATCH 015/204] HTTPCLIENT-1667: RequestBuilder does not take charset
into account when creating UrlEncodedFormEntity Contributed by Sergey Smith
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1692404 13f79535-47bb-0310-9956-ffa450edef68
---
.../java/org/apache/http/client/methods/RequestBuilder.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/httpclient/src/main/java/org/apache/http/client/methods/RequestBuilder.java b/httpclient/src/main/java/org/apache/http/client/methods/RequestBuilder.java
index dcd3e6989a..9c00b5da6d 100644
--- a/httpclient/src/main/java/org/apache/http/client/methods/RequestBuilder.java
+++ b/httpclient/src/main/java/org/apache/http/client/methods/RequestBuilder.java
@@ -463,7 +463,7 @@ public HttpUriRequest build() {
if (parameters != null && !parameters.isEmpty()) {
if (entityCopy == null && (HttpPost.METHOD_NAME.equalsIgnoreCase(method)
|| HttpPut.METHOD_NAME.equalsIgnoreCase(method))) {
- entityCopy = new UrlEncodedFormEntity(parameters, HTTP.DEF_CONTENT_CHARSET);
+ entityCopy = new UrlEncodedFormEntity(parameters, charset != null ? charset : HTTP.DEF_CONTENT_CHARSET);
} else {
try {
uriNotNull = new URIBuilder(uriNotNull)
From bd29207ff9db2e85e2bd8a97b2589cb247d96b89 Mon Sep 17 00:00:00 2001
From: Oleg Kalnichevski
Date: Fri, 24 Jul 2015 08:56:26 +0000
Subject: [PATCH 016/204] HTTPCLIENT-1668: Fluent request incorrectly handles
connect timeout setting
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1692467 13f79535-47bb-0310-9956-ffa450edef68
---
.../src/main/java/org/apache/http/client/fluent/Request.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 8d7136d015..593cee8a41 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
@@ -163,7 +163,7 @@ HttpResponse internalExecute(
builder.setSocketTimeout(this.socketTmeout);
}
if (this.connectTimeout != null) {
- builder.setSocketTimeout(this.connectTimeout);
+ builder.setConnectTimeout(this.connectTimeout);
}
if (this.proxy != null) {
builder.setProxy(this.proxy);
From 369b375c3bbc71f7e84b10e9221be15269fb20ca Mon Sep 17 00:00:00 2001
From: Oleg Kalnichevski
Date: Fri, 7 Aug 2015 07:33:11 +0000
Subject: [PATCH 017/204] Use httpbin.org in examples
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1694618 13f79535-47bb-0310-9956-ffa450edef68
---
.../http/examples/client/ClientAbortMethod.java | 2 +-
.../examples/client/ClientAuthentication.java | 8 ++++----
.../examples/client/ClientChunkEncodedPost.java | 4 ++--
.../http/examples/client/ClientConfiguration.java | 9 +++------
.../examples/client/ClientConnectionRelease.java | 2 +-
.../http/examples/client/ClientCustomContext.java | 2 +-
.../client/ClientCustomPublicSuffixList.java | 2 +-
.../http/examples/client/ClientCustomSSL.java | 4 ++--
.../client/ClientEvictExpiredConnections.java | 2 +-
.../http/examples/client/ClientExecuteProxy.java | 4 ++--
.../http/examples/client/ClientExecuteSOCKS.java | 2 +-
.../ClientPreemptiveBasicAuthentication.java | 8 ++++----
.../ClientPreemptiveDigestAuthentication.java | 8 ++++----
.../client/ClientProxyAuthentication.java | 15 +++++++++------
.../examples/client/ClientWithRequestFuture.java | 8 ++++----
.../client/ClientWithResponseHandler.java | 2 +-
.../apache/http/examples/client/QuickStart.java | 4 ++--
.../src/test/resources/commons-logging.properties | 2 +-
18 files changed, 44 insertions(+), 44 deletions(-)
diff --git a/httpclient/src/examples/org/apache/http/examples/client/ClientAbortMethod.java b/httpclient/src/examples/org/apache/http/examples/client/ClientAbortMethod.java
index c92ac9ef7f..1b01f1c3f9 100644
--- a/httpclient/src/examples/org/apache/http/examples/client/ClientAbortMethod.java
+++ b/httpclient/src/examples/org/apache/http/examples/client/ClientAbortMethod.java
@@ -40,7 +40,7 @@ public class ClientAbortMethod {
public final static void main(String[] args) throws Exception {
CloseableHttpClient httpclient = HttpClients.createDefault();
try {
- HttpGet httpget = new HttpGet("http://www.apache.org/");
+ HttpGet httpget = new HttpGet("http://httpbin.org/get");
System.out.println("Executing request " + httpget.getURI());
CloseableHttpResponse response = httpclient.execute(httpget);
diff --git a/httpclient/src/examples/org/apache/http/examples/client/ClientAuthentication.java b/httpclient/src/examples/org/apache/http/examples/client/ClientAuthentication.java
index e4c50e7db6..d4c8fc8505 100644
--- a/httpclient/src/examples/org/apache/http/examples/client/ClientAuthentication.java
+++ b/httpclient/src/examples/org/apache/http/examples/client/ClientAuthentication.java
@@ -45,20 +45,20 @@ public class ClientAuthentication {
public static void main(String[] args) throws Exception {
CredentialsProvider credsProvider = new BasicCredentialsProvider();
credsProvider.setCredentials(
- new AuthScope("localhost", 443),
- new UsernamePasswordCredentials("username", "password"));
+ new AuthScope("httpbin.org", 80),
+ new UsernamePasswordCredentials("user", "passwd"));
CloseableHttpClient httpclient = HttpClients.custom()
.setDefaultCredentialsProvider(credsProvider)
.build();
try {
- HttpGet httpget = new HttpGet("http://localhost/");
+ HttpGet httpget = new HttpGet("http://httpbin.org/basic-auth/user/passwd");
System.out.println("Executing request " + httpget.getRequestLine());
CloseableHttpResponse response = httpclient.execute(httpget);
try {
System.out.println("----------------------------------------");
System.out.println(response.getStatusLine());
- EntityUtils.consume(response.getEntity());
+ System.out.println(EntityUtils.toString(response.getEntity()));
} finally {
response.close();
}
diff --git a/httpclient/src/examples/org/apache/http/examples/client/ClientChunkEncodedPost.java b/httpclient/src/examples/org/apache/http/examples/client/ClientChunkEncodedPost.java
index dbf4d89663..39a4fad009 100644
--- a/httpclient/src/examples/org/apache/http/examples/client/ClientChunkEncodedPost.java
+++ b/httpclient/src/examples/org/apache/http/examples/client/ClientChunkEncodedPost.java
@@ -49,7 +49,7 @@ public static void main(String[] args) throws Exception {
}
CloseableHttpClient httpclient = HttpClients.createDefault();
try {
- HttpPost httppost = new HttpPost("http://localhost/");
+ HttpPost httppost = new HttpPost("http://httpbin.org/post");
File file = new File(args[0]);
@@ -69,7 +69,7 @@ public static void main(String[] args) throws Exception {
try {
System.out.println("----------------------------------------");
System.out.println(response.getStatusLine());
- EntityUtils.consume(response.getEntity());
+ System.out.println(EntityUtils.toString(response.getEntity()));
} finally {
response.close();
}
diff --git a/httpclient/src/examples/org/apache/http/examples/client/ClientConfiguration.java b/httpclient/src/examples/org/apache/http/examples/client/ClientConfiguration.java
index ac6aa394c6..4ad7230a7c 100644
--- a/httpclient/src/examples/org/apache/http/examples/client/ClientConfiguration.java
+++ b/httpclient/src/examples/org/apache/http/examples/client/ClientConfiguration.java
@@ -81,6 +81,7 @@
import org.apache.http.message.LineParser;
import org.apache.http.ssl.SSLContexts;
import org.apache.http.util.CharArrayBuffer;
+import org.apache.http.util.EntityUtils;
/**
* This example demonstrates how to customize and configure the most common aspects
@@ -221,7 +222,7 @@ public InetAddress[] resolve(final String host) throws UnknownHostException {
.build();
try {
- HttpGet httpget = new HttpGet("http://www.apache.org/");
+ HttpGet httpget = new HttpGet("http://httpbin.org/get");
// Request configuration can be overridden at the request level.
// They will take precedence over the one set at the client level.
RequestConfig requestConfig = RequestConfig.copy(defaultRequestConfig)
@@ -242,13 +243,9 @@ public InetAddress[] resolve(final String host) throws UnknownHostException {
System.out.println("executing request " + httpget.getURI());
CloseableHttpResponse response = httpclient.execute(httpget, context);
try {
- HttpEntity entity = response.getEntity();
-
System.out.println("----------------------------------------");
System.out.println(response.getStatusLine());
- if (entity != null) {
- System.out.println("Response content length: " + entity.getContentLength());
- }
+ System.out.println(EntityUtils.toString(response.getEntity()));
System.out.println("----------------------------------------");
// Once the request has been executed the local context can
diff --git a/httpclient/src/examples/org/apache/http/examples/client/ClientConnectionRelease.java b/httpclient/src/examples/org/apache/http/examples/client/ClientConnectionRelease.java
index 84d680d53b..65ee4bfccc 100644
--- a/httpclient/src/examples/org/apache/http/examples/client/ClientConnectionRelease.java
+++ b/httpclient/src/examples/org/apache/http/examples/client/ClientConnectionRelease.java
@@ -45,7 +45,7 @@ public class ClientConnectionRelease {
public final static void main(String[] args) throws Exception {
CloseableHttpClient httpclient = HttpClients.createDefault();
try {
- HttpGet httpget = new HttpGet("http://localhost/");
+ HttpGet httpget = new HttpGet("http://httpbin.org/get");
System.out.println("Executing request " + httpget.getRequestLine());
CloseableHttpResponse response = httpclient.execute(httpget);
diff --git a/httpclient/src/examples/org/apache/http/examples/client/ClientCustomContext.java b/httpclient/src/examples/org/apache/http/examples/client/ClientCustomContext.java
index 19757624c0..a3d14b4655 100644
--- a/httpclient/src/examples/org/apache/http/examples/client/ClientCustomContext.java
+++ b/httpclient/src/examples/org/apache/http/examples/client/ClientCustomContext.java
@@ -56,7 +56,7 @@ public final static void main(String[] args) throws Exception {
// Bind custom cookie store to the local context
localContext.setCookieStore(cookieStore);
- HttpGet httpget = new HttpGet("http://localhost/");
+ HttpGet httpget = new HttpGet("http://httpbin.org/cookies");
System.out.println("Executing request " + httpget.getRequestLine());
// Pass local context as a parameter
diff --git a/httpclient/src/examples/org/apache/http/examples/client/ClientCustomPublicSuffixList.java b/httpclient/src/examples/org/apache/http/examples/client/ClientCustomPublicSuffixList.java
index 0246caf599..5f52cd8b8d 100644
--- a/httpclient/src/examples/org/apache/http/examples/client/ClientCustomPublicSuffixList.java
+++ b/httpclient/src/examples/org/apache/http/examples/client/ClientCustomPublicSuffixList.java
@@ -73,7 +73,7 @@ public final static void main(String[] args) throws Exception {
.build();
try {
- HttpGet httpget = new HttpGet("https://remotehost/");
+ HttpGet httpget = new HttpGet("https://httpbin.org/");
System.out.println("executing request " + httpget.getRequestLine());
diff --git a/httpclient/src/examples/org/apache/http/examples/client/ClientCustomSSL.java b/httpclient/src/examples/org/apache/http/examples/client/ClientCustomSSL.java
index eb162873a9..fbcf71b16b 100644
--- a/httpclient/src/examples/org/apache/http/examples/client/ClientCustomSSL.java
+++ b/httpclient/src/examples/org/apache/http/examples/client/ClientCustomSSL.java
@@ -63,9 +63,9 @@ public final static void main(String[] args) throws Exception {
.build();
try {
- HttpGet httpget = new HttpGet("https://localhost/");
+ HttpGet httpget = new HttpGet("https://httpbin.org/");
- System.out.println("executing request " + httpget.getRequestLine());
+ System.out.println("Executing request " + httpget.getRequestLine());
CloseableHttpResponse response = httpclient.execute(httpget);
try {
diff --git a/httpclient/src/examples/org/apache/http/examples/client/ClientEvictExpiredConnections.java b/httpclient/src/examples/org/apache/http/examples/client/ClientEvictExpiredConnections.java
index b349709ac4..2c788ac69b 100644
--- a/httpclient/src/examples/org/apache/http/examples/client/ClientEvictExpiredConnections.java
+++ b/httpclient/src/examples/org/apache/http/examples/client/ClientEvictExpiredConnections.java
@@ -68,7 +68,7 @@ public static void main(String[] args) throws Exception {
try {
System.out.println("----------------------------------------");
System.out.println(response.getStatusLine());
- EntityUtils.consume(response.getEntity());
+ System.out.println(EntityUtils.toString(response.getEntity()));
} finally {
response.close();
}
diff --git a/httpclient/src/examples/org/apache/http/examples/client/ClientExecuteProxy.java b/httpclient/src/examples/org/apache/http/examples/client/ClientExecuteProxy.java
index e2740db328..33cc2ba043 100644
--- a/httpclient/src/examples/org/apache/http/examples/client/ClientExecuteProxy.java
+++ b/httpclient/src/examples/org/apache/http/examples/client/ClientExecuteProxy.java
@@ -45,7 +45,7 @@ public class ClientExecuteProxy {
public static void main(String[] args)throws Exception {
CloseableHttpClient httpclient = HttpClients.createDefault();
try {
- HttpHost target = new HttpHost("localhost", 443, "https");
+ HttpHost target = new HttpHost("httpbin.org", 443, "https");
HttpHost proxy = new HttpHost("127.0.0.1", 8080, "http");
RequestConfig config = RequestConfig.custom()
@@ -60,7 +60,7 @@ public static void main(String[] args)throws Exception {
try {
System.out.println("----------------------------------------");
System.out.println(response.getStatusLine());
- EntityUtils.consume(response.getEntity());
+ System.out.println(EntityUtils.toString(response.getEntity()));
} finally {
response.close();
}
diff --git a/httpclient/src/examples/org/apache/http/examples/client/ClientExecuteSOCKS.java b/httpclient/src/examples/org/apache/http/examples/client/ClientExecuteSOCKS.java
index 3cf62d768a..04ec10ccca 100644
--- a/httpclient/src/examples/org/apache/http/examples/client/ClientExecuteSOCKS.java
+++ b/httpclient/src/examples/org/apache/http/examples/client/ClientExecuteSOCKS.java
@@ -67,7 +67,7 @@ public static void main(String[] args)throws Exception {
HttpClientContext context = HttpClientContext.create();
context.setAttribute("socks.address", socksaddr);
- HttpHost target = new HttpHost("localhost", 80, "http");
+ HttpHost target = new HttpHost("httpbin.org", 80, "http");
HttpGet request = new HttpGet("/");
System.out.println("Executing request " + request + " to " + target + " via SOCKS proxy " + socksaddr);
diff --git a/httpclient/src/examples/org/apache/http/examples/client/ClientPreemptiveBasicAuthentication.java b/httpclient/src/examples/org/apache/http/examples/client/ClientPreemptiveBasicAuthentication.java
index b0986cd6d2..d43b35c7bd 100644
--- a/httpclient/src/examples/org/apache/http/examples/client/ClientPreemptiveBasicAuthentication.java
+++ b/httpclient/src/examples/org/apache/http/examples/client/ClientPreemptiveBasicAuthentication.java
@@ -52,11 +52,11 @@
public class ClientPreemptiveBasicAuthentication {
public static void main(String[] args) throws Exception {
- HttpHost target = new HttpHost("localhost", 80, "http");
+ HttpHost target = new HttpHost("httpbin.org", 80, "http");
CredentialsProvider credsProvider = new BasicCredentialsProvider();
credsProvider.setCredentials(
new AuthScope(target.getHostName(), target.getPort()),
- new UsernamePasswordCredentials("username", "password"));
+ new UsernamePasswordCredentials("user", "passwd"));
CloseableHttpClient httpclient = HttpClients.custom()
.setDefaultCredentialsProvider(credsProvider).build();
try {
@@ -72,7 +72,7 @@ public static void main(String[] args) throws Exception {
HttpClientContext localContext = HttpClientContext.create();
localContext.setAuthCache(authCache);
- HttpGet httpget = new HttpGet("/");
+ HttpGet httpget = new HttpGet("http://httpbin.org/hidden-basic-auth/user/passwd");
System.out.println("Executing request " + httpget.getRequestLine() + " to target " + target);
for (int i = 0; i < 3; i++) {
@@ -80,7 +80,7 @@ public static void main(String[] args) throws Exception {
try {
System.out.println("----------------------------------------");
System.out.println(response.getStatusLine());
- EntityUtils.consume(response.getEntity());
+ System.out.println(EntityUtils.toString(response.getEntity()));
} finally {
response.close();
}
diff --git a/httpclient/src/examples/org/apache/http/examples/client/ClientPreemptiveDigestAuthentication.java b/httpclient/src/examples/org/apache/http/examples/client/ClientPreemptiveDigestAuthentication.java
index fd2e1182a9..0bec3e95d1 100644
--- a/httpclient/src/examples/org/apache/http/examples/client/ClientPreemptiveDigestAuthentication.java
+++ b/httpclient/src/examples/org/apache/http/examples/client/ClientPreemptiveDigestAuthentication.java
@@ -53,11 +53,11 @@
public class ClientPreemptiveDigestAuthentication {
public static void main(String[] args) throws Exception {
- HttpHost target = new HttpHost("localhost", 80, "http");
+ HttpHost target = new HttpHost("httpbin.org", 80, "http");
CredentialsProvider credsProvider = new BasicCredentialsProvider();
credsProvider.setCredentials(
new AuthScope(target.getHostName(), target.getPort()),
- new UsernamePasswordCredentials("username", "password"));
+ new UsernamePasswordCredentials("user", "passwd"));
CloseableHttpClient httpclient = HttpClients.custom()
.setDefaultCredentialsProvider(credsProvider)
.build();
@@ -78,7 +78,7 @@ public static void main(String[] args) throws Exception {
HttpClientContext localContext = HttpClientContext.create();
localContext.setAuthCache(authCache);
- HttpGet httpget = new HttpGet("/");
+ HttpGet httpget = new HttpGet("http://httpbin.org/digest-auth/auth/user/passwd");
System.out.println("Executing request " + httpget.getRequestLine() + " to target " + target);
for (int i = 0; i < 3; i++) {
@@ -86,7 +86,7 @@ public static void main(String[] args) throws Exception {
try {
System.out.println("----------------------------------------");
System.out.println(response.getStatusLine());
- EntityUtils.consume(response.getEntity());
+ System.out.println(EntityUtils.toString(response.getEntity()));
} finally {
response.close();
}
diff --git a/httpclient/src/examples/org/apache/http/examples/client/ClientProxyAuthentication.java b/httpclient/src/examples/org/apache/http/examples/client/ClientProxyAuthentication.java
index d4431f148c..a3e83b541f 100644
--- a/httpclient/src/examples/org/apache/http/examples/client/ClientProxyAuthentication.java
+++ b/httpclient/src/examples/org/apache/http/examples/client/ClientProxyAuthentication.java
@@ -47,18 +47,21 @@ public class ClientProxyAuthentication {
public static void main(String[] args) throws Exception {
CredentialsProvider credsProvider = new BasicCredentialsProvider();
credsProvider.setCredentials(
- new AuthScope("localhost", 8080),
- new UsernamePasswordCredentials("username", "password"));
+ new AuthScope("localhost", 8888),
+ new UsernamePasswordCredentials("squid", "squid"));
+ credsProvider.setCredentials(
+ new AuthScope("httpbin.org", 80),
+ new UsernamePasswordCredentials("user", "passwd"));
CloseableHttpClient httpclient = HttpClients.custom()
.setDefaultCredentialsProvider(credsProvider).build();
try {
- HttpHost target = new HttpHost("www.verisign.com", 443, "https");
- HttpHost proxy = new HttpHost("localhost", 8080);
+ HttpHost target = new HttpHost("httpbin.org", 80, "http");
+ HttpHost proxy = new HttpHost("localhost", 8888);
RequestConfig config = RequestConfig.custom()
.setProxy(proxy)
.build();
- HttpGet httpget = new HttpGet("/");
+ HttpGet httpget = new HttpGet("/basic-auth/user/passwd");
httpget.setConfig(config);
System.out.println("Executing request " + httpget.getRequestLine() + " to " + target + " via " + proxy);
@@ -67,7 +70,7 @@ public static void main(String[] args) throws Exception {
try {
System.out.println("----------------------------------------");
System.out.println(response.getStatusLine());
- EntityUtils.consume(response.getEntity());
+ System.out.println(EntityUtils.toString(response.getEntity()));
} finally {
response.close();
}
diff --git a/httpclient/src/examples/org/apache/http/examples/client/ClientWithRequestFuture.java b/httpclient/src/examples/org/apache/http/examples/client/ClientWithRequestFuture.java
index e9f9740b02..41328185a6 100644
--- a/httpclient/src/examples/org/apache/http/examples/client/ClientWithRequestFuture.java
+++ b/httpclient/src/examples/org/apache/http/examples/client/ClientWithRequestFuture.java
@@ -64,7 +64,7 @@ public Boolean handleResponse(HttpResponse response) throws ClientProtocolExcept
};
// Simple request ...
- HttpGet request1 = new HttpGet("http://google.com");
+ HttpGet request1 = new HttpGet("http://httpbin.org/get");
HttpRequestFutureTask futureTask1 = requestExecService.execute(request1,
HttpClientContext.create(), handler);
Boolean wasItOk1 = futureTask1.get();
@@ -72,7 +72,7 @@ public Boolean handleResponse(HttpResponse response) throws ClientProtocolExcept
// Cancel a request
try {
- HttpGet request2 = new HttpGet("http://google.com");
+ HttpGet request2 = new HttpGet("http://httpbin.org/get");
HttpRequestFutureTask futureTask2 = requestExecService.execute(request2,
HttpClientContext.create(), handler);
futureTask2.cancel(true);
@@ -83,7 +83,7 @@ public Boolean handleResponse(HttpResponse response) throws ClientProtocolExcept
}
// Request with a timeout
- HttpGet request3 = new HttpGet("http://google.com");
+ HttpGet request3 = new HttpGet("http://httpbin.org/get");
HttpRequestFutureTask futureTask3 = requestExecService.execute(request3,
HttpClientContext.create(), handler);
Boolean wasItOk3 = futureTask3.get(10, TimeUnit.SECONDS);
@@ -107,7 +107,7 @@ public void cancelled() {
};
// Simple request with a callback
- HttpGet request4 = new HttpGet("http://google.com");
+ HttpGet request4 = new HttpGet("http://httpbin.org/get");
// using a null HttpContext here since it is optional
// the callback will be called when the task completes, fails, or is cancelled
HttpRequestFutureTask futureTask4 = requestExecService.execute(request4,
diff --git a/httpclient/src/examples/org/apache/http/examples/client/ClientWithResponseHandler.java b/httpclient/src/examples/org/apache/http/examples/client/ClientWithResponseHandler.java
index 401fdc99f7..ec58d589b0 100644
--- a/httpclient/src/examples/org/apache/http/examples/client/ClientWithResponseHandler.java
+++ b/httpclient/src/examples/org/apache/http/examples/client/ClientWithResponseHandler.java
@@ -47,7 +47,7 @@ public class ClientWithResponseHandler {
public final static void main(String[] args) throws Exception {
CloseableHttpClient httpclient = HttpClients.createDefault();
try {
- HttpGet httpget = new HttpGet("http://localhost/");
+ HttpGet httpget = new HttpGet("http://httpbin.org/");
System.out.println("Executing request " + httpget.getRequestLine());
diff --git a/httpclient/src/examples/org/apache/http/examples/client/QuickStart.java b/httpclient/src/examples/org/apache/http/examples/client/QuickStart.java
index dd5863adf2..cf5fed1c8a 100644
--- a/httpclient/src/examples/org/apache/http/examples/client/QuickStart.java
+++ b/httpclient/src/examples/org/apache/http/examples/client/QuickStart.java
@@ -45,7 +45,7 @@ public class QuickStart {
public static void main(String[] args) throws Exception {
CloseableHttpClient httpclient = HttpClients.createDefault();
try {
- HttpGet httpGet = new HttpGet("http://targethost/homepage");
+ HttpGet httpGet = new HttpGet("http://httpbin.org/get");
CloseableHttpResponse response1 = httpclient.execute(httpGet);
// The underlying HTTP connection is still held by the response object
// to allow the response content to be streamed directly from the network socket.
@@ -64,7 +64,7 @@ public static void main(String[] args) throws Exception {
response1.close();
}
- HttpPost httpPost = new HttpPost("http://targethost/login");
+ HttpPost httpPost = new HttpPost("http://httpbin.org/post");
List nvps = new ArrayList ();
nvps.add(new BasicNameValuePair("username", "vip"));
nvps.add(new BasicNameValuePair("password", "secret"));
diff --git a/httpclient/src/test/resources/commons-logging.properties b/httpclient/src/test/resources/commons-logging.properties
index 2fa1b3b729..831ac3669c 100644
--- a/httpclient/src/test/resources/commons-logging.properties
+++ b/httpclient/src/test/resources/commons-logging.properties
@@ -23,4 +23,4 @@
# .
# Disable logging for unit tests
-org.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog
+# org.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog
From ab3bdf022910c1fbd2221d2c1d598f142dadd1d9 Mon Sep 17 00:00:00 2001
From: Oleg Kalnichevski
Date: Fri, 7 Aug 2015 07:40:08 +0000
Subject: [PATCH 018/204] HTTPCLIENT-1674: fixed project url in pom.xml
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1694624 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 815cce92c7..bfcb81d007 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,7 +35,7 @@
Apache HttpComponents Client4.5.1-SNAPSHOTApache HttpComponents Client is a library of components for building client side HTTP services
- http://hc.apache.org/httpcomponents-client
+ http://hc.apache.org/httpcomponents-client-ga/1999pom
From dee78eca68ec4f6f907b7b0ac5ab93fec6fe880c Mon Sep 17 00:00:00 2001
From: Oleg Kalnichevski
Date: Fri, 7 Aug 2015 18:51:38 +0000
Subject: [PATCH 019/204] Removed unused import
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1694729 13f79535-47bb-0310-9956-ffa450edef68
---
.../org/apache/http/examples/client/ClientConfiguration.java | 1 -
httpclient/src/test/resources/commons-logging.properties | 2 +-
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/httpclient/src/examples/org/apache/http/examples/client/ClientConfiguration.java b/httpclient/src/examples/org/apache/http/examples/client/ClientConfiguration.java
index 4ad7230a7c..af1c1a5c7a 100644
--- a/httpclient/src/examples/org/apache/http/examples/client/ClientConfiguration.java
+++ b/httpclient/src/examples/org/apache/http/examples/client/ClientConfiguration.java
@@ -36,7 +36,6 @@
import org.apache.http.Consts;
import org.apache.http.Header;
-import org.apache.http.HttpEntity;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
import org.apache.http.HttpResponse;
diff --git a/httpclient/src/test/resources/commons-logging.properties b/httpclient/src/test/resources/commons-logging.properties
index 831ac3669c..2fa1b3b729 100644
--- a/httpclient/src/test/resources/commons-logging.properties
+++ b/httpclient/src/test/resources/commons-logging.properties
@@ -23,4 +23,4 @@
# .
# Disable logging for unit tests
-# org.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog
+org.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog
From 795a092dbd572f15b3f2d33203415e2b8bf9f2a9 Mon Sep 17 00:00:00 2001
From: Michael Osipov
Date: Tue, 11 Aug 2015 10:00:42 +0000
Subject: [PATCH 020/204] Correct spelling of user 'principal' in the
documentation
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1695238 13f79535-47bb-0310-9956-ffa450edef68
---
RELEASE_NOTES.txt | 2 +-
.../apache/http/impl/auth/win/TestWindowsNegotiateScheme.java | 2 +-
.../org/apache/http/impl/client/DefaultUserTokenHandler.java | 2 +-
src/docbkx/advanced.xml | 4 ++--
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 5cabfbaa6d..c8c18d8d92 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -174,7 +174,7 @@ Changelog:
* [HTTPCLIENT-1547] HttpClient OSGi bundle doesn't import the package "javax.naming".
Contributed by Willem Jiang
-* [HTTPCLIENT-1541] Use correct (HTTP/hostname) service principle name for Windows native
+* [HTTPCLIENT-1541] Use correct (HTTP/hostname) service principal name for Windows native
Negotiate/NTLM auth schemes.
Contributed by Ka-Lok Fung
diff --git a/httpclient-win/src/test/java/org/apache/http/impl/auth/win/TestWindowsNegotiateScheme.java b/httpclient-win/src/test/java/org/apache/http/impl/auth/win/TestWindowsNegotiateScheme.java
index 6ff2d746be..1fea3f835f 100644
--- a/httpclient-win/src/test/java/org/apache/http/impl/auth/win/TestWindowsNegotiateScheme.java
+++ b/httpclient-win/src/test/java/org/apache/http/impl/auth/win/TestWindowsNegotiateScheme.java
@@ -91,7 +91,7 @@ public void testNoInfiniteLoopOnSPNOutsideDomain() throws Exception {
Assume.assumeTrue("Test can only be run on Windows", WinHttpClients.isWinAuthAvailable());
// HTTPCLIENT-1545
- // If a service principle name (SPN) from outside your Windows domain tree (e.g., HTTP/example.com) is used,
+ // If a service principal name (SPN) from outside your Windows domain tree (e.g., HTTP/example.com) is used,
// InitializeSecurityContext will return SEC_E_DOWNGRADE_DETECTED (decimal: -2146892976, hex: 0x80090350).
// Because WindowsNegotiateScheme wasn't setting the completed state correctly when authentication fails,
// HttpClient goes into an infinite loop, constantly retrying the negotiate authentication to kingdom
diff --git a/httpclient/src/main/java/org/apache/http/impl/client/DefaultUserTokenHandler.java b/httpclient/src/main/java/org/apache/http/impl/client/DefaultUserTokenHandler.java
index 99fc92247a..e2a43c4b81 100644
--- a/httpclient/src/main/java/org/apache/http/impl/client/DefaultUserTokenHandler.java
+++ b/httpclient/src/main/java/org/apache/http/impl/client/DefaultUserTokenHandler.java
@@ -47,7 +47,7 @@
* persistent connections created with a particular user identity within
* a particular security context can be reused by the same user only.
*
- * DefaultUserTokenHandler will use the user principle of connection
+ * DefaultUserTokenHandler will use the user principal of connection
* based authentication schemes such as NTLM or that of the SSL session
* with the client authentication turned on. If both are unavailable,
* {@code null} token will be returned.
diff --git a/src/docbkx/advanced.xml b/src/docbkx/advanced.xml
index a1bdf4e3ae..b97ca36a3f 100644
--- a/src/docbkx/advanced.xml
+++ b/src/docbkx/advanced.xml
@@ -1,7 +1,7 @@
-
org.apache.httpcomponents
- httpcore
- provided
+ httpcore-osgi
+ ${httpcore.version}
+
+
+ org.apache.httpcomponents
+ httpcore-nio
+
+ commons-codeccommons-codec${commons-codec.version}
- compileorg.apache.httpcomponentshttpmime${project.version}
- compileorg.apache.httpcomponentshttpclient-cache${project.version}
- compileorg.apache.httpcomponentsfluent-hc${project.version}
- compileorg.osgiorg.osgi.core
- 4.2.0
+ ${osgi.framework.version}providedorg.osgiorg.osgi.compendium
- 4.2.0
- provided
+ ${osgi.framework.version}
@@ -98,6 +103,42 @@
junittest
+
+ org.ops4j.pax.exam
+ pax-exam-container-native
+ ${pax.exam.version}
+ test
+
+
+ org.apache.felix
+ org.apache.felix.framework
+ 5.0.1
+ test
+
+
+ org.ops4j.pax.exam
+ pax-exam-junit4
+ test
+ ${pax.exam.version}
+
+
+ org.ops4j.pax.exam
+ pax-exam-link-mvn
+ test
+ ${pax.exam.version}
+
+
+ org.ops4j.pax.url
+ pax-url-aether
+ ${pax.url.version}
+ test
+
+
+ org.slf4j
+ slf4j-log4j12
+ ${slf4j.version}
+ test
+
@@ -107,6 +148,29 @@
+
+ org.apache.maven.plugins
+ maven-dependency-plugin
+
+
+ copy-bundles
+ generate-test-resources
+
+ copy-dependencies
+
+
+ ${project.build.directory}/bundles
+
+ org.slf4j
+ httpclient,httpmime,httpclient-cache,fluent-hc,httpcore,org.osgi.core
+ compile
+
+
+
+ org.apache.felixmaven-bundle-plugin
@@ -121,7 +185,6 @@
org.apache.http.conn.*;version=${project.version},
org.apache.http.client.*;version=${project.version},
org.apache.http.entity.mime.*;version=${project.version},
- org.apache.http.entity.mime.content.*;version=${project.version},
org.apache.http.impl.auth.*;version=${project.version},
org.apache.http.impl.cookie.*;version=${project.version},
org.apache.http.impl.conn.*;version=${project.version},
@@ -174,6 +237,26 @@
true
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+ 2.18.1
+
+
+
+ integration-test
+ verify
+
+
+
+ true
+ ${project.build.directory}
+ ${project.version}
+
+
+
+
+ org.apache.httpcomponents.httpclient_${project.version}
diff --git a/httpclient-osgi/src/test/java/org/apache/http/osgi/impl/MimeExportedIT.java b/httpclient-osgi/src/test/java/org/apache/http/osgi/impl/MimeExportedIT.java
new file mode 100644
index 0000000000..f58acc0571
--- /dev/null
+++ b/httpclient-osgi/src/test/java/org/apache/http/osgi/impl/MimeExportedIT.java
@@ -0,0 +1,93 @@
+/*
+ * ====================================================================
+ * 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
+ * .
+ *
+ */
+
+package org.apache.http.osgi.impl;
+
+import org.apache.http.entity.mime.content.ByteArrayBody;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.ops4j.pax.exam.CoreOptions.junitBundles;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.provision;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+
+/**
+ * pax-exam test for the OSGi packaging of the client.
+ */
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class MimeExportedIT {
+
+ @Configuration
+ public Option[] config() {
+ final String projectBuildDirectory = System.getProperty("project.build.directory", "target");
+ final String projectVersion = System.getProperty("project.version");
+
+ final List bundleUrls = new ArrayList();
+ final File bundleDir = new File(projectBuildDirectory, "bundles");
+ final File[] bundleFiles = bundleDir.listFiles(new FilenameFilter() {
+ @Override
+ public boolean accept(final File dir, final String name) {
+ return name.endsWith(".jar");
+ }
+ });
+ for (File bundleFile : bundleFiles) {
+ try {
+ bundleUrls.add(bundleFile.toURI().toURL().toExternalForm());
+ } catch (MalformedURLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ bundleUrls.add(String.format("file:%s/org.apache.httpcomponents.httpclient_%s.jar", projectBuildDirectory, projectVersion));
+
+ final String[] bundles = bundleUrls.toArray(new String[bundleUrls.size()]);
+ return options(
+ provision(bundles),
+ junitBundles(),
+ systemProperty("pax.exam.osgi.unresolved.fail").value("true"),
+ systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("WARN")
+ );
+ }
+
+ @Test
+ public void useContentBody() {
+ new ByteArrayBody(new byte[0], "filename.txt");
+ }
+}
diff --git a/httpclient-osgi/src/test/resources/log4j.properties b/httpclient-osgi/src/test/resources/log4j.properties
new file mode 100644
index 0000000000..9998ef530e
--- /dev/null
+++ b/httpclient-osgi/src/test/resources/log4j.properties
@@ -0,0 +1,27 @@
+# * ====================================================================
+# * 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.
+# * ====================================================================\
+
+log4j.rootLogger=WARN, A1
+
+# A1 is set to be a ConsoleAppender.
+log4j.appender.A1=org.apache.log4j.ConsoleAppender
+
+# A1 uses PatternLayout.
+log4j.appender.A1.layout=org.apache.log4j.PatternLayout
+log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
From 2b3230123aa4a94652f50e8d3b8d93f2200545ac Mon Sep 17 00:00:00 2001
From: Oleg Kalnichevski
Date: Sun, 16 Aug 2015 14:19:04 +0000
Subject: [PATCH 023/204] HTTPCLIENT-1673: make the test case a bit more
substantial.
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1696143 13f79535-47bb-0310-9956-ffa450edef68
---
.../apache/http/osgi/impl/MimeExportedIT.java | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/httpclient-osgi/src/test/java/org/apache/http/osgi/impl/MimeExportedIT.java b/httpclient-osgi/src/test/java/org/apache/http/osgi/impl/MimeExportedIT.java
index f58acc0571..2f27829cf1 100644
--- a/httpclient-osgi/src/test/java/org/apache/http/osgi/impl/MimeExportedIT.java
+++ b/httpclient-osgi/src/test/java/org/apache/http/osgi/impl/MimeExportedIT.java
@@ -27,7 +27,12 @@
package org.apache.http.osgi.impl;
+import org.apache.http.HttpEntity;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.entity.mime.content.ByteArrayBody;
+import org.apache.http.entity.mime.content.StringBody;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Configuration;
@@ -88,6 +93,17 @@ public boolean accept(final File dir, final String name) {
@Test
public void useContentBody() {
- new ByteArrayBody(new byte[0], "filename.txt");
+ final HttpPost httppost = new HttpPost("http://localhost:8181/cxf/annotator/annotate");
+ httppost.addHeader("Accept", "application/json");
+ final StringBody options = new StringBody("{}", ContentType.APPLICATION_JSON);
+ final byte[] atData = new byte[] { 1 };
+ final ByteArrayBody bab = new ByteArrayBody(atData, ContentType.APPLICATION_JSON, "at.json");
+
+ final HttpEntity reqEntity = MultipartEntityBuilder.create()
+ .setContentType(ContentType.create("multipart/mixed"))
+ .addPart("options", options)
+ .addPart("text", bab)
+ .build();
+ httppost.setEntity(reqEntity);
}
}
From 3ae055638f5993ae7c2c644865301e23cd34fb9f Mon Sep 17 00:00:00 2001
From: Michael Osipov
Date: Wed, 19 Aug 2015 13:02:54 +0000
Subject: [PATCH 024/204] HTTPCLIENT-1106: Use character arrays for passwords
in Credentials objects, not Strings
Deprecate constructors using String-based passwords
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1696576 13f79535-47bb-0310-9956-ffa450edef68
---
.../src/main/java/org/apache/http/auth/NTCredentials.java | 3 ++-
.../java/org/apache/http/auth/UsernamePasswordCredentials.java | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/httpclient/src/main/java/org/apache/http/auth/NTCredentials.java b/httpclient/src/main/java/org/apache/http/auth/NTCredentials.java
index b0a0c4e7ca..3ce343fb3c 100644
--- a/httpclient/src/main/java/org/apache/http/auth/NTCredentials.java
+++ b/httpclient/src/main/java/org/apache/http/auth/NTCredentials.java
@@ -59,6 +59,7 @@ public class NTCredentials implements Credentials, Serializable {
* string argument.
*
* @param usernamePassword the domain/username:password formed string
+ * @deprecated (4.5) will be replaced with {@code String}, {@code char[]} in 5.0
*/
public NTCredentials(final String usernamePassword) {
super();
@@ -88,7 +89,7 @@ public NTCredentials(final String usernamePassword) {
/**
* Constructor.
* @param userName The user name. This should not include the domain to authenticate with.
- * For example: "user" is correct whereas "DOMAIN\\user" is not.
+ * For example: "user" is correct whereas "DOMAIN\user" is not.
* @param password The password.
* @param workstation The workstation the authentication request is originating from.
* Essentially, the computer name for this machine.
diff --git a/httpclient/src/main/java/org/apache/http/auth/UsernamePasswordCredentials.java b/httpclient/src/main/java/org/apache/http/auth/UsernamePasswordCredentials.java
index e2f45c0521..e31d036f3c 100644
--- a/httpclient/src/main/java/org/apache/http/auth/UsernamePasswordCredentials.java
+++ b/httpclient/src/main/java/org/apache/http/auth/UsernamePasswordCredentials.java
@@ -52,6 +52,7 @@ public class UsernamePasswordCredentials implements Credentials, Serializable {
*
* @param usernamePassword the username:password formed string
* @see #toString
+ * @deprecated (4.5) will be replaced with {@code String}, {@code char[]} in 5.0
*/
public UsernamePasswordCredentials(final String usernamePassword) {
super();
From c0938e1f5592f77995c713c4897e87a596d9084d Mon Sep 17 00:00:00 2001
From: Oleg Kalnichevski
Date: Fri, 21 Aug 2015 13:34:01 +0000
Subject: [PATCH 025/204] Revert "HTTPCLIENT-1673: make the test case a bit
more substantial."
This reverts commit 2b3230123aa4a94652f50e8d3b8d93f2200545ac.
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1696971 13f79535-47bb-0310-9956-ffa450edef68
---
.../apache/http/osgi/impl/MimeExportedIT.java | 18 +-----------------
1 file changed, 1 insertion(+), 17 deletions(-)
diff --git a/httpclient-osgi/src/test/java/org/apache/http/osgi/impl/MimeExportedIT.java b/httpclient-osgi/src/test/java/org/apache/http/osgi/impl/MimeExportedIT.java
index 2f27829cf1..f58acc0571 100644
--- a/httpclient-osgi/src/test/java/org/apache/http/osgi/impl/MimeExportedIT.java
+++ b/httpclient-osgi/src/test/java/org/apache/http/osgi/impl/MimeExportedIT.java
@@ -27,12 +27,7 @@
package org.apache.http.osgi.impl;
-import org.apache.http.HttpEntity;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.ContentType;
-import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.entity.mime.content.ByteArrayBody;
-import org.apache.http.entity.mime.content.StringBody;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Configuration;
@@ -93,17 +88,6 @@ public boolean accept(final File dir, final String name) {
@Test
public void useContentBody() {
- final HttpPost httppost = new HttpPost("http://localhost:8181/cxf/annotator/annotate");
- httppost.addHeader("Accept", "application/json");
- final StringBody options = new StringBody("{}", ContentType.APPLICATION_JSON);
- final byte[] atData = new byte[] { 1 };
- final ByteArrayBody bab = new ByteArrayBody(atData, ContentType.APPLICATION_JSON, "at.json");
-
- final HttpEntity reqEntity = MultipartEntityBuilder.create()
- .setContentType(ContentType.create("multipart/mixed"))
- .addPart("options", options)
- .addPart("text", bab)
- .build();
- httppost.setEntity(reqEntity);
+ new ByteArrayBody(new byte[0], "filename.txt");
}
}
From 80ff3b2e27a5a99ead75845f9d8151246605c13b Mon Sep 17 00:00:00 2001
From: Oleg Kalnichevski
Date: Fri, 21 Aug 2015 13:35:04 +0000
Subject: [PATCH 026/204] Revert "HTTPCLIENT-1673: revert change, which was not
necessary"
This reverts commit 7f66d5dc61651cd2f024901e5f9243d72fe361a4.
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1696973 13f79535-47bb-0310-9956-ffa450edef68
---
httpclient-osgi/pom.xml | 105 ++----------------
.../apache/http/osgi/impl/MimeExportedIT.java | 93 ----------------
.../src/test/resources/log4j.properties | 27 -----
3 files changed, 11 insertions(+), 214 deletions(-)
delete mode 100644 httpclient-osgi/src/test/java/org/apache/http/osgi/impl/MimeExportedIT.java
delete mode 100644 httpclient-osgi/src/test/resources/log4j.properties
diff --git a/httpclient-osgi/pom.xml b/httpclient-osgi/pom.xml
index c7a898f6e4..5569b8cadb 100644
--- a/httpclient-osgi/pom.xml
+++ b/httpclient-osgi/pom.xml
@@ -42,10 +42,6 @@
"[4.4.0, 4.5.0)""[1.1.0, 1.3.0)"
- 2.4.1
- 4.5.0
- 5.0.0
- 1.7.5
@@ -53,49 +49,48 @@
org.apache.httpcomponentshttpclient${project.version}
+ compile
-
org.apache.httpcomponents
- httpcore-osgi
- ${httpcore.version}
-
-
- org.apache.httpcomponents
- httpcore-nio
-
-
+ httpcore
+ providedcommons-codeccommons-codec${commons-codec.version}
+ compileorg.apache.httpcomponentshttpmime${project.version}
+ compileorg.apache.httpcomponentshttpclient-cache${project.version}
+ compileorg.apache.httpcomponentsfluent-hc${project.version}
+ compileorg.osgiorg.osgi.core
- ${osgi.framework.version}
+ 4.2.0providedorg.osgiorg.osgi.compendium
- ${osgi.framework.version}
+ 4.2.0
+ provided
@@ -103,42 +98,6 @@
junittest
-
- org.ops4j.pax.exam
- pax-exam-container-native
- ${pax.exam.version}
- test
-
-
- org.apache.felix
- org.apache.felix.framework
- 5.0.1
- test
-
-
- org.ops4j.pax.exam
- pax-exam-junit4
- test
- ${pax.exam.version}
-
-
- org.ops4j.pax.exam
- pax-exam-link-mvn
- test
- ${pax.exam.version}
-
-
- org.ops4j.pax.url
- pax-url-aether
- ${pax.url.version}
- test
-
-
- org.slf4j
- slf4j-log4j12
- ${slf4j.version}
- test
-
@@ -148,29 +107,6 @@
-
- org.apache.maven.plugins
- maven-dependency-plugin
-
-
- copy-bundles
- generate-test-resources
-
- copy-dependencies
-
-
- ${project.build.directory}/bundles
-
- org.slf4j
- httpclient,httpmime,httpclient-cache,fluent-hc,httpcore,org.osgi.core
- compile
-
-
-
- org.apache.felixmaven-bundle-plugin
@@ -185,6 +121,7 @@
org.apache.http.conn.*;version=${project.version},
org.apache.http.client.*;version=${project.version},
org.apache.http.entity.mime.*;version=${project.version},
+ org.apache.http.entity.mime.content.*;version=${project.version},
org.apache.http.impl.auth.*;version=${project.version},
org.apache.http.impl.cookie.*;version=${project.version},
org.apache.http.impl.conn.*;version=${project.version},
@@ -237,26 +174,6 @@
true
-
- org.apache.maven.plugins
- maven-failsafe-plugin
- 2.18.1
-
-
-
- integration-test
- verify
-
-
-
- true
- ${project.build.directory}
- ${project.version}
-
-
-
-
- org.apache.httpcomponents.httpclient_${project.version}
diff --git a/httpclient-osgi/src/test/java/org/apache/http/osgi/impl/MimeExportedIT.java b/httpclient-osgi/src/test/java/org/apache/http/osgi/impl/MimeExportedIT.java
deleted file mode 100644
index f58acc0571..0000000000
--- a/httpclient-osgi/src/test/java/org/apache/http/osgi/impl/MimeExportedIT.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * ====================================================================
- * 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
- * .
- *
- */
-
-package org.apache.http.osgi.impl;
-
-import org.apache.http.entity.mime.content.ByteArrayBody;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
-import org.ops4j.pax.exam.spi.reactors.PerClass;
-
-import java.io.File;
-import java.io.FilenameFilter;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.List;
-
-import static org.ops4j.pax.exam.CoreOptions.junitBundles;
-import static org.ops4j.pax.exam.CoreOptions.options;
-import static org.ops4j.pax.exam.CoreOptions.provision;
-import static org.ops4j.pax.exam.CoreOptions.systemProperty;
-
-/**
- * pax-exam test for the OSGi packaging of the client.
- */
-@RunWith(PaxExam.class)
-@ExamReactorStrategy(PerClass.class)
-public class MimeExportedIT {
-
- @Configuration
- public Option[] config() {
- final String projectBuildDirectory = System.getProperty("project.build.directory", "target");
- final String projectVersion = System.getProperty("project.version");
-
- final List bundleUrls = new ArrayList();
- final File bundleDir = new File(projectBuildDirectory, "bundles");
- final File[] bundleFiles = bundleDir.listFiles(new FilenameFilter() {
- @Override
- public boolean accept(final File dir, final String name) {
- return name.endsWith(".jar");
- }
- });
- for (File bundleFile : bundleFiles) {
- try {
- bundleUrls.add(bundleFile.toURI().toURL().toExternalForm());
- } catch (MalformedURLException e) {
- throw new RuntimeException(e);
- }
- }
-
- bundleUrls.add(String.format("file:%s/org.apache.httpcomponents.httpclient_%s.jar", projectBuildDirectory, projectVersion));
-
- final String[] bundles = bundleUrls.toArray(new String[bundleUrls.size()]);
- return options(
- provision(bundles),
- junitBundles(),
- systemProperty("pax.exam.osgi.unresolved.fail").value("true"),
- systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("WARN")
- );
- }
-
- @Test
- public void useContentBody() {
- new ByteArrayBody(new byte[0], "filename.txt");
- }
-}
diff --git a/httpclient-osgi/src/test/resources/log4j.properties b/httpclient-osgi/src/test/resources/log4j.properties
deleted file mode 100644
index 9998ef530e..0000000000
--- a/httpclient-osgi/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,27 +0,0 @@
-# * ====================================================================
-# * 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.
-# * ====================================================================\
-
-log4j.rootLogger=WARN, A1
-
-# A1 is set to be a ConsoleAppender.
-log4j.appender.A1=org.apache.log4j.ConsoleAppender
-
-# A1 uses PatternLayout.
-log4j.appender.A1.layout=org.apache.log4j.PatternLayout
-log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
From 6fd73b5fb52b44ef7670765a35d88cbf939b36a5 Mon Sep 17 00:00:00 2001
From: Oleg Kalnichevski
Date: Sun, 30 Aug 2015 16:34:38 +0000
Subject: [PATCH 027/204] HTTPCLIENT-1680: redirect of a POST request causes
ClientProtocolException
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1700136 13f79535-47bb-0310-9956-ffa450edef68
---
.../http/impl/execchain/RedirectExec.java | 4 ++--
.../http/impl/execchain/TestRedirectExec.java | 20 +++++++++----------
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/httpclient/src/main/java/org/apache/http/impl/execchain/RedirectExec.java b/httpclient/src/main/java/org/apache/http/impl/execchain/RedirectExec.java
index f9c1d795f3..dcafdb55ca 100644
--- a/httpclient/src/main/java/org/apache/http/impl/execchain/RedirectExec.java
+++ b/httpclient/src/main/java/org/apache/http/impl/execchain/RedirectExec.java
@@ -111,7 +111,7 @@ public CloseableHttpResponse execute(
currentRoute, currentRequest, context, execAware);
try {
if (config.isRedirectsEnabled() &&
- this.redirectStrategy.isRedirected(currentRequest, response, context)) {
+ this.redirectStrategy.isRedirected(currentRequest.getOriginal(), response, context)) {
if (redirectCount >= maxRedirects) {
throw new RedirectException("Maximum redirects ("+ maxRedirects + ") exceeded");
@@ -119,7 +119,7 @@ public CloseableHttpResponse execute(
redirectCount++;
final HttpRequest redirect = this.redirectStrategy.getRedirect(
- currentRequest, response, context);
+ currentRequest.getOriginal(), response, context);
if (!redirect.headerIterator().hasNext()) {
final HttpRequest original = request.getOriginal();
redirect.setHeaders(original.getAllHeaders());
diff --git a/httpclient/src/test/java/org/apache/http/impl/execchain/TestRedirectExec.java b/httpclient/src/test/java/org/apache/http/impl/execchain/TestRedirectExec.java
index ed1546cb7d..5621a3f2c1 100644
--- a/httpclient/src/test/java/org/apache/http/impl/execchain/TestRedirectExec.java
+++ b/httpclient/src/test/java/org/apache/http/impl/execchain/TestRedirectExec.java
@@ -120,11 +120,11 @@ public void testFundamentals() throws Exception {
Mockito.any(),
Mockito.any())).thenReturn(response2);
Mockito.when(redirectStrategy.isRedirected(
- Mockito.same(request),
+ Mockito.same(get),
Mockito.same(response1),
Mockito.any())).thenReturn(Boolean.TRUE);
Mockito.when(redirectStrategy.getRedirect(
- Mockito.same(request),
+ Mockito.same(get),
Mockito.same(response1),
Mockito.any())).thenReturn(redirect);
Mockito.when(httpRoutePlanner.determineRoute(
@@ -216,11 +216,11 @@ public void testRelativeRedirect() throws Exception {
Mockito.any(),
Mockito.any())).thenReturn(response2);
Mockito.when(redirectStrategy.isRedirected(
- Mockito.same(request),
+ Mockito.same(get),
Mockito.same(response1),
Mockito.any())).thenReturn(Boolean.TRUE);
Mockito.when(redirectStrategy.getRedirect(
- Mockito.same(request),
+ Mockito.same(get),
Mockito.same(response1),
Mockito.any())).thenReturn(redirect);
Mockito.when(httpRoutePlanner.determineRoute(
@@ -240,10 +240,10 @@ public void testCrossSiteRedirect() throws Exception {
final AuthState targetAuthState = new AuthState();
targetAuthState.setState(AuthProtocolState.SUCCESS);
- targetAuthState.update(new BasicScheme(), new UsernamePasswordCredentials("user:pass"));
+ targetAuthState.update(new BasicScheme(), new UsernamePasswordCredentials("user", "pass"));
final AuthState proxyAuthState = new AuthState();
proxyAuthState.setState(AuthProtocolState.SUCCESS);
- proxyAuthState.update(new NTLMScheme(), new NTCredentials("user:pass"));
+ proxyAuthState.update(new NTLMScheme(), new NTCredentials("user", "pass", null, null));
context.setAttribute(HttpClientContext.TARGET_AUTH_STATE, targetAuthState);
context.setAttribute(HttpClientContext.PROXY_AUTH_STATE, proxyAuthState);
@@ -261,11 +261,11 @@ public void testCrossSiteRedirect() throws Exception {
Mockito.any(),
Mockito.any())).thenReturn(response2);
Mockito.when(redirectStrategy.isRedirected(
- Mockito.same(request),
+ Mockito.same(get),
Mockito.same(response1),
Mockito.any())).thenReturn(Boolean.TRUE);
Mockito.when(redirectStrategy.getRedirect(
- Mockito.same(request),
+ Mockito.same(get),
Mockito.same(response1),
Mockito.any())).thenReturn(redirect);
Mockito.when(httpRoutePlanner.determineRoute(
@@ -332,11 +332,11 @@ public void testRedirectProtocolException() throws Exception {
Mockito.any(),
Mockito.any())).thenReturn(response1);
Mockito.when(redirectStrategy.isRedirected(
- Mockito.same(request),
+ Mockito.same(get),
Mockito.same(response1),
Mockito.any())).thenReturn(Boolean.TRUE);
Mockito.doThrow(new ProtocolException("Oppsie")).when(redirectStrategy).getRedirect(
- Mockito.same(request),
+ Mockito.same(get),
Mockito.same(response1),
Mockito.any());
From 8cf6df2c8ba7b6835116b783bfd05a0416d77b79 Mon Sep 17 00:00:00 2001
From: Oleg Kalnichevski
Date: Fri, 4 Sep 2015 13:47:05 +0000
Subject: [PATCH 028/204] Log socket timeout values
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1701258 13f79535-47bb-0310-9956-ffa450edef68
---
.../conn/LoggingManagedHttpClientConnection.java | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/httpclient/src/main/java/org/apache/http/impl/conn/LoggingManagedHttpClientConnection.java b/httpclient/src/main/java/org/apache/http/impl/conn/LoggingManagedHttpClientConnection.java
index 75adb7a72a..2614b0c9bb 100644
--- a/httpclient/src/main/java/org/apache/http/impl/conn/LoggingManagedHttpClientConnection.java
+++ b/httpclient/src/main/java/org/apache/http/impl/conn/LoggingManagedHttpClientConnection.java
@@ -75,10 +75,21 @@ public LoggingManagedHttpClientConnection(
@Override
public void close() throws IOException {
+
+ if (super.isOpen()) {
+ if (this.log.isDebugEnabled()) {
+ this.log.debug(getId() + ": Close connection");
+ }
+ super.close();
+ }
+ }
+
+ @Override
+ public void setSocketTimeout(final int timeout) {
if (this.log.isDebugEnabled()) {
- this.log.debug(getId() + ": Close connection");
+ this.log.debug(getId() + ": set socket timeout to " + timeout);
}
- super.close();
+ super.setSocketTimeout(timeout);
}
@Override
From abc894b3b86ab102371653993f65c51fb292a408 Mon Sep 17 00:00:00 2001
From: Oleg Kalnichevski
Date: Wed, 9 Sep 2015 16:52:37 +0000
Subject: [PATCH 029/204] Upgraded HttpCore to version 4.4.3
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1702055 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index bfcb81d007..bbaf243ef3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -66,7 +66,7 @@
1.61.6
- 4.4.1
+ 4.4.31.21.92.6.9
From 3b9a03913bcdb7a1c1be70135c4a5f0ccefc963d Mon Sep 17 00:00:00 2001
From: Oleg Kalnichevski
Date: Fri, 11 Sep 2015 12:28:36 +0000
Subject: [PATCH 030/204] Updated release notes for HttpClient 4.5.1 release
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1702444 13f79535-47bb-0310-9956-ffa450edef68
---
RELEASE_NOTES.txt | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index c8c18d8d92..32c1c9691e 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -1,3 +1,32 @@
+Release 4.5.1
+-------------------
+
+HttpClient 4.5.1 (GA) is a maintenance release that fixes a number of minor defects found since 4.5.
+
+Please note that as of 4.4 HttpClient requires Java 1.6 or newer.
+
+Changelog:
+-------------------
+
+* [HTTPCLIENT-1680] redirect of a POST request causes ClientProtocolException.
+ Contributed by Oleg Kalnichevski
+
+* [HTTPCLIENT-1673] org.apache.http.entity.mime.content.* missing from OSGi exports.
+ Contributed by Benson Margulies
+
+* [HTTPCLIENT-1668] Fluent request incorrectly handles connect timeout setting.
+ Contributed by Oleg Kalnichevski
+
+* [HTTPCLIENT-1667] RequestBuilder does not take charset into account when creating
+ UrlEncodedFormEntity.
+ Contributed by Sergey Smith
+
+* [HTTPCLIENT-1655] HttpClient sends RST instead of FIN ACK sequence when using non-persistant
+ connections.
+ Contributed by Oleg Kalnichevski
+
+
+
Release 4.5
-------------------
From b6c1516e61a3e3658742fb0ce7362cf80223a230 Mon Sep 17 00:00:00 2001
From: Oleg Kalnichevski
Date: Tue, 15 Sep 2015 12:18:02 +0000
Subject: [PATCH 031/204] Upgraded HttpClient version to 4.5.2-SNAPSHOT
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1703168 13f79535-47bb-0310-9956-ffa450edef68
---
fluent-hc/pom.xml | 2 +-
httpclient-cache/pom.xml | 2 +-
httpclient-osgi/pom.xml | 2 +-
httpclient-win/pom.xml | 2 +-
httpclient/pom.xml | 2 +-
httpmime/pom.xml | 2 +-
pom.xml | 2 +-
7 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/fluent-hc/pom.xml b/fluent-hc/pom.xml
index e2b351628d..10dea485d9 100644
--- a/fluent-hc/pom.xml
+++ b/fluent-hc/pom.xml
@@ -28,7 +28,7 @@
org.apache.httpcomponentshttpcomponents-client
- 4.5.1-SNAPSHOT
+ 4.5.2-SNAPSHOTfluent-hcApache HttpClient Fluent API
diff --git a/httpclient-cache/pom.xml b/httpclient-cache/pom.xml
index d2a84ff5e9..480eba362a 100644
--- a/httpclient-cache/pom.xml
+++ b/httpclient-cache/pom.xml
@@ -28,7 +28,7 @@
org.apache.httpcomponentshttpcomponents-client
- 4.5.1-SNAPSHOT
+ 4.5.2-SNAPSHOThttpclient-cacheApache HttpClient Cache
diff --git a/httpclient-osgi/pom.xml b/httpclient-osgi/pom.xml
index 5569b8cadb..e403f58108 100644
--- a/httpclient-osgi/pom.xml
+++ b/httpclient-osgi/pom.xml
@@ -28,7 +28,7 @@
org.apache.httpcomponentshttpcomponents-client
- 4.5.1-SNAPSHOT
+ 4.5.2-SNAPSHOThttpclient-osgiApache HttpClient OSGi bundle
diff --git a/httpclient-win/pom.xml b/httpclient-win/pom.xml
index e7208bdaa8..89c2cdb8f0 100644
--- a/httpclient-win/pom.xml
+++ b/httpclient-win/pom.xml
@@ -28,7 +28,7 @@
org.apache.httpcomponentshttpcomponents-client
- 4.5.1-SNAPSHOT
+ 4.5.2-SNAPSHOThttpclient-winApache HttpClient Windows features
diff --git a/httpclient/pom.xml b/httpclient/pom.xml
index 117a838332..985f53db08 100644
--- a/httpclient/pom.xml
+++ b/httpclient/pom.xml
@@ -28,7 +28,7 @@
org.apache.httpcomponentshttpcomponents-client
- 4.5.1-SNAPSHOT
+ 4.5.2-SNAPSHOThttpclientApache HttpClient
diff --git a/httpmime/pom.xml b/httpmime/pom.xml
index 3a0618fe2d..538e13703c 100644
--- a/httpmime/pom.xml
+++ b/httpmime/pom.xml
@@ -28,7 +28,7 @@
org.apache.httpcomponentshttpcomponents-client
- 4.5.1-SNAPSHOT
+ 4.5.2-SNAPSHOThttpmimeApache HttpClient Mime
diff --git a/pom.xml b/pom.xml
index bbaf243ef3..478ad22a4a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -33,7 +33,7 @@
4.0.0httpcomponents-clientApache HttpComponents Client
- 4.5.1-SNAPSHOT
+ 4.5.2-SNAPSHOTApache HttpComponents Client is a library of components for building client side HTTP serviceshttp://hc.apache.org/httpcomponents-client-ga/1999
From e3232f5425be6b127c4d46c4bd8d9cd7b33724f5 Mon Sep 17 00:00:00 2001
From: Oleg Kalnichevski
Date: Sat, 3 Oct 2015 13:07:21 +0000
Subject: [PATCH 032/204] HTTPCLIENT-1685: PublicSuffixDomainFilter to ignore
local hosts and local domains
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1706576 13f79535-47bb-0310-9956-ffa450edef68
---
.../impl/cookie/PublicSuffixDomainFilter.java | 31 ++++++++++++++++---
.../cookie/TestPublicSuffixListParser.java | 26 ++++++++++++++++
2 files changed, 52 insertions(+), 5 deletions(-)
diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/PublicSuffixDomainFilter.java b/httpclient/src/main/java/org/apache/http/impl/cookie/PublicSuffixDomainFilter.java
index 3e44ae89aa..2cafcf11ce 100644
--- a/httpclient/src/main/java/org/apache/http/impl/cookie/PublicSuffixDomainFilter.java
+++ b/httpclient/src/main/java/org/apache/http/impl/cookie/PublicSuffixDomainFilter.java
@@ -26,6 +26,9 @@
*/
package org.apache.http.impl.cookie;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
import org.apache.http.annotation.Immutable;
import org.apache.http.conn.util.PublicSuffixList;
import org.apache.http.conn.util.PublicSuffixMatcher;
@@ -52,11 +55,23 @@ public class PublicSuffixDomainFilter implements CommonCookieAttributeHandler {
private final CommonCookieAttributeHandler handler;
private final PublicSuffixMatcher publicSuffixMatcher;
+ private final Map localDomainMap;
+
+ private static Map createLocalDomainMap() {
+ final ConcurrentHashMap map = new ConcurrentHashMap();
+ map.put(".localhost.", Boolean.TRUE); // RFC 6761
+ map.put(".test.", Boolean.TRUE); // RFC 6761
+ map.put(".local.", Boolean.TRUE); // RFC 6762
+ map.put(".local", Boolean.TRUE);
+ map.put(".localdomain", Boolean.TRUE);
+ return map;
+ }
public PublicSuffixDomainFilter(
final CommonCookieAttributeHandler handler, final PublicSuffixMatcher publicSuffixMatcher) {
this.handler = Args.notNull(handler, "Cookie handler");
this.publicSuffixMatcher = Args.notNull(publicSuffixMatcher, "Public suffix matcher");
+ this.localDomainMap = createLocalDomainMap();
}
public PublicSuffixDomainFilter(
@@ -65,6 +80,7 @@ public PublicSuffixDomainFilter(
Args.notNull(suffixList, "Public suffix list");
this.handler = handler;
this.publicSuffixMatcher = new PublicSuffixMatcher(suffixList.getRules(), suffixList.getExceptions());
+ this.localDomainMap = createLocalDomainMap();
}
/**
@@ -72,12 +88,17 @@ public PublicSuffixDomainFilter(
*/
@Override
public boolean match(final Cookie cookie, final CookieOrigin origin) {
- final String domain = cookie.getDomain();
- if (!domain.equalsIgnoreCase("localhost") && publicSuffixMatcher.matches(domain)) {
- return false;
- } else {
- return handler.match(cookie, origin);
+ final String host = cookie.getDomain();
+ final int i = host.indexOf('.');
+ if (i >= 0) {
+ final String domain = host.substring(i);
+ if (!this.localDomainMap.containsKey(domain)) {
+ if (this.publicSuffixMatcher.matches(host)) {
+ return false;
+ }
+ }
}
+ return handler.match(cookie, origin);
}
@Override
diff --git a/httpclient/src/test/java/org/apache/http/impl/cookie/TestPublicSuffixListParser.java b/httpclient/src/test/java/org/apache/http/impl/cookie/TestPublicSuffixListParser.java
index 86dded9288..50816ba2e1 100644
--- a/httpclient/src/test/java/org/apache/http/impl/cookie/TestPublicSuffixListParser.java
+++ b/httpclient/src/test/java/org/apache/http/impl/cookie/TestPublicSuffixListParser.java
@@ -78,6 +78,32 @@ public void testParse() throws Exception {
Assert.assertTrue(filter.match(cookie, new CookieOrigin("apache.metro.tokyo.jp", 80, "/stuff", false)));
}
+ @Test
+ public void testParseLocal() throws Exception {
+ final BasicClientCookie cookie = new BasicClientCookie("name", "value");
+
+ cookie.setDomain("localhost");
+ Assert.assertTrue(filter.match(cookie, new CookieOrigin("localhost", 80, "/stuff", false)));
+
+ cookie.setDomain("somehost");
+ Assert.assertTrue(filter.match(cookie, new CookieOrigin("somehost", 80, "/stuff", false)));
+
+ cookie.setDomain(".localdomain");
+ Assert.assertTrue(filter.match(cookie, new CookieOrigin("somehost.localdomain", 80, "/stuff", false)));
+
+ cookie.setDomain(".local.");
+ Assert.assertTrue(filter.match(cookie, new CookieOrigin("somehost.local.", 80, "/stuff", false)));
+
+ cookie.setDomain(".localhost.");
+ Assert.assertTrue(filter.match(cookie, new CookieOrigin("somehost.localhost.", 80, "/stuff", false)));
+
+ cookie.setDomain(".local");
+ Assert.assertTrue(filter.match(cookie, new CookieOrigin("somehost.local", 80, "/stuff", false)));
+
+ cookie.setDomain(".blah");
+ Assert.assertFalse(filter.match(cookie, new CookieOrigin("somehost.blah", 80, "/stuff", false)));
+ }
+
@Test
public void testUnicode() throws Exception {
final BasicClientCookie cookie = new BasicClientCookie("name", "value");
From 2f062b3b43120c130064985cf7f5d34410574c10 Mon Sep 17 00:00:00 2001
From: Oleg Kalnichevski
Date: Sat, 3 Oct 2015 13:46:01 +0000
Subject: [PATCH 033/204] HTTPCLIENT-1685: PublicSuffixDomainFilter to ignore
local hosts and local domains (follow-up)
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1706582 13f79535-47bb-0310-9956-ffa450edef68
---
.../apache/http/impl/cookie/PublicSuffixDomainFilter.java | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/httpclient/src/main/java/org/apache/http/impl/cookie/PublicSuffixDomainFilter.java b/httpclient/src/main/java/org/apache/http/impl/cookie/PublicSuffixDomainFilter.java
index 2cafcf11ce..062f8ec6af 100644
--- a/httpclient/src/main/java/org/apache/http/impl/cookie/PublicSuffixDomainFilter.java
+++ b/httpclient/src/main/java/org/apache/http/impl/cookie/PublicSuffixDomainFilter.java
@@ -97,6 +97,12 @@ public boolean match(final Cookie cookie, final CookieOrigin origin) {
return false;
}
}
+ } else {
+ if (!host.equalsIgnoreCase(origin.getHost())) {
+ if (this.publicSuffixMatcher.matches(host)) {
+ return false;
+ }
+ }
}
return handler.match(cookie, origin);
}
From 8e6ab0bdb8569ff1328fb7e7eeec10f3c21e2450 Mon Sep 17 00:00:00 2001
From: Oleg Kalnichevski
Date: Tue, 20 Oct 2015 07:42:34 +0000
Subject: [PATCH 034/204] HTTPCLIENT-1665: MultipartEntity to use US-ASCII
charset by default (regression)
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1709523 13f79535-47bb-0310-9956-ffa450edef68
---
.../org/apache/http/entity/mime/MultipartEntity.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/httpmime/src/main/java-deprecated/org/apache/http/entity/mime/MultipartEntity.java b/httpmime/src/main/java-deprecated/org/apache/http/entity/mime/MultipartEntity.java
index 0a09ee78f1..07c43b6f28 100644
--- a/httpmime/src/main/java-deprecated/org/apache/http/entity/mime/MultipartEntity.java
+++ b/httpmime/src/main/java-deprecated/org/apache/http/entity/mime/MultipartEntity.java
@@ -70,7 +70,7 @@ public MultipartEntity(
super();
this.builder = new MultipartEntityBuilder()
.setMode(mode)
- .setCharset(charset)
+ .setCharset(charset != null ? charset : MIME.DEFAULT_CHARSET)
.setBoundary(boundary);
this.entity = null;
}
From 09cefc2b8970eea56d81b1a886d9bb769a48daf3 Mon Sep 17 00:00:00 2001
From: Oleg Kalnichevski
Date: Wed, 21 Oct 2015 12:34:14 +0000
Subject: [PATCH 035/204] MultipartFormEntity#getContent implementation
Contributed by Slikey
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1709814 13f79535-47bb-0310-9956-ffa450edef68
---
.../http/entity/mime/MultipartFormEntity.java | 22 ++++++++++++++-----
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/httpmime/src/main/java/org/apache/http/entity/mime/MultipartFormEntity.java b/httpmime/src/main/java/org/apache/http/entity/mime/MultipartFormEntity.java
index 467ca8e088..cabb824ae8 100644
--- a/httpmime/src/main/java/org/apache/http/entity/mime/MultipartFormEntity.java
+++ b/httpmime/src/main/java/org/apache/http/entity/mime/MultipartFormEntity.java
@@ -27,16 +27,19 @@
package org.apache.http.entity.mime;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.apache.http.ContentTooLongException;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.entity.ContentType;
import org.apache.http.message.BasicHeader;
import org.apache.http.protocol.HTTP;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
@SuppressWarnings("deprecation")
class MultipartFormEntity implements HttpEntity {
@@ -94,8 +97,15 @@ public void consumeContent() {
@Override
public InputStream getContent() throws IOException {
- throw new UnsupportedOperationException(
- "Multipart form entity does not implement #getContent()");
+ if (this.contentLength < 0) {
+ throw new ContentTooLongException("Content length is unknown");
+ } else if (this.contentLength > 25 * 1024) {
+ throw new ContentTooLongException("Content length is too long: " + this.contentLength);
+ }
+ final ByteArrayOutputStream outstream = new ByteArrayOutputStream();
+ writeTo(outstream);
+ outstream.flush();
+ return new ByteArrayInputStream(outstream.toByteArray());
}
@Override
From 549c26f9580316c9f8a6a35ad4451a95a5e480d0 Mon Sep 17 00:00:00 2001
From: Oleg Kalnichevski
Date: Mon, 9 Nov 2015 13:18:30 +0000
Subject: [PATCH 036/204] HTTPCLIENT-1216: removed ThreadLocal subclass from
DateUtils Contributed by Jochen Kemnade
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1713429 13f79535-47bb-0310-9956-ffa450edef68
---
.../java/org/apache/http/client/utils/DateUtils.java | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/httpclient/src/main/java/org/apache/http/client/utils/DateUtils.java b/httpclient/src/main/java/org/apache/http/client/utils/DateUtils.java
index 326230ab94..a18fbd7244 100644
--- a/httpclient/src/main/java/org/apache/http/client/utils/DateUtils.java
+++ b/httpclient/src/main/java/org/apache/http/client/utils/DateUtils.java
@@ -200,15 +200,7 @@ private DateUtils() {
final static class DateFormatHolder {
private static final ThreadLocal>>
- THREADLOCAL_FORMATS = new ThreadLocal>>() {
-
- @Override
- protected SoftReference