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/10/17 17:49:59 UTC

[tomcat] 04/05: Simplify on the grounds all tokens of interest are case-insensitive

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

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

commit 6d5396843e252418603ae2c97b5b501bf8f5da55
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Oct 17 17:39:35 2019 +0100

    Simplify on the grounds all tokens of interest are case-insensitive
---
 .../apache/tomcat/util/http/parser/TokenList.java  | 31 ++--------------------
 1 file changed, 2 insertions(+), 29 deletions(-)

diff --git a/java/org/apache/tomcat/util/http/parser/TokenList.java b/java/org/apache/tomcat/util/http/parser/TokenList.java
index 7160623..3837b51 100644
--- a/java/org/apache/tomcat/util/http/parser/TokenList.java
+++ b/java/org/apache/tomcat/util/http/parser/TokenList.java
@@ -41,25 +41,6 @@ public class TokenList {
      * @throws IOException If an I/O error occurs reading the header
      */
     public static void parseTokenList(Reader input, Collection<String> result) throws IOException {
-        parseTokenList(input, true, result);
-    }
-
-
-    /**
-     * Parses a header of the form 1#token.
-     *
-     * @param input          The header to parse
-     * @param forceLowerCase Should parsed tokens be forced to lower case? This
-     *                           is intended for headers where the values are
-     *                           case-insensitive
-     * @param result         The Collection (usually a list of a set) to which
-     *                           the parsed token should be added
-     *
-     * @throws IOException If an I/O error occurs reading the header
-     */
-    public static void parseTokenList(Reader input, boolean forceLowerCase, Collection<String> result)
-            throws IOException {
-
         do {
             String fieldName = HttpParser.readToken(input);
             if (fieldName == null) {
@@ -76,18 +57,10 @@ public class TokenList {
             SkipResult skipResult = HttpParser.skipConstant(input, ",");
             if (skipResult == SkipResult.EOF) {
                 // EOF
-                if (forceLowerCase) {
-                    result.add(fieldName.toLowerCase(Locale.ENGLISH));
-                } else {
-                    result.add(fieldName);
-                }
+                result.add(fieldName.toLowerCase(Locale.ENGLISH));
                 break;
             } else if (skipResult == SkipResult.FOUND) {
-                if (forceLowerCase) {
-                    result.add(fieldName.toLowerCase(Locale.ENGLISH));
-                } else {
-                    result.add(fieldName);
-                }
+                result.add(fieldName.toLowerCase(Locale.ENGLISH));
                 continue;
             } else {
                 // Not a token - ignore it


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