Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

协程客户端post数据问题,post数据内容为图片。图片大小 160k #2667

Closed
linuxlan opened this issue Jul 8, 2019 · 1 comment

Comments

@linuxlan
Copy link

linuxlan commented Jul 8, 2019

Please answer these questions before submitting your issue. Thanks!

  1. What did you do? If possible, provide a simple script for reproducing the error.
    在请求接口的时候 post 数据过大导致 NOTICE swSSL_connection_error (ERRNO 1014): SSL connection#0[123.125.114.17:443] protocol error[127]

  2. What did you expect to see?
    require_once 'vendor/autoload.php';

use Swlib\SaberGM;
use Swlib\Saber;
Swoole\Runtime::enableCoroutine(true, SWOOLE_HOOK_SLEEP);


go(function () {
    include_once 'b.php';
    $baidu_access_token='24.1e9db5a816901168208ee97283ef0506.2592000.1564834482.282335-16670746';

    //覆盖测试数据
    //$data = '123';

    $client = new Swoole\Coroutine\Http\Client('123.125.114.17', 443, true);

    $client->set(array(
        'open_eof_check' => true,
        'package_eof' => "\r\n\r\n",
        'package_max_length' => 1024 * 1024 * 20000,
        'keep_alive' => true,
        'timeout' => 10
    ));


    $client->setHeaders([
        'Host' => "aip.baidubce.com",
        "User-Agent" => 'Chrome/49.0.2587.3',
        'Accept' => 'text/html,application/xhtml+xml,application/xml,application/json',
        'Content-Type'=> "application/x-www-form-urlencoded",
        'Accept-Encoding' => 'gzip',
    ]);

    $client->post('https://aip.baidubce.com/rest/2.0/image-classify/v2/dish?access_token='.$baidu_access_token,http_build_query(['image'=>$data]));
    echo $client->body;

)};
  1. What did you see instead?

  2. What version of Swoole are you using (show your php --ri swoole)?
    swoole

Swoole => enabled
Author => Swoole Team team@swoole.com
Version => 4.3.4
Built => Jul 4 2019 16:17:41
coroutine => enabled
kqueue => enabled
rwlock => enabled
sockets => enabled
openssl => OpenSSL 1.0.2s 28 May 2019
http2 => enabled
pcre => enabled
zlib => enabled
async_redis => enabled

Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.display_errors => On => On
swoole.use_shortname => On => On
swoole.unixsock_buffer_size => 900000 => 900000

  1. What is your machine environment used (including version of kernel & php & gcc) ?

GCC:Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

System:Mac OS 10.14.5 (18F132)

@twose twose closed this as completed in 40e4ccf Jul 8, 2019
@twose
Copy link
Member

twose commented Jul 8, 2019

已修复, 需要更新到master版本(v4.4.1-alpha)

原因是OPENSSL默认不允许使用移动的内存(由于数据过大, 而底层发送时自动产生协程调度, 将数据拷贝到了另一块安全的内存)

twose added a commit that referenced this issue Jul 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants