Skip to content

Commit cba8dfb

Browse files
committed
Update WorkermanServer.php
1 parent a46e256 commit cba8dfb

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

src/Ubiquity/servers/workerman/WorkermanServer.php

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ class WorkermanServer {
3434

3535
public $onWorkerStart;
3636

37-
private static $uriInfos;
38-
3937
/**
4038
*
4139
* @return int
@@ -122,12 +120,12 @@ protected function handle(ConnectionInterface $connection, $datas) {
122120
// $_REQUEST['REQUEST_TIME_FLOAT']=\microtime(true);
123121
Http::header('Date: ' . \gmdate('D, d M Y H:i:s') . ' GMT');
124122
$_GET['c'] = '';
125-
$uriInfos = (self::$uriInfos[$_SERVER['REQUEST_URI']] ??= self::parseURI($_SERVER['REQUEST_URI'], $this->basedir));
123+
$uriInfos = \Ubiquity\utils\http\URequest::parseURI($this->basedir);
126124
$uri = $uriInfos['uri'];
127125
if ($uriInfos['isAction']) {
128126
$_GET['c'] = $uri;
129127
} else {
130-
if ($uriInfos['fe']) {
128+
if ($uriInfos['file']) {
131129
Http::header('Content-Type: ' . (HttpCache::$header['Accept'] ?? 'text/html; charset=utf-8'), true);
132130
return $connection->send(\file_get_contents($this->basedir . '/../' . $uri));
133131
} else {
@@ -143,16 +141,6 @@ protected function handle(ConnectionInterface $connection, $datas) {
143141
return $connection->send(\ob_get_clean());
144142
}
145143

146-
protected static function parseURI($requestURI, $basedir) {
147-
$uri = \ltrim(\urldecode(\parse_url($requestURI, PHP_URL_PATH)), '/');
148-
$isAction = ($uri == null || ! ($fe = \file_exists($basedir . '/../' . $uri))) && ($uri != 'favicon.ico');
149-
return [
150-
'uri' => $uri,
151-
'isAction' => $isAction,
152-
'file' => $fe
153-
];
154-
}
155-
156144
/**
157145
* Sets the worker count
158146
*

0 commit comments

Comments
 (0)