On 13/06/2014 16:23, Konstantin Kolinko wrote:
> 2014-06-13 15:37 GMT+04:00  <ma...@apache.org>:
>> Author: markt
>> Date: Fri Jun 13 11:37:24 2014
>> New Revision: 1602386
>>
>> URL: http://svn.apache.org/r1602386
>> Log:
>> Tiny bit of de-duplication.
>> Add reference to RFC2616 for case insensitivity of transfer encoding
>> names.
>>
>> Modified:
>>     tomcat/tc7.0.x/trunk/   (props changed)
>>     
>> tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
>>
>> Propchange: tomcat/tc7.0.x/trunk/
>> ------------------------------------------------------------------------------
>>   Merged /tomcat/trunk:r1599739
>>
>> Modified: 
>> tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
>> URL: 
>> http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java?rev=1602386&r1=1602385&r2=1602386&view=diff
>> ==============================================================================
>> --- 
>> tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
>>  (original)
>> +++ 
>> tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
>>  Fri Jun 13 11:37:24 2014
>> @@ -713,8 +713,12 @@ public abstract class AbstractHttp11Proc
>>       * Add an input filter to the current request. If the encoding is not
>>       * supported, a 501 response will be returned to the client.
>>       */
>> -    protected void addInputFilter(InputFilter[] inputFilters,
>> -                                     String encodingName) {
>> +    private void addInputFilter(InputFilter[] inputFilters, String 
>> encodingName) {
>> +
>> +        // Trim provided encoding name and convert to lower case since 
>> transfer
>> +        // encoding names are case insensitive. (RFC2616, section 3.6)
>> +        encodingName = encodingName.trim().toLowerCase(Locale.ENGLISH);
>> +
>>          if (encodingName.equals("identity")) {
>>              // Skip
>>          } else if (encodingName.equals("chunked")) {
>> @@ -1314,14 +1318,12 @@ public abstract class AbstractHttp11Proc
>>              int commaPos = transferEncodingValue.indexOf(',');
>>              String encodingName = null;
>>              while (commaPos != -1) {
>> -                encodingName = transferEncodingValue.substring(
>> -                        startPos, 
>> commaPos).toLowerCase(Locale.ENGLISH).trim();
>> +                encodingName = transferEncodingValue.substring(startPos, 
>> commaPos);
> 
> The new code needs "trim()" in the above line.
> 
> Conversion to lowercase can be done once, but trimming must be done
> for each encodingName in the loop there.

Why? The possibly mixed-case, possibly non-trimmed value is passed to
addInputFilter() where it is trimmed and converted to lower case. What
am I missing?

Mark


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

Reply via email to