private void parse ( boolean isSecure ) throws URIException , HttpMalformedHeaderException { mIsSecure = isSecure ; Matcher matcher = patternRequestLine . matcher ( mStartLine ) ; if ( ! matcher . find ( ) ) { mMalformedHeader = true ; throw new HttpMalformedHeaderException ( "Failed to find pattern " + patternRequestLine + " in: " + mStartLine ) ; } mMethod = matcher . group ( 1 ) ; String sUri = matcher . group ( 2 ) ; mVersion = matcher . group ( 3 ) ; if ( ! mVersion . equalsIgnoreCase ( HTTP09 ) && ! mVersion . equalsIgnoreCase ( HTTP10 ) && ! mVersion . equalsIgnoreCase ( HTTP11 ) ) { mMalformedHeader = true ; throw new HttpMalformedHeaderException ( "Unexpected version: " + mVersion ) ; } if ( mMethod . equalsIgnoreCase ( CONNECT ) ) { parseHostName ( sUri ) ; mUri = parseURI ( mHostName ) ; } else { mUri = parseURI ( sUri ) ; if ( mUri . getScheme ( ) == null || mUri . getScheme ( ) . equals ( "" ) ) { mUri = new URI ( HTTP + "://" + getHeader ( HOST ) + mUri . toString ( ) , true ) ; } if ( isSecure ( ) && mUri . getScheme ( ) . equalsIgnoreCase ( HTTP ) ) { mUri = new URI ( mUri . toString ( ) . replaceFirst ( HTTP , HTTPS ) , true ) ; } if ( mUri . getScheme ( ) . equalsIgnoreCase ( HTTPS ) ) { setSecure ( true ) ; } mHostName = mUri . getHost ( ) ; setHostPort ( mUri . getPort ( ) ) ; } }
Parse this request header .