swoole2.1.3协程http客户端上传图片报错是什么原因?

开发环境

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();
阅读 1.9k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题