@ SuppressWarnings ( "PointlessArithmeticExpression" ) @ Override protected void onStartLine ( byte [ ] line , int limit ) throws ParseException { switchPool ( server . poolReadWrite ) ; HttpMethod method = getHttpMethod ( line ) ; if ( method == null ) { throw new UnknownFormatException ( HttpServerConnection . class , "Unknown HTTP method. First Bytes: " + Arrays . toString ( line ) ) ; } int urlStart = method . size + 1 ; int urlEnd ; for ( urlEnd = urlStart ; urlEnd < limit ; urlEnd ++ ) { if ( line [ urlEnd ] == SP ) { break ; } } int p ; for ( p = urlEnd + 1 ; p < limit ; p ++ ) { if ( line [ p ] != SP ) { break ; } } if ( p + 7 < limit ) { boolean http11 = line [ p + 0 ] == ' ' && line [ p + 1 ] == ' ' && line [ p + 2 ] == ' ' && line [ p + 3 ] == ' ' && line [ p + 4 ] == ' ' && line [ p + 5 ] == ' ' && line [ p + 6 ] == ' ' && line [ p + 7 ] == ' ' ; if ( http11 ) { flags |= KEEP_ALIVE ; // keep-alive for HTTP/1.1 } } request = new HttpRequest ( method , UrlParser . parse ( decodeAscii ( line , urlStart , urlEnd - urlStart , ThreadLocalCharArray . ensure ( charBuffer , urlEnd - urlStart ) ) ) ) ; if ( method == GET || method == DELETE ) { contentLength = 0 ; } }
This method is called after received line of header .