Skip to content

Commit

Permalink
修复 Http 路由解析问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurunsoft committed Sep 27, 2019
1 parent 3a57e81 commit 39d6691
Showing 1 changed file with 25 additions and 21 deletions.
46 changes: 25 additions & 21 deletions src/Server/Http/Route/HttpRoute.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,37 +132,41 @@ public function parse(Request $request)
}
else
{
$rules = $this->rules;
$rules = [];
}
foreach($rules as $url => $items)
for($i = 0; $i < 2; ++$i)
{
$result = $this->checkUrl($request, $url, $pathInfo);
if($result->result || $result->resultIgnoreCase)
foreach($rules as $url => $items)
{
foreach($items as $item)
$result = $this->checkUrl($request, $url, $pathInfo);
if($result->result || $result->resultIgnoreCase)
{
if(
($result->result || ($this->ignoreCase || $item->annotation->ignoreCase)) &&
$this->checkMethod($request, $item->annotation->method) &&
$this->checkDomain($request, $item->annotation->domain, $domainParams) &&
$this->checkParamsGet($request, $item->annotation->paramsGet) &&
$this->checkParamsPost($request, $item->annotation->paramsPost) &&
$this->checkHeader($request, $item->annotation->header) &&
$this->checkRequestMime($request, $item->annotation->requestMime)
)
foreach($items as $item)
{
if([] === $domainParams)
{
$params = $result->params;
}
else
if(
($result->result || ($this->ignoreCase || $item->annotation->ignoreCase)) &&
$this->checkMethod($request, $item->annotation->method) &&
$this->checkDomain($request, $item->annotation->domain, $domainParams) &&
$this->checkParamsGet($request, $item->annotation->paramsGet) &&
$this->checkParamsPost($request, $item->annotation->paramsPost) &&
$this->checkHeader($request, $item->annotation->header) &&
$this->checkRequestMime($request, $item->annotation->requestMime)
)
{
$params = array_merge($result->params, $domainParams);
if([] === $domainParams)
{
$params = $result->params;
}
else
{
$params = array_merge($result->params, $domainParams);
}
return new RouteResult(clone $item, $result, $params);
}
return new RouteResult(clone $item, $result, $params);
}
}
}
$rules = $this->rules;
}
return null;
}
Expand Down

0 comments on commit 39d6691

Please sign in to comment.