diff --git a/inc/server.php b/inc/server.php index 25fd21f..a703412 100644 --- a/inc/server.php +++ b/inc/server.php @@ -66,7 +66,9 @@ public function startserver() { } $code = 206; $response->header('Content-Type', 'application/octet-stream'); - $response->header('Content-Disposition', $allurl['name']); + if(isset($request->header['name'])){ + $response->header('Content-Disposition', $allurl['name']); + } $response->header('x-bmclapi-hash', $downloadhash); $result = $response->sendfile($filepath,$start_byte,$length); } @@ -79,7 +81,9 @@ public function startserver() { } $code = 200; $response->header('Content-Type', 'application/octet-stream'); - $response->header('Content-Disposition', $allurl['name']); + if(isset($request->header['name'])){ + $response->header('Content-Disposition', $allurl['name']); + } $response->header('x-bmclapi-hash', $downloadhash); $result = $response->sendfile($filepath); } diff --git a/inc/socketio.php b/inc/socketio.php index 361088e..2cae699 100644 --- a/inc/socketio.php +++ b/inc/socketio.php @@ -183,6 +183,6 @@ public function disable() { Coroutine::sleep(2); } mlog("[socket.io]Close Connection"); - $this->$client->close(); + $this->client->close(); } } \ No newline at end of file diff --git a/main.php b/main.php index 3399c45..820db3d 100644 --- a/main.php +++ b/main.php @@ -10,7 +10,6 @@ $DOWNLOAD_DIR = $config['file']['cache_dir']; const USERAGENT = 'openbmclapi-cluster/' . VERSION . ' ' . 'PHP-OpenBmclApi/'.PHPOBAVERSION; const OPENBMCLAPIURL = 'openbmclapi.bangbang93.com'; -global $tokendata; $list = glob('inc/*.php'); foreach ($list as $file) { require $file; @@ -51,7 +50,6 @@ function registerSigintHandler() { $tokendata = $token->gettoken(); mlog("GetNewToken:".$tokendata['token'],1); }); - global $socketio; registerSigintHandler(); mlog("Timer start on ID{$tokentimeid}",1); @@ -133,7 +131,6 @@ function registerSigintHandler() { fclose($cert); } global $httpserver; - global $DOWNLOAD_DIR; $httpserver = new fileserver($config['cluster']['host'],$config['cluster']['port'],$config['cluster']['CLUSTER_ID'].'.crt',$config['cluster']['CLUSTER_ID'].'.key',$config['cluster']['CLUSTER_SECRET']); Coroutine::create(function () use ($config,$httpserver){ $httpserver->startserver();