{"action":"opened","issue":{"url":"https://api.github.com/repos/swoole/swoole-src/issues/1966","repository_url":"https://api.github.com/repos/swoole/swoole-src","labels_url":"https://api.github.com/repos/swoole/swoole-src/issues/1966/labels{/name}","comments_url":"https://api.github.com/repos/swoole/swoole-src/issues/1966/comments","events_url":"https://api.github.com/repos/swoole/swoole-src/issues/1966/events","html_url":"https://github.com/swoole/swoole-src/issues/1966","id":358994940,"node_id":"MDU6SXNzdWUzNTg5OTQ5NDA=","number":1966,"title":"sendfile 下载二进制文件后下载的文件已损坏","user":{"login":"Awezome","id":3314334,"node_id":"MDQ6VXNlcjMzMTQzMzQ=","avatar_url":"https://avatars3.githubusercontent.com/u/3314334?v=4","gravatar_id":"","url":"https://api.github.com/users/Awezome","html_url":"https://github.com/Awezome","followers_url":"https://api.github.com/users/Awezome/followers","following_url":"https://api.github.com/users/Awezome/following{/other_user}","gists_url":"https://api.github.com/users/Awezome/gists{/gist_id}","starred_url":"https://api.github.com/users/Awezome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Awezome/subscriptions","organizations_url":"https://api.github.com/users/Awezome/orgs","repos_url":"https://api.github.com/users/Awezome/repos","events_url":"https://api.github.com/users/Awezome/events{/privacy}","received_events_url":"https://api.github.com/users/Awezome/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-11T10:59:30Z","updated_at":"2018-09-11T10:59:30Z","closed_at":null,"author_association":"NONE","body":"在http server里使用sendfile下载文件，如果下载的是二进制文件，下载后文件会损害。\r\n\r\n测试代码：\r\n\r\n`<?php\r\n\r\n$http=new swoole_http_server('0.0.0.0',8811);\r\n\r\n$http->set([\r\n    'buffer_output_size' => 100 * 1024 *1024, //必须为数字\r\n    'package_max_length' => 100 * 1024 *1024, //必须为数字\r\n    'http_compression' => false,\r\n]);\r\n\r\n$http->on('request',function($request,$response){\r\n    $filename='/Users/z/Desktop/1.dmg';\r\n    $response->header('Content-Type','application/octet-stream',true);\r\n    $response->sendfile($filename);\r\n});\r\n\r\n$http->start();\r\n`\r\n\r\n\r\n版本信息\r\nmac os 10.13.6\r\n\r\n$ php -v\r\nPHP 7.2.9 (cli) (built: Aug 23 2018 02:08:27) ( NTS )\r\nCopyright (c) 1997-2018 The PHP Group\r\nZend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies\r\n    with Zend OPcache v7.2.9, Copyright (c) 1999-2018, by Zend Technologies\r\n\r\n$ php --ri swoole\r\nswoole\r\nswoole support => enabled\r\nVersion => 4.1.2\r\nAuthor => Swoole Group[email: team@swoole.com]\r\ncoroutine => enabled\r\nkqueue => enabled\r\nrwlock => enabled\r\npcre => enabled\r\nzlib => enabled\r\n\r\nDirective => Local Value => Master Value\r\nswoole.enable_coroutine => On => On\r\nswoole.aio_thread_num => 2 => 2\r\nswoole.display_errors => On => On\r\nswoole.use_namespace => On => On\r\nswoole.use_shortname => On => On\r\nswoole.fast_serialize => Off => Off\r\nswoole.unixsock_buffer_size => 8388608 => 8388608"}}
{"actor":{"display_login":"Awezome"}}