Skip to content

Commit

Permalink
Merge pull request #22 from Lapinskas/develop
Browse files Browse the repository at this point in the history
Minor performance improvements
  • Loading branch information
Lapinskas authored Feb 29, 2020
2 parents a45c79c + 17cb742 commit c0f54c5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Changelog
## [1.0.7] - 2020-02-29

### Added

- Session startup could be conditional. Thanks to @jcheron

## [1.0.6] - 2020-02-27

### Fixed
Expand All @@ -23,6 +29,8 @@

- First stable release


[1.0.7]: https://github.com/Lapinskas/roadrunner-ubiquity/releases/tag/1.0.7
[1.0.6]: https://github.com/Lapinskas/roadrunner-ubiquity/releases/tag/1.0.6
[1.0.4]: https://github.com/Lapinskas/roadrunner-ubiquity/releases/tag/1.0.4
[1.0.3]: https://github.com/Lapinskas/roadrunner-ubiquity/releases/tag/1.0.3
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "lapinskas/roadrunner-ubiquity",
"type": "library",
"version": "1.0.6",
"version": "1.0.7",
"description": "RoadRunner and Ubiquity integration",
"keywords": ["roadrunner","ubiquity"],
"homepage": "https://github.com/Lapinskas/roadrunner-ubiquity",
Expand Down
12 changes: 6 additions & 6 deletions src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class Request

private $hasSession;

private $uri;

/**
* Request constructor.
* Opens stream relay with RoadRunner
Expand Down Expand Up @@ -115,7 +117,7 @@ public function sendResponse(int $status = 200, string $body = null, array $head
*/
public function ubiquityRoute()
{
$uri = \ltrim(\urldecode(\parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)), '/');
$uri = \ltrim($this->uri, '/');

return $_GET['c'] = ($uri !== 'favicon.ico' && ($uri == null || ! \file_exists(__DIR__ . '/' . $uri))) ? $uri : '';
}
Expand All @@ -131,7 +133,6 @@ public function garbageCollect($softLimit = self::MEMORY_SOFT_LIMIT)
if ($softLimit <= memory_get_usage()) {
gc_collect_cycles();
}
;
}

/**
Expand All @@ -152,7 +153,7 @@ public function getWorker(): Worker
*/
protected function prepareServer(): array
{
$ctx = $this->rawRequest['ctx'];
$ctx = &$this->rawRequest['ctx'];

$server = $this->originalServer;

Expand All @@ -177,10 +178,9 @@ protected function prepareServer(): array

if (false !== $parts = parse_url($ctx['uri'])) {
$server['QUERY_STRING'] = $parts['query'] ?? null;
$server['REQUEST_URI'] = $parts['path'] ?? null;
$server['REQUEST_URI'] = $this->uri = $parts['path'] ?? null;
$server['SERVER_PORT'] = $parts['port'] ?? null;
}
;

return $server;
}
Expand Down Expand Up @@ -230,7 +230,7 @@ protected function prepareCookie(): array
*/
protected function prepareFiles(): array
{
$ctx = $this->rawRequest['ctx'];
$ctx = &$this->rawRequest['ctx'];

if (! isset($ctx['uploads'])) {
return [];
Expand Down

0 comments on commit c0f54c5

Please sign in to comment.