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/12/19 11:08:19 UTC

[httpcomponents-core] branch master updated (c4a2881 -> fb864e2)

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git.


    omit c4a2881  HTTPCORE-705: ConnectionReuseStrategy to use protocol version of the response message by default and that of the execution context as a fallback
     new fb864e2  HTTPCORE-705: ConnectionReuseStrategy to use protocol version of the response message by default and that of the execution context as a fallback

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (c4a2881)
            \
             N -- N -- N   refs/heads/master (fb864e2)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 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:
 .../apache/hc/core5/http/impl/TestDefaultConnectionReuseStrategy.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

[httpcomponents-core] 01/01: HTTPCORE-705: ConnectionReuseStrategy to use protocol version of the response message by default and that of the execution context as a fallback

Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git

commit fb864e2ad20ca495b33baf5b7f98ce7bc7f58a0b
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Fri Dec 17 12:24:06 2021 +0100

    HTTPCORE-705: ConnectionReuseStrategy to use protocol version of the response message by default and that of the execution context as a fallback
---
 .../hc/core5/http/impl/DefaultConnectionReuseStrategy.java     |  2 +-
 .../hc/core5/http/impl/TestDefaultConnectionReuseStrategy.java | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/DefaultConnectionReuseStrategy.java b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/DefaultConnectionReuseStrategy.java
index 0231bcb..10ca317 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/http/impl/DefaultConnectionReuseStrategy.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/http/impl/DefaultConnectionReuseStrategy.java
@@ -133,7 +133,7 @@ public class DefaultConnectionReuseStrategy implements ConnectionReuseStrategy {
             headerIterator = response.headerIterator("Proxy-Connection");
         }
 
-        final ProtocolVersion ver = context.getProtocolVersion();
+        final ProtocolVersion ver = response.getVersion() != null ? response.getVersion() : context.getProtocolVersion();
         if (headerIterator.hasNext()) {
             if (ver.greaterEquals(HttpVersion.HTTP_1_1)) {
                 final Iterator<String> it = new BasicTokenIterator(headerIterator);
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/TestDefaultConnectionReuseStrategy.java b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/TestDefaultConnectionReuseStrategy.java
index fd5f375..d8af1a2 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/TestDefaultConnectionReuseStrategy.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/TestDefaultConnectionReuseStrategy.java
@@ -101,8 +101,8 @@ public class TestDefaultConnectionReuseStrategy {
     @Test
     public void testExplicitKeepAlive() throws Exception {
         // Use HTTP 1.0
-        context.setProtocolVersion(HttpVersion.HTTP_1_0);
         final HttpResponse response = new BasicHttpResponse(200, "OK");
+        response.setVersion(HttpVersion.HTTP_1_0);
         response.addHeader("Content-Length", "10");
         response.addHeader("Connection", "keep-alive");
 
@@ -111,8 +111,8 @@ public class TestDefaultConnectionReuseStrategy {
 
     @Test
     public void testHTTP10Default() throws Exception {
-        context.setProtocolVersion(HttpVersion.HTTP_1_0);
         final HttpResponse response = new BasicHttpResponse(200, "OK");
+        response.setVersion(HttpVersion.HTTP_1_0);
         response.addHeader("Content-Length", "10");
         Assertions.assertFalse(reuseStrategy.keepAlive(null, response, context));
     }
@@ -127,8 +127,8 @@ public class TestDefaultConnectionReuseStrategy {
     @Test
     public void testBrokenConnectionDirective1() throws Exception {
         // Use HTTP 1.0
-        context.setProtocolVersion(HttpVersion.HTTP_1_0);
         final HttpResponse response = new BasicHttpResponse(200, "OK");
+        response.setVersion(HttpVersion.HTTP_1_0);
         response.addHeader("Content-Length", "10");
         response.addHeader("Connection", "keep--alive");
         Assertions.assertFalse(reuseStrategy.keepAlive(null, response, context));
@@ -137,8 +137,8 @@ public class TestDefaultConnectionReuseStrategy {
     @Test
     public void testBrokenConnectionDirective2() throws Exception {
         // Use HTTP 1.0
-        context.setProtocolVersion(HttpVersion.HTTP_1_0);
         final HttpResponse response = new BasicHttpResponse(200, "OK");
+        response.setVersion(HttpVersion.HTTP_1_0);
         response.addHeader("Content-Length", "10");
         response.addHeader("Connection", null);
         Assertions.assertFalse(reuseStrategy.keepAlive(null, response, context));
@@ -226,8 +226,8 @@ public class TestDefaultConnectionReuseStrategy {
     @Test
     public void testNoContentResponseHttp10() throws Exception {
         // Use HTTP 1.0
-        context.setProtocolVersion(HttpVersion.HTTP_1_0);
         final HttpResponse response = new BasicHttpResponse(HttpStatus.SC_NO_CONTENT, "No Content");
+        response.setVersion(HttpVersion.HTTP_1_0);
         Assertions.assertFalse(reuseStrategy.keepAlive(null, response, context));
     }