You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2019/09/09 11:44:51 UTC

[tomcat] branch master updated (1a7944f -> 965792e)

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

markt pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git.


    from 1a7944f  Polish. Spacing.
     new 0266539  Simplify
     new 965792e  Simplify

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:
 java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[tomcat] 02/02: Simplify

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

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 965792e2bf9126165f7a402c105e7fd669bd60f6
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Sep 9 11:40:09 2019 +0100

    Simplify
    
    In calculateChunkHeader() start pos at 8 rather than 7 and then
    decrement before it is used rather than after. This results in the same
    number of decrement calls and the same values used in chunkHeader.put()
    but the returned value is 1 higher than previously, removing the need
    for the +1 in the caller.
---
 java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java b/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java
index b382683..6eedd81 100644
--- a/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java
+++ b/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java
@@ -106,7 +106,7 @@ public class ChunkedOutputFilter implements OutputFilter {
 
         int pos = calculateChunkHeader(result);
 
-        chunkHeader.position(pos + 1).limit(10);
+        chunkHeader.position(pos).limit(10);
         buffer.doWrite(chunkHeader);
 
         buffer.doWrite(chunk);
@@ -120,12 +120,12 @@ public class ChunkedOutputFilter implements OutputFilter {
 
     private int calculateChunkHeader(int len) {
         // Calculate chunk header
-        int pos = 7;
+        int pos = 8;
         int current = len;
         while (current > 0) {
             int digit = current % 16;
             current = current / 16;
-            chunkHeader.put(pos--, HexUtils.getHex(digit));
+            chunkHeader.put(--pos, HexUtils.getHex(digit));
         }
         return pos;
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[tomcat] 01/02: Simplify

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

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 0266539eac4cc598971f3488b38fb0fa52bd2a46
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Sep 9 11:35:52 2019 +0100

    Simplify
    
    position is set to:
    pos + 1
    
    Then limit is set to
    position + 9 - pos = pos + 1 + 9 - pos
                       = 1 + 9
                       = 10
---
 java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java b/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java
index 65bcf39..b382683 100644
--- a/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java
+++ b/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java
@@ -106,7 +106,7 @@ public class ChunkedOutputFilter implements OutputFilter {
 
         int pos = calculateChunkHeader(result);
 
-        chunkHeader.position(pos + 1).limit(chunkHeader.position() + 9 - pos);
+        chunkHeader.position(pos + 1).limit(10);
         buffer.doWrite(chunkHeader);
 
         buffer.doWrite(chunk);


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org