0

开发环境

wsl swoole2.1.3

接口报错

使用以前的代码去调接口时没有问题
用swoole异步http很多时候会让接口报错

The proxy server received an invalid response from an upstream server.

本地报错

本地很多时候也会报错

WARNING swConnection_sendfile (ERROR 505): length or offset is invalid.

代码如下

$cli = new \Swoole\Coroutine\Http\Client($ip, $port, $ssl);
$cli->set(['timeout' => 1]);
$cli->setHeaders(['Host' => $host]);
$cli->addFile($mergreImg, 'merge_file');
$cli->addFile($templateImg, 'template_file');
$cli->post('/imagepp/v1/mergeface', [
    'api_key'            => $this->api_key,
    'api_secret'         => $this->api_secret,
    'template_rectangle' => $templateRect,
    'merge_rate'         => $this->merge_rate,
]);
$cli->close();
2018-05-11 提问
0 个回答

撰写答案

推广链接