You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2021/08/31 13:39:19 UTC
[httpcomponents-client] branch 5.1.x updated (ec096ea -> 75a694c)
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a change to branch 5.1.x
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git.
from ec096ea Don't retry a request for NoRouteToHostException
new 98768bd HTTPCLIENT-2173: async pooling connection manager to close half-open connection gracefully
new 75a694c HTTPCLIENT-2173: test case for identity transfer encoded response messages
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../async/AbstractHttpAsyncFundamentalsTest.java | 6 ++--
.../hc/client5/testing/async/TestHttp1Async.java | 33 +++++++++++++++++++++-
.../nio/PoolingAsyncClientConnectionManager.java | 2 +-
3 files changed, 36 insertions(+), 5 deletions(-)
[httpcomponents-client] 02/02: HTTPCLIENT-2173: test case for
identity transfer encoded response messages
Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a commit to branch 5.1.x
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git
commit 75a694cdd51b85b2d50bda2efc8416cb2e432d15
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Tue Aug 31 15:38:51 2021 +0200
HTTPCLIENT-2173: test case for identity transfer encoded response messages
---
.../async/AbstractHttpAsyncFundamentalsTest.java | 6 ++--
.../hc/client5/testing/async/TestHttp1Async.java | 33 +++++++++++++++++++++-
2 files changed, 35 insertions(+), 4 deletions(-)
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncFundamentalsTest.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncFundamentalsTest.java
index a7e8cd6..ca7b494 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncFundamentalsTest.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/AbstractHttpAsyncFundamentalsTest.java
@@ -62,7 +62,7 @@ public abstract class AbstractHttpAsyncFundamentalsTest<T extends CloseableHttpA
}
@Test
- public void testSequenctialGetRequests() throws Exception {
+ public void testSequentialGetRequests() throws Exception {
final HttpHost target = start();
for (int i = 0; i < 3; i++) {
final Future<SimpleHttpResponse> future = httpclient.execute(
@@ -80,7 +80,7 @@ public abstract class AbstractHttpAsyncFundamentalsTest<T extends CloseableHttpA
}
@Test
- public void testSequenctialHeadRequests() throws Exception {
+ public void testSequentialHeadRequests() throws Exception {
final HttpHost target = start();
for (int i = 0; i < 3; i++) {
final Future<SimpleHttpResponse> future = httpclient.execute(
@@ -97,7 +97,7 @@ public abstract class AbstractHttpAsyncFundamentalsTest<T extends CloseableHttpA
}
@Test
- public void testSequenctialPostRequests() throws Exception {
+ public void testSequentialPostRequests() throws Exception {
final HttpHost target = start();
for (int i = 0; i < 3; i++) {
final byte[] b1 = new byte[1024];
diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1Async.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1Async.java
index 944e284..391b54e 100644
--- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1Async.java
+++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/async/TestHttp1Async.java
@@ -28,6 +28,8 @@ package org.apache.hc.client5.testing.async;
import java.util.Arrays;
import java.util.Collection;
+import java.util.LinkedList;
+import java.util.Queue;
import java.util.Random;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
@@ -50,6 +52,8 @@ import org.apache.hc.core5.http.HttpHeaders;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.URIScheme;
import org.apache.hc.core5.http.config.Http1Config;
+import org.apache.hc.core5.http.protocol.DefaultHttpProcessor;
+import org.apache.hc.core5.http.protocol.RequestValidateHost;
import org.hamcrest.CoreMatchers;
import org.junit.Assert;
import org.junit.Rule;
@@ -122,7 +126,7 @@ public class TestHttp1Async extends AbstractHttpAsyncFundamentalsTest<CloseableH
}
@Test
- public void testSequenctialGetRequestsCloseConnection() throws Exception {
+ public void testSequentialGetRequestsCloseConnection() throws Exception {
final HttpHost target = start();
for (int i = 0; i < 3; i++) {
final Future<SimpleHttpResponse> future = httpclient.execute(
@@ -141,6 +145,33 @@ public class TestHttp1Async extends AbstractHttpAsyncFundamentalsTest<CloseableH
}
@Test
+ public void testGetRequestsIdentityEncodingResponse() throws Exception {
+ final HttpHost target = start(new DefaultHttpProcessor(new RequestValidateHost()), Http1Config.DEFAULT);
+
+ final int reqCount = 20;
+
+ final Queue<Future<SimpleHttpResponse>> queue = new LinkedList<>();
+ for (int i = 0; i < reqCount; i++) {
+ final Future<SimpleHttpResponse> future = httpclient.execute(
+ SimpleRequestBuilder.get()
+ .setHttpHost(target)
+ .setPath("/random/2048")
+ .addHeader(HttpHeaders.CONNECTION, HeaderElements.CLOSE)
+ .build(), null);
+ queue.add(future);
+ }
+ while (!queue.isEmpty()) {
+ final Future<SimpleHttpResponse> future = queue.remove();
+ final SimpleHttpResponse response = future.get();
+ Assert.assertThat(response, CoreMatchers.notNullValue());
+ Assert.assertThat(response.getCode(), CoreMatchers.equalTo(200));
+ final String body = response.getBodyText();
+ Assert.assertThat(body, CoreMatchers.notNullValue());
+ Assert.assertThat(body.length(), CoreMatchers.equalTo(2048));
+ }
+ }
+
+ @Test
public void testConcurrentPostsOverMultipleConnections() throws Exception {
connManager.setDefaultMaxPerRoute(20);
connManager.setMaxTotal(100);
[httpcomponents-client] 01/02: HTTPCLIENT-2173: async pooling
connection manager to close half-open connection gracefully
Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
olegk pushed a commit to branch 5.1.x
in repository https://gitbox.apache.org/repos/asf/httpcomponents-client.git
commit 98768bd0995fe6c902c37cf005b562d60eaa68b0
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Tue Aug 31 15:38:05 2021 +0200
HTTPCLIENT-2173: async pooling connection manager to close half-open connection gracefully
---
.../hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java
index 9d1250e..b7c609f 100644
--- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java
+++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/nio/PoolingAsyncClientConnectionManager.java
@@ -576,7 +576,7 @@ public class PoolingAsyncClientConnectionManager implements AsyncClientConnectio
return false;
}
if (!connection.isOpen()) {
- poolEntry.discardConnection(CloseMode.IMMEDIATE);
+ poolEntry.discardConnection(CloseMode.GRACEFUL);
return false;
}
return true;