hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject httpcomponents-core git commit: HTTPCORE-472: Fixed problem with blocking message parsers incorrectly throwing "Maximum line length limit exceeded" exception in some corner cases [Forced Update!]
Date Thu, 15 Jun 2017 11:33:52 GMT
Repository: httpcomponents-core
Updated Branches:
  refs/heads/4.4.x 721b50f56 -> 0877c2882 (forced update)


HTTPCORE-472: Fixed problem with blocking message parsers incorrectly throwing "Maximum line
length limit exceeded" exception in some corner cases


Project: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/commit/0877c288
Tree: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/tree/0877c288
Diff: http://git-wip-us.apache.org/repos/asf/httpcomponents-core/diff/0877c288

Branch: refs/heads/4.4.x
Commit: 0877c288253c1e431eb2b59107d8a037d07a6d80
Parents: c09d08b
Author: Oleg Kalnichevski <olegk@apache.org>
Authored: Thu Jun 15 13:30:24 2017 +0200
Committer: Oleg Kalnichevski <olegk@apache.org>
Committed: Thu Jun 15 13:33:20 2017 +0200

----------------------------------------------------------------------
 .../org/apache/http/impl/io/SessionInputBufferImpl.java     | 2 +-
 .../org/apache/http/impl/io/TestSessionInOutBuffers.java    | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/0877c288/httpcore/src/main/java/org/apache/http/impl/io/SessionInputBufferImpl.java
----------------------------------------------------------------------
diff --git a/httpcore/src/main/java/org/apache/http/impl/io/SessionInputBufferImpl.java b/httpcore/src/main/java/org/apache/http/impl/io/SessionInputBufferImpl.java
index 33d20f1..ff0d21a 100644
--- a/httpcore/src/main/java/org/apache/http/impl/io/SessionInputBufferImpl.java
+++ b/httpcore/src/main/java/org/apache/http/impl/io/SessionInputBufferImpl.java
@@ -256,7 +256,7 @@ public class SessionInputBufferImpl implements SessionInputBuffer, BufferInfo
{
 
             if (maxLineLen > 0) {
                 final int currentLen = this.linebuffer.length()
-                        + (pos > 0 ? pos : this.bufferlen) - this.bufferpos;
+                        + (pos >= 0 ? pos : this.bufferlen) - this.bufferpos;
                 if (currentLen >= maxLineLen) {
                     throw new MessageConstraintException("Maximum line length limit exceeded");
                 }

http://git-wip-us.apache.org/repos/asf/httpcomponents-core/blob/0877c288/httpcore/src/test/java/org/apache/http/impl/io/TestSessionInOutBuffers.java
----------------------------------------------------------------------
diff --git a/httpcore/src/test/java/org/apache/http/impl/io/TestSessionInOutBuffers.java b/httpcore/src/test/java/org/apache/http/impl/io/TestSessionInOutBuffers.java
index b74094c..139aa2d 100644
--- a/httpcore/src/test/java/org/apache/http/impl/io/TestSessionInOutBuffers.java
+++ b/httpcore/src/test/java/org/apache/http/impl/io/TestSessionInOutBuffers.java
@@ -398,6 +398,15 @@ public class TestSessionInOutBuffers {
         }
     }
 
+    @Test //HTTPCORE-472
+    public void testLineLimit3() throws Exception {
+        final String s = "012345678\r\nblaaaaaaaaaaaaaaaaaah";
+        final byte[] tmp = s.getBytes(Consts.ASCII);
+        final SessionInputBufferMock inbuffer1 = new SessionInputBufferMock(tmp, 10,
+                MessageConstraints.lineLen(20));
+        Assert.assertEquals("012345678", inbuffer1.readLine());
+    }
+
     @Test
     public void testReadLineFringeCase1() throws Exception {
         final String s = "abc\r\n";


Mime
View raw message