View | Details | Raw Unified | Return to bug 60594
Collapse All | Expand All

(-)conf/catalina.properties (+3 lines)
Lines 131-133 Link Here
131
#tomcat.util.buf.StringCache.char.enabled=true
131
#tomcat.util.buf.StringCache.char.enabled=true
132
#tomcat.util.buf.StringCache.trainThreshold=500000
132
#tomcat.util.buf.StringCache.trainThreshold=500000
133
#tomcat.util.buf.StringCache.cacheSize=5000
133
#tomcat.util.buf.StringCache.cacheSize=5000
134
135
# Allow for changes to HTTP request validation
136
tomcat.util.http.parser.HttpParser.blacklist=" \"#<>\\^`{|}"
(-)java/org/apache/tomcat/util/http/parser/HttpParser.java (-3 / +9 lines)
Lines 61-66 Link Here
61
    private static final boolean[] IS_HEX = new boolean[ARRAY_SIZE];
61
    private static final boolean[] IS_HEX = new boolean[ARRAY_SIZE];
62
    private static final boolean[] IS_NOT_REQUEST_TARGET = new boolean[ARRAY_SIZE];
62
    private static final boolean[] IS_NOT_REQUEST_TARGET = new boolean[ARRAY_SIZE];
63
    private static final boolean[] IS_HTTP_PROTOCOL = new boolean[ARRAY_SIZE];
63
    private static final boolean[] IS_HTTP_PROTOCOL = new boolean[ARRAY_SIZE];
64
    private static final boolean[] IS_IN_BLACKLIST = new boolean[ARRAY_SIZE];
64
65
65
    static {
66
    static {
66
        // Digest field types.
67
        // Digest field types.
Lines 82-87 Link Here
82
        // RFC2617 says nc is 8LHEX. <">8LHEX<"> will also be accepted
83
        // RFC2617 says nc is 8LHEX. <">8LHEX<"> will also be accepted
83
        fieldTypes.put("nc", FIELD_TYPE_LHEX);
84
        fieldTypes.put("nc", FIELD_TYPE_LHEX);
84
85
86
        String prop = System.getProperty("tomcat.util.http.parser.HttpParser.blacklist");
87
        if (prop != null) {
88
            for (int i = 0; i < prop.length(); i++) {
89
                IS_IN_BLACKLIST[prop.charAt(i)] = true;
90
            }
91
        }
92
85
        for (int i = 0; i < ARRAY_SIZE; i++) {
93
        for (int i = 0; i < ARRAY_SIZE; i++) {
86
            // Control> 0-31, 127
94
            // Control> 0-31, 127
87
            if (i < 32 || i == 127) {
95
            if (i < 32 || i == 127) {
Lines 109-117 Link Here
109
            // Not valid for request target.
117
            // Not valid for request target.
110
            // Combination of multiple rules from RFC7230 and RFC 3986. Must be
118
            // Combination of multiple rules from RFC7230 and RFC 3986. Must be
111
            // ASCII, no controls plus a few additional characters excluded
119
            // ASCII, no controls plus a few additional characters excluded
112
            if (IS_CONTROL[i] || i > 127 ||
120
            if (IS_CONTROL[i] || i > 127 || IS_IN_BLACKLIST[i]) {
113
                    i == ' ' || i == '\"' || i == '#' || i == '<' || i == '>' || i == '\\' ||
114
                    i == '^' || i == '`'  || i == '{' || i == '|' || i == '}') {
115
                IS_NOT_REQUEST_TARGET[i] = true;
121
                IS_NOT_REQUEST_TARGET[i] = true;
116
            }
122
            }
117
123

Return to bug 60594