From 35c07a75a62e9e2cd3611cb24d4cf7422b714024 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 18 Jul 2016 10:42:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=9F=E9=99=A4url=5Fdeny=5Fsuffix=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=8F=82=E6=95=B0=20=E6=94=B9=E7=94=B1=E8=B7=AF?= =?UTF-8?q?=E7=94=B1deny=5Fext=E5=8F=82=E6=95=B0=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/App.php | 5 ----- library/think/Route.php | 3 ++- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/library/think/App.php b/library/think/App.php index 4b26992f..cfe087d8 100644 --- a/library/think/App.php +++ b/library/think/App.php @@ -461,11 +461,6 @@ class App */ public static function routeCheck($request, array $config) { - // 检测URL禁用后缀 - if ($config['url_deny_suffix'] && preg_match('/\.(' . $config['url_deny_suffix'] . ')$/i', $request->pathinfo())) { - throw new Exception('url suffix deny:' . $request->ext()); - } - $path = $request->path(); $depr = $config['pathinfo_depr']; $result = false; diff --git a/library/think/Route.php b/library/think/Route.php index 55fde12c..18f055a6 100644 --- a/library/think/Route.php +++ b/library/think/Route.php @@ -916,7 +916,8 @@ class Route // 请求类型检测 if ((isset($option['method']) && false === stripos($option['method'], $request->method())) || (isset($option['ext']) && false === stripos($option['ext'], $request->ext())) // 伪静态后缀检测 - || (isset($option['domain']) && !in_array($option['domain'], [$_SERVER['HTTP_HOST'], self::$subDomain])) // 域名检测 + || (isset($option['deny_ext']) && false !== stripos($option['deny_ext'], $request->ext())) + || (isset($option['domain']) && !in_array($option['domain'], [$_SERVER['HTTP_HOST'], self::$subDomain])) // 域名检测 || (!empty($option['https']) && !$request->isSsl()) // https检测 || (!empty($option['before_behavior']) && false === Hook::exec($option['before_behavior'], '', $url)) // 行为检测 || (!empty($option['callback']) && is_callable($option['callback']) && false === call_user_func($option['callback'])) // 自定义检测