2014-06-03 22:37 GMT+04:00  <ma...@apache.org>:
> Author: markt
> Date: Tue Jun  3 18:37:33 2014
> New Revision: 1599739
>
> URL: http://svn.apache.org/r1599739
> Log:
> Tiny bit of de-duplication.
> Add reference to RFC2616 for case insensitivity of transfer encoding
> names.
>
> Modified:
>     tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
>
> Modified: 
> tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java
> URL: 
> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java?rev=1599739&r1=1599738&r2=1599739&view=diff
> ==============================================================================
> --- tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java 
> (original)
> +++ tomcat/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java 
> Tue Jun  3 18:37:33 2014
> @@ -677,8 +677,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.
>       */
> -    private 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")) {


Good.

Possible idea for an additional improvement:
a few lines below in this method there is

> for (int i = pluggableFilterIndex; i < inputFilters.length; i++) {
> if (inputFilters[i].getEncodingName().toString().equals(encodingName)) {
>    getInputBuffer().addActiveFilter(inputFilters[i]);
>    return;
> }
> }

There is no need for getEncodingName() to return a ByteChunk. It can
return a String instead.  The above is the only place where it is
used.
I think the byte chunk was used there for sake of calling its
ByteChunk.equalsIgnoreCase(String) method.

Such a change means changing InputFilter interface.

Best regards,
Konstantin Kolinko.

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

Reply via email to