src/CLI/Downloader.php
protected function readHeader( $ch, $string )
	{
		$length = strlen( $string );														//  get Length of Header String

		if( !trim( $string ) )																//  trimmed Header String is empty
			return $length;																	//  return Length of Header String
		if( $this->redirected )
			return $length;																	//  return Length of Header String
	
		$parts			= split( ": ", $string );											//  split Header on Colon
		if( count( $parts ) > 1 )															//  there has been at least one Colon
		{
			$header		= trim( array_shift( $parts ) );									//  Header Key is first Part
			$content	= trim( join( ": ", $parts ) );										//  Header Content are all other Parts
			$this->headers[$header]	= $content;												//  store splitted Header
			if( preg_match( "@^Location$@i", $header ) )									//  Header is Redirect
			{
				$this->redirected	= TRUE;
				if( $this->templateRedirect )
					printf( $this->templateRedirect, $content );
				$loader	= new CLI_Downloader();
				$loader->downloadUrl( $content, dirname( $this->fileUri ) );
			}
			if( preg_match( "@^Content-Length$@i", $header ) )								//  Header is Content-Length
				$this->fileSize	= (int) $content;											//  store Size of File to download
			if( $this->showHeaders && $this->templateHeader)								//  show Header
				printf( $this->templateHeader, $header, $content );							//  use Template
		}
		return $length;																		//  return Length of Header String
	}
protected function readHeader( $ch, $string )
	{
		$length = strlen( $string );														//  get Length of Header String

		if( !trim( $string ) )																//  trimmed Header String is empty
			return $length;																	//  return Length of Header String
		if( $this->redirected )
			return $length;																	//  return Length of Header String
	
		$parts			= split( ": ", $string );											//  split Header on Colon
		if( count( $parts ) > 1 )															//  there has been at least one Colon
		{
			$header		= trim( array_shift( $parts ) );									//  Header Key is first Part
			$content	= trim( join( ": ", $parts ) );										//  Header Content are all other Parts
			$this->headers[$header]	= $content;												//  store splitted Header
			if( preg_match( "@^Location$@i", $header ) )									//  Header is Redirect
			{
				$this->redirected	= TRUE;
				if( $this->templateRedirect )
					printf( $this->templateRedirect, $content );
				$loader	= new CLI_Downloader();
				$loader->downloadUrl( $content, dirname( $this->fileUri ) );
			}
			if( preg_match( "@^Content-Length$@i", $header ) )								//  Header is Content-Length
				$this->fileSize	= (int) $content;											//  store Size of File to download
			if( $this->showHeaders && $this->templateHeader)								//  show Header
				printf( $this->templateHeader, $header, $content );							//  use Template
		}
		return $length;																		//  return Length of Header String
	}
protected function readHeader ( $ ch , $ string ) { $ length = strlen ( $ string ) ; //  get Length of Header String if ( ! trim ( $ string ) ) //  trimmed Header String is empty return $ length ; //  return Length of Header String if ( $ this -> redirected ) return $ length ; //  return Length of Header String $ parts = split ( ": " , $ string ) ; //  split Header on Colon if ( count ( $ parts ) > 1 ) //  there has been at least one Colon { $ header = trim ( array_shift ( $ parts ) ) ; //  Header Key is first Part $ content = trim ( join ( ": " , $ parts ) ) ; //  Header Content are all other Parts $ this -> headers [ $ header ] = $ content ; //  store splitted Header if ( preg_match ( "@^Location$@i" , $ header ) ) //  Header is Redirect { $ this -> redirected = TRUE ; if ( $ this -> templateRedirect ) printf ( $ this -> templateRedirect , $ content ) ; $ loader = new CLI_Downloader ( ) ; $ loader -> downloadUrl ( $ content , dirname ( $ this -> fileUri ) ) ; } if ( preg_match ( "@^Content-Length$@i" , $ header ) ) //  Header is Content-Length $ this -> fileSize = ( int ) $ content ; //  store Size of File to download if ( $ this -> showHeaders && $ this -> templateHeader ) //  show Header printf ( $ this -> templateHeader , $ header , $ content ) ; //  use Template } return $ length ; //  return Length of Header String }
Callback Method for reading Headers.
@access		protected
@param		resource	$ch			cURL Handle
@param		string		$string		Header String
@return		int
Callback Method for reading Headers .