You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Jon Scott Stevens <jo...@latchkey.com> on 2002/10/11 00:19:32 UTC

Re: cvs commit: jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/http11 Constants.java Http11Processor.java InternalOutputBuffer.java

on 2002/10/10 6:14 AM, "remm@apache.org" <re...@apache.org> wrote:

> 
> +    }
> +
> +
> +    /**
> +     * Specialized utility method: find a sequence of lower case bytes inside
> +     * a ByteChunk.
> +     */
> +    protected int findBytes(ByteChunk bc, byte[] b) {
> +
> +        byte first = b[0];
> +        byte[] buff = bc.getBuffer();
> +        int start = bc.getStart();
> +        int end = bc.getEnd();
> +
> +    // Look for first char
> +    int srcEnd = b.length;
> +        
> +    for (int i = start; i <= (end - srcEnd); i++) {
> +        if (buff[i] != first) continue;
> +        // found first char, now look for a match
> +            int myPos = i+1;
> +        for (int srcPos = 1; srcPos < srcEnd; ) {
> +                if (buff[myPos++] != Ascii.toLower(b[srcPos++]))
> +            break;
> +                if (srcPos == srcEnd) return i - start; // found it
> +        }
> +    }
> +    return -1;
> +

Tabs.

-jon


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>