Skip to content

Commit 25d4486

Browse files
committed
Fix Wrk read errors
1 parent 6bbb0d7 commit 25d4486

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/Ubiquity/servers/workerman/WorkermanServer.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@ protected function handle(ConnectionInterface $connection,$datas) {
128128
$_GET['c'] = $uri;
129129
} else {
130130
if($fe){
131-
Http::header('Content-Type', HttpCache::$header['accept'] ?? 'text/html; charset=utf-8');
131+
Http::header('Content-Type: '. HttpCache::$header['Accept'] ?? 'text/html; charset=utf-8',true);
132132
$connection->send(\file_get_contents($this->basedir . '/../' . $uri));
133133
}else{
134-
Http::header('Content-Type', HttpCache::$header['accept'] ?? 'text/html; charset=utf-8',404);
134+
Http::header('Content-Type: '. HttpCache::$header['Accept'] ?? 'text/html; charset=utf-8',true,404);
135135
$connection->send($uri.' not found!');
136136
}
137137
return;
@@ -140,11 +140,7 @@ protected function handle(ConnectionInterface $connection,$datas) {
140140
$this->httpInstance->setDatas($datas);
141141
\ob_start();
142142
\Ubiquity\controllers\Startup::forward($_GET['c']);
143-
if($_SERVER['HTTP_CONNECTION']=='Keep-Alive'){
144-
$connection->send(\ob_get_clean());
145-
}else{
146-
$connection->close(\ob_get_clean());
147-
}
143+
$connection->send(\ob_get_clean());
148144
}
149145
/**
150146
* Sets the worker count
@@ -154,8 +150,8 @@ public function setWCount($wCount) {
154150
$this->wCount = $wCount;
155151
}
156152

157-
public function setDefaultCount(){
158-
$this->wCount= (int) \shell_exec('nproc') ??4;
153+
public function setDefaultCount($multi=1){
154+
$this->wCount= ((int) \shell_exec('nproc') ??4)*$multi;
159155
}
160156

161157
public function daemonize($value=true){

0 commit comments

Comments
 (0)