Skip to content

If the download times out, an error is reported: Resource temporarily unavailable #601

@wangyouworld

Description

@wangyouworld

version:8.6.1

When I use the download method to download a file, I get an error:

The URL address is wrong:

$curl = new Curl();
$curl->setTimeout(10);

$curl->setOpt(CURLOPT_SSL_VERIFYPEER, FALSE);
$curl->setOpt(CURLOPT_SSL_VERIFYHOST, FALSE);

$url = 'http://baiduxxxx.com/favicon.icoa';
$curl->download($url, './a.tmp');

PHP Fatal error: Uncaught Exception: unlink(./a.tmp.pccdownload): Resource temporarily unavailable in \public\bat\helper\common.php:7
Stack trace:
#0 [internal function]: throwErr(2, 'unlink(./a.tmp....', '\www...', 1568, Array)
#1 \library\php-curl\src\Curl\Curl.php(1568): unlink('./a.tmp.pccdown...')
#2 \library\php-curl\src\Curl\Curl.php(447): Curl\Curl->downloadComplete(Resource id #29)
#3 \library\php-curl\src\Curl\Curl.php(430): Curl\Curl->execDone()
#4 \library\php-curl\src\Curl\Curl.php(469): Curl\Curl->exec()
#5 \library\php-curl\src\Curl\Curl.php(329): Curl\Curl->get('http://baiduxxxx.com...')
#6 \public\bat\www\start.php(111): Curl\Curl->download('http://baiduxxxx.com...', './a.tmp')

Currently, my method is to handle it with try-catch,like:

$code = 9999;
$url = 'http://baidu.com/favicon.icoa';
try {
    $curl->download($url, './a.tmp');
} catch (Exception $e) {
    $code = $e->getCode();
    echo 'download ',$url,' error.';
}

if ($code == 9999) echo md5_file('./a.tmp');

I don't know if this question is a bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions