@ Override protected void readResponseBody ( HttpState state , HttpConnection conn ) throws HttpException , IOException { LOG . trace ( "enter HeadMethod.readResponseBody(HttpState, HttpConnection)" ) ; int bodyCheckTimeout = getParams ( ) . getIntParameter ( HttpMethodParams . HEAD_BODY_CHECK_TIMEOUT , - 1 ) ; if ( bodyCheckTimeout < 0 ) { responseBodyConsumed ( ) ; } else { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Check for non-compliant response body. Timeout in " + bodyCheckTimeout + " ms" ) ; } boolean responseAvailable = false ; try { responseAvailable = conn . isResponseAvailable ( bodyCheckTimeout ) ; } catch ( IOException e ) { LOG . debug ( "An IOException occurred while testing if a response was available," + " we will assume one is not." , e ) ; responseAvailable = false ; } if ( responseAvailable ) { if ( getParams ( ) . isParameterTrue ( HttpMethodParams . REJECT_HEAD_BODY ) ) { throw new ProtocolException ( "Body content may not be sent in response to HTTP HEAD request" ) ; } else { LOG . warn ( "Body content returned in response to HTTP HEAD" ) ; } super . readResponseBody ( state , conn ) ; } } }
Implementation copied from HeadMethod .