mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-26 21:19:14 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 301d551981 | |||
| 90418eb41c | |||
| 0634ba79dc | |||
| 3534233a76 | |||
| 0f55480156 | |||
| 99ed44eb1e | |||
| 565a926bd3 | |||
| 64483652ff |
@@ -98,7 +98,7 @@ class BaseCsrfVerifier implements IMiddleware
|
||||
*/
|
||||
public function handle(Request $request): void
|
||||
{
|
||||
if ($this->skip($request) === false && ($request->isPostBack() === true || $this->isIncluded($request) === true)) {
|
||||
if ($this->skip($request) === false && ($request->isPostBack() === true || $request->isPostBack() === true && $this->isIncluded($request) === true)) {
|
||||
|
||||
$token = $request->getInputHandler()->value(
|
||||
static::POST_KEY,
|
||||
|
||||
@@ -395,6 +395,10 @@ class Request
|
||||
{
|
||||
$this->url = $url;
|
||||
|
||||
if ($this->getHost() !== null) {
|
||||
$url->setHost($this->getHost());
|
||||
}
|
||||
|
||||
if ($this->isSecure() === true) {
|
||||
$this->url->setScheme('https');
|
||||
}
|
||||
@@ -405,6 +409,11 @@ class Request
|
||||
*/
|
||||
public function setHost(?string $host): void
|
||||
{
|
||||
// Strip any potential ports from hostname
|
||||
if (strpos((string)$host, ':') !== false) {
|
||||
$host = strstr($host, strrchr($host, ':'), true);
|
||||
}
|
||||
|
||||
$this->host = $host;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,11 +72,11 @@ class Url implements JsonSerializable
|
||||
|
||||
public function parse(?string $url, bool $setOriginalPath = false): self
|
||||
{
|
||||
if ($url !== null && $url !== '/') {
|
||||
if ($url !== null) {
|
||||
$data = $this->parseUrl($url);
|
||||
|
||||
$this->scheme = $data['scheme'] ?? null;
|
||||
$this->host = $data['host'] ?? null;
|
||||
$this->scheme = $data['scheme'] ?? $this->scheme;
|
||||
$this->host = $data['host'] ?? $this->host;
|
||||
$this->port = $data['port'] ?? null;
|
||||
$this->username = $data['user'] ?? null;
|
||||
$this->password = $data['pass'] ?? null;
|
||||
@@ -95,6 +95,7 @@ class Url implements JsonSerializable
|
||||
$this->setQueryString($data['query']);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -540,7 +541,7 @@ class Url implements JsonSerializable
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return $this->getHost(true) . $this->getRelativeUrl();
|
||||
return $this->getRelativeUrl();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -562,7 +562,6 @@ class Router
|
||||
|
||||
if ($this->request->getRewriteRoute() !== null) {
|
||||
$this->processedRoutes[] = $this->request->getRewriteRoute();
|
||||
$this->request->setHasPendingRewrite(false);
|
||||
}
|
||||
|
||||
return $this->routeRequest();
|
||||
|
||||
Reference in New Issue
Block a user