protected boolean addHeaderInt ( char [ ] keyBuf , int keyOff , int keyLen , CharSegment value ) { if ( keyLen < 4 ) { return true ; } int key1 = keyBuf [ keyOff ] | 0x20 | ( keyLen << 8 ) ; switch ( key1 ) { case CONNECTION_KEY : if ( match ( keyBuf , keyOff , keyLen , CONNECTION ) ) { char [ ] valueBuffer = value . buffer ( ) ; int valueOffset = value . offset ( ) ; int valueLength = value . length ( ) ; int end = valueOffset + valueLength ; boolean isKeepalive = false ; while ( valueOffset < end ) { char ch = Character . toLowerCase ( valueBuffer [ valueOffset ] ) ; if ( ch == ' ' && match ( valueBuffer , valueOffset , KEEPALIVE . length , KEEPALIVE ) ) { isKeepalive = true ; valueOffset += KEEPALIVE . length ; } else if ( ch == ' ' && match ( valueBuffer , valueOffset , UPGRADE . length , UPGRADE ) ) { _isUpgrade = true ; valueOffset += UPGRADE . length ; } while ( valueOffset < end && valueBuffer [ valueOffset ++ ] != ' ' ) { } if ( valueBuffer [ valueOffset ] == ' ' ) { valueOffset ++ ; } } _isKeepalive = isKeepalive ; return true ; } case COOKIE_KEY : if ( match ( keyBuf , keyOff , keyLen , COOKIE ) ) { fillCookie ( _cookies , value ) ; } return true ; case CONTENT_LENGTH_KEY : if ( match ( keyBuf , keyOff , keyLen , CONTENT_LENGTH ) ) { contentLengthIn ( value ) ; } return true ; case EXPECT_KEY : if ( match ( keyBuf , keyOff , keyLen , EXPECT ) ) { if ( match ( value . buffer ( ) , value . offset ( ) , value . length ( ) , CONTINUE_100 ) ) { _expect100Continue = true ; return false ; } } return true ; case HOST_KEY : if ( match ( keyBuf , keyOff , keyLen , HOST ) ) { _hostHeader = value ; } return true ; case TRANSFER_ENCODING_KEY : if ( match ( keyBuf , keyOff , keyLen , TRANSFER_ENCODING ) ) { _isChunkedIn = true ; } return true ; case X_FORWARDED_HOST_KEY : if ( match ( keyBuf , keyOff , keyLen , X_FORWARDED_HOST ) ) { _xForwardedHostHeader = value ; } return true ; default : return true ; } }
Adds the header checking for known values .