private void readResponseHeaders(State state,HttpURLConnection conn) throws StopRequestException {
  state.contentDisposition=conn.getHeaderField("Content-Disposition");
  state.contentLocation=conn.getHeaderField("Content-Location");
  if (state.mimeType == null) {
    state.mimeType=normalizeMimeType(conn.getContentType());
  }
  state.headerETag=conn.getHeaderField("ETag");
  final String transferEncoding=conn.getHeaderField("Transfer-Encoding");
  if (transferEncoding == null) {
    state.contentLength=getHeaderFieldLong(conn,"Content-Length",UNKNOWN_BYTE_SIZE);
  }
 else {
    LLog.i("Ignoring Content-Length since Transfer-Encoding is also defined");
    state.contentLength=UNKNOWN_BYTE_SIZE;
  }
  state.totalBytes=state.contentLength;
  final boolean noSizeInfo=state.contentLength == UNKNOWN_BYTE_SIZE && (transferEncoding == null || !transferEncoding.equalsIgnoreCase("chunked"));
  if (!originalDownloadInfo.isNoIntegrity() && noSizeInfo) {
    throw new StopRequestException(DownloadStatus.CANNOT_RESUME,"can't know size of download, giving up");
  }
}

private void readResponseHeaders ( State state , HttpURLConnection conn ) throws StopRequestException { state . contentDisposition = conn . getHeaderField ( "Content-Disposition" ) ; state . contentLocation = conn . getHeaderField ( "Content-Location" ) ; if ( state . mimeType == null ) { state . mimeType = normalizeMimeType ( conn . getContentType ( ) ) ; } state . headerETag = conn . getHeaderField ( "ETag" ) ; final String transferEncoding = conn . getHeaderField ( "Transfer-Encoding" ) ; if ( transferEncoding == null ) { state . contentLength = getHeaderFieldLong ( conn , "Content-Length" , UNKNOWN_BYTE_SIZE ) ; } else { LLog . i ( "Ignoring Content-Length since Transfer-Encoding is also defined" ) ; state . contentLength = UNKNOWN_BYTE_SIZE ; } state . totalBytes = state . contentLength ; final boolean noSizeInfo = state . contentLength == UNKNOWN_BYTE_SIZE && ( transferEncoding == null || ! transferEncoding . equalsIgnoreCase ( "chunked" ) ) ; if ( ! originalDownloadInfo . isNoIntegrity ( ) && noSizeInfo ) { throw new StopRequestException ( DownloadStatus . CANNOT_RESUME , "can't know size of download, giving up" ) ; } }
read headers from the http response and store them into local state .
