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 2019/09/25 14:24:08 UTC

[httpcomponents-core] branch HTTPCLIENT-2016 created (now 7a617f4)

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

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


      at 7a617f4  HTTPCLIENT-2016, regression: Tab chars are replaced by question marks in header values

This branch includes the following new commits:

     new 7a617f4  HTTPCLIENT-2016, regression: Tab chars are replaced by question marks in header values

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.



[httpcomponents-core] 01/01: HTTPCLIENT-2016, regression: Tab chars are replaced by question marks in header values

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

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

commit 7a617f4379c77359300478cff35d869a387227db
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Wed Sep 25 16:22:59 2019 +0200

    HTTPCLIENT-2016, regression: Tab chars are replaced by question marks in header values
---
 httpcore/src/main/java/org/apache/http/util/ByteArrayBuffer.java  | 8 +++++---
 .../src/test/java/org/apache/http/util/TestByteArrayBuffer.java   | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/httpcore/src/main/java/org/apache/http/util/ByteArrayBuffer.java b/httpcore/src/main/java/org/apache/http/util/ByteArrayBuffer.java
index 1cc3efd..7f92b77 100644
--- a/httpcore/src/main/java/org/apache/http/util/ByteArrayBuffer.java
+++ b/httpcore/src/main/java/org/apache/http/util/ByteArrayBuffer.java
@@ -137,9 +137,11 @@ public final class ByteArrayBuffer implements Serializable {
         }
 
         for (int i1 = off, i2 = oldlen; i2 < newlen; i1++, i2++) {
-            if ((b[i1] >= 0x20 && b[i1] <= 0x7E) || // Visible ASCII
-                (b[i1] >= 0xA0 && b[i1] <= 0xFF)) { // Visible ISO-8859-1
-                this.buffer[i2] = (byte) b[i1];
+            final int c = b[i1];
+            if ((c >= 0x20 && c <= 0x7E) || // Visible ASCII
+                (c >= 0xA0 && c <= 0xFF) || // Visible ISO-8859-1
+                c == 0x09) {                // TAB
+                this.buffer[i2] = (byte) c;
             } else {
                 this.buffer[i2] = '?';
             }
diff --git a/httpcore/src/test/java/org/apache/http/util/TestByteArrayBuffer.java b/httpcore/src/test/java/org/apache/http/util/TestByteArrayBuffer.java
index 9464353..835181f 100644
--- a/httpcore/src/test/java/org/apache/http/util/TestByteArrayBuffer.java
+++ b/httpcore/src/test/java/org/apache/http/util/TestByteArrayBuffer.java
@@ -322,7 +322,7 @@ public class TestByteArrayBuffer {
         final byte[] bytes = asByteArray(chars);
 
         Assert.assertEquals(
-            "????????????????????????????????"
+            "?????????\t??????????????????????"
                 + " !\"#$%&'()*+,-./0123456789:;<=>?"
                 + "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
                 + "`abcdefghijklmnopqrstuvwxyz"