phpBB

Code Changes

File: phpbb/file_downloader.php

  Unmodified   Added   Modified   Removed
Line 33Line 33
	 * @return mixed File data as string if file can be read and there is no
* timeout, false if there were errors or the connection timed out
*

	 * @return mixed File data as string if file can be read and there is no
* timeout, false if there were errors or the connection timed out
*

	 * @throws \RuntimeException If data can't be retrieved and no error

	 * @throws \phpbb\exception\runtime_exception If data can't be retrieved and no error

	 *		message is returned
*/
public function get($host, $directory, $filename, $port = 80, $timeout = 6)

	 *		message is returned
*/
public function get($host, $directory, $filename, $port = 80, $timeout = 6)

Line 42Line 42
		$this->error_number = 0;
$this->error_string = '';


		$this->error_number = 0;
$this->error_string = '';


		if ($socket = @fsockopen($host, $port, $this->error_number, $this->error_string, $timeout))

		if ($socket = @fsockopen(($port == 443 ? 'tls://' : '') . $host, $port, $this->error_number, $this->error_string, $timeout))

		{
@fputs($socket, "GET $directory/$filename HTTP/1.0\r\n");
@fputs($socket, "HOST: $host\r\n");

		{
@fputs($socket, "GET $directory/$filename HTTP/1.0\r\n");
@fputs($socket, "HOST: $host\r\n");

Line 69Line 69
					}
else if (stripos($line, '404 not found') !== false)
{

					}
else if (stripos($line, '404 not found') !== false)
{

						throw new \RuntimeException(array('FILE_NOT_FOUND', $filename));

						throw new \phpbb\exception\runtime_exception('FILE_NOT_FOUND', array($filename));

					}
}


					}
}


Line 77Line 77

if (!empty($stream_meta_data['timed_out']) || time() >= $timer_stop)
{


if (!empty($stream_meta_data['timed_out']) || time() >= $timer_stop)
{

					throw new \RuntimeException('FSOCK_TIMEOUT');

					throw new \phpbb\exception\runtime_exception('FSOCK_TIMEOUT');

				}
}
@fclose($socket);

				}
}
@fclose($socket);

Line 91Line 91
			}
else
{

			}
else
{

				throw new \RuntimeException('FSOCK_DISABLED');

				throw new \phpbb\exception\runtime_exception('FSOCK_DISABLED');

			}
}


			}
}