From 732fc79731d242b17a30fa8dd7b2944c062ebbcd Mon Sep 17 00:00:00 2001 From: david Date: Thu, 29 Oct 2020 15:10:01 -0400 Subject: [PATCH] Check in 1.6.17 --- LSQUICCOMMIT | 2 +- configure | 20 +- configure.ac | 2 +- dist/VERSION | 2 +- dist/add-ons/webcachemgr/VERSION | 2 +- .../add-ons/webcachemgr/src/CliController.php | 2 +- .../src/Context/RootPanelContextOption.php | 3 +- .../webcachemgr/src/Panel/ControlPanel.php | 4 +- dist/add-ons/webcachemgr/src/Panel/Plesk.php | 38 +- .../webcachemgr/src/PanelController.php | 487 +++++++++++++++--- .../add-ons/webcachemgr/src/View/AjaxView.php | 13 +- .../src/View/Model/ManageViewModel.php | 250 +++++---- .../View/Model/ScanProgressStepViewModel.php | 193 +++++++ .../src/View/Model/ScanProgressViewModel.php | 27 +- .../webcachemgr/src/View/Tpl/ScanProgress.tpl | 6 + .../src/View/Tpl/ScanProgressStep1.tpl | 69 +++ .../src/View/Tpl/ScanProgressStep2.tpl | 70 +++ dist/add-ons/webcachemgr/src/WPCaller.php | 5 +- dist/add-ons/webcachemgr/src/WPInstall.php | 135 +++-- .../webcachemgr/src/WPInstallStorage.php | 276 ++++++++-- dist/admin/html.open/lib/CValidation.php | 10 +- dist/admin/html.open/lib/DTblDefBase.php | 11 +- dist/admin/html.open/lib/ows/DTblDef.php | 1 + .../lib/util/build_php/BuildConfig.php | 6 +- dist/admin/html.open/res/lang/en-US_msg.php | 3 + dist/admin/html.open/res/lang/en-US_tips.php | 6 + dist/admin/html.open/res/lang/ja-JP_tips.php | 6 + dist/admin/html.open/res/lang/zh-CN_tips.php | 6 + dist/admin/html.open/view/dashboard.php | 4 +- dist/admin/html.open/view/inc/configui.php | 2 +- dist/admin/misc/lshttpd.service.in | 2 +- dist/admin/misc/lsup.sh | 20 +- dist/admin/misc/rc-inst.sh | 1 + dist/conf/mime.properties | 3 +- dist/docs/AdminGeneral_Help.html | 2 +- dist/docs/AdminListeners_General_Help.html | 2 +- dist/docs/AdminListeners_SSL_Help.html | 2 +- dist/docs/AdminSecurity_Help.html | 2 +- dist/docs/App_Server_Context.html | 2 +- dist/docs/App_Server_Help.html | 2 +- dist/docs/CGI_Context.html | 2 +- dist/docs/CompilePHP_Help.html | 2 +- dist/docs/Context_Help.html | 2 +- dist/docs/ExtApp_Help.html | 2 +- dist/docs/External_FCGI.html | 2 +- dist/docs/External_FCGI_Auth.html | 2 +- dist/docs/External_LB.html | 2 +- dist/docs/External_LSAPI.html | 2 +- dist/docs/External_PL.html | 2 +- dist/docs/External_Servlet.html | 2 +- dist/docs/External_WS.html | 2 +- dist/docs/FCGI_Context.html | 2 +- dist/docs/Java_Web_App_Context.html | 2 +- dist/docs/LB_Context.html | 2 +- dist/docs/LSAPI_Context.html | 2 +- dist/docs/Listeners_General_Help.html | 2 +- dist/docs/Listeners_SSL_Help.html | 2 +- dist/docs/Module_Context.html | 2 +- dist/docs/Module_Help.html | 2 +- dist/docs/Proxy_Context.html | 2 +- dist/docs/Redirect_Context.html | 2 +- dist/docs/Rewrite_Help.html | 2 +- dist/docs/ScriptHandler_Help.html | 2 +- dist/docs/ServGeneral_Help.html | 2 +- dist/docs/ServLog_Help.html | 2 +- dist/docs/ServSecurity_Help.html | 2 +- dist/docs/ServTuning_Help.html | 7 +- dist/docs/ServerStat_Help.html | 2 +- dist/docs/Servlet_Context.html | 2 +- dist/docs/Static_Context.html | 2 +- dist/docs/Templates_Help.html | 2 +- dist/docs/VHGeneral_Help.html | 2 +- dist/docs/VHSSL_Help.html | 2 +- dist/docs/VHSecurity_Help.html | 2 +- dist/docs/VHWebSocket_Help.html | 2 +- dist/docs/VirtualHosts_Help.html | 2 +- dist/docs/admin.html | 2 +- dist/docs/config.html | 2 +- dist/docs/index.html | 4 +- dist/docs/install.html | 2 +- dist/docs/intro.html | 2 +- dist/docs/ja-JP/ServTuning_Help.html | 5 +- dist/docs/license.html | 2 +- dist/docs/security.html | 2 +- dist/docs/webconsole.html | 2 +- dist/docs/zh-CN/AdminGeneral_Help.html | 2 +- .../zh-CN/AdminListeners_General_Help.html | 6 +- dist/docs/zh-CN/AdminListeners_SSL_Help.html | 2 +- dist/docs/zh-CN/AdminSecurity_Help.html | 2 +- dist/docs/zh-CN/App_Server_Context.html | 4 +- dist/docs/zh-CN/App_Server_Help.html | 2 +- dist/docs/zh-CN/CGI_Context.html | 4 +- dist/docs/zh-CN/CompilePHP_Help.html | 2 +- dist/docs/zh-CN/Context_Help.html | 2 +- dist/docs/zh-CN/ExtApp_Help.html | 2 +- dist/docs/zh-CN/External_FCGI.html | 2 +- dist/docs/zh-CN/External_FCGI_Auth.html | 2 +- dist/docs/zh-CN/External_LB.html | 2 +- dist/docs/zh-CN/External_LSAPI.html | 2 +- dist/docs/zh-CN/External_PL.html | 2 +- dist/docs/zh-CN/External_Servlet.html | 2 +- dist/docs/zh-CN/External_WS.html | 2 +- dist/docs/zh-CN/FCGI_Context.html | 2 +- dist/docs/zh-CN/Java_Web_App_Context.html | 2 +- dist/docs/zh-CN/LB_Context.html | 2 +- dist/docs/zh-CN/LSAPI_Context.html | 2 +- dist/docs/zh-CN/Listeners_General_Help.html | 6 +- dist/docs/zh-CN/Listeners_SSL_Help.html | 2 +- dist/docs/zh-CN/Module_Context.html | 2 +- dist/docs/zh-CN/Module_Help.html | 2 +- dist/docs/zh-CN/Proxy_Context.html | 2 +- dist/docs/zh-CN/Redirect_Context.html | 2 +- dist/docs/zh-CN/Rewrite_Help.html | 4 +- dist/docs/zh-CN/ScriptHandler_Help.html | 2 +- dist/docs/zh-CN/ServGeneral_Help.html | 2 +- dist/docs/zh-CN/ServLog_Help.html | 2 +- dist/docs/zh-CN/ServSecurity_Help.html | 2 +- dist/docs/zh-CN/ServTuning_Help.html | 7 +- dist/docs/zh-CN/ServerStat_Help.html | 2 +- dist/docs/zh-CN/Servlet_Context.html | 2 +- dist/docs/zh-CN/Static_Context.html | 4 +- dist/docs/zh-CN/Templates_Help.html | 2 +- dist/docs/zh-CN/VHGeneral_Help.html | 2 +- dist/docs/zh-CN/VHSSL_Help.html | 2 +- dist/docs/zh-CN/VHSecurity_Help.html | 2 +- dist/docs/zh-CN/VHWebSocket_Help.html | 2 +- dist/docs/zh-CN/VirtualHosts_Help.html | 2 +- dist/docs/zh-CN/admin.html | 54 +- dist/docs/zh-CN/config.html | 125 ++--- dist/docs/zh-CN/index.html | 22 +- dist/docs/zh-CN/install.html | 144 +++--- dist/docs/zh-CN/intro.html | 2 +- dist/docs/zh-CN/license.html | 2 +- dist/docs/zh-CN/security.html | 92 ++-- dist/docs/zh-CN/webconsole.html | 16 +- src/config.h.cmake | 2 +- src/extensions/cgi/lscgid.cpp | 2 +- src/http/accesslog.cpp | 197 +++---- src/http/accesslog.h | 17 +- src/http/chunkoutputstream.cpp | 20 +- src/http/httpserverconfig.cpp | 9 +- src/http/httpsession.cpp | 45 +- src/http/httpsession.h | 1 + src/http/iptoloc.cpp | 4 +- src/http/rewriteengine.cpp | 2 +- src/lsiapi/lsiapilib.cpp | 15 +- src/main/lshttpdmain.cpp | 2 +- src/modules/cache/cache.cpp | 5 +- src/quic/quicengine.cpp | 13 +- src/shm/lsshm.cpp | 4 +- src/shm/lsshm.h | 2 +- src/shm/lsshmhash.cpp | 35 +- src/shm/lsshmhash.h | 4 +- src/shm/lsshmpool.cpp | 22 +- src/shm/lsshmpool.h | 13 +- src/shm/lsshmtidmgr.cpp | 38 +- src/shm/lsshmtidmgr.h | 6 +- src/spdy/unpackedheaders.cpp | 2 +- src/util/autobuf.h | 7 + 159 files changed, 1907 insertions(+), 921 deletions(-) create mode 100644 dist/add-ons/webcachemgr/src/View/Model/ScanProgressStepViewModel.php create mode 100644 dist/add-ons/webcachemgr/src/View/Tpl/ScanProgressStep1.tpl create mode 100644 dist/add-ons/webcachemgr/src/View/Tpl/ScanProgressStep2.tpl diff --git a/LSQUICCOMMIT b/LSQUICCOMMIT index 5a6f528dc..03eb7acb4 100644 --- a/LSQUICCOMMIT +++ b/LSQUICCOMMIT @@ -1 +1 @@ -2d7c7f881cc3c7d45103ddb05f154b72a1f19188 +6eec0a76f7edc4e7c6e6d32305484065f2fa7478 diff --git a/configure b/configure index 57b9cfa48..d9c2e85ed 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for openlitespeed 1.6.16. +# Generated by GNU Autoconf 2.69 for openlitespeed 1.6.17. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='openlitespeed' PACKAGE_TARNAME='openlitespeed' -PACKAGE_VERSION='1.6.16' -PACKAGE_STRING='openlitespeed 1.6.16' +PACKAGE_VERSION='1.6.17' +PACKAGE_STRING='openlitespeed 1.6.17' PACKAGE_BUGREPORT='info@litespeedtech.com' PACKAGE_URL='http://www.litespeedtech.com/' @@ -1409,7 +1409,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures openlitespeed 1.6.16 to adapt to many kinds of systems. +\`configure' configures openlitespeed 1.6.17 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1480,7 +1480,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of openlitespeed 1.6.16:";; + short | recursive ) echo "Configuration of openlitespeed 1.6.17:";; esac cat <<\_ACEOF @@ -1641,7 +1641,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -openlitespeed configure 1.6.16 +openlitespeed configure 1.6.17 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2315,7 +2315,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by openlitespeed $as_me 1.6.16, which was +It was created by openlitespeed $as_me 1.6.17, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3181,7 +3181,7 @@ fi # Define the identity of the package. PACKAGE='openlitespeed' - VERSION='1.6.16' + VERSION='1.6.17' # Some tools Automake needs. @@ -19624,7 +19624,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by openlitespeed $as_me 1.6.16, which was +This file was extended by openlitespeed $as_me 1.6.17, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -19691,7 +19691,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -openlitespeed config.status 1.6.16 +openlitespeed config.status 1.6.17 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index e0ea25239..014765bf0 100644 --- a/configure.ac +++ b/configure.ac @@ -7,7 +7,7 @@ m4_include(ax_check_libudns.m4) m4_include(ax_check_ip2location.m4) dnl Process this file with autoconf to produce a configure script. -AC_INIT([openlitespeed],[1.6.16],[info@litespeedtech.com],[openlitespeed],[http://www.litespeedtech.com/]) +AC_INIT([openlitespeed],[1.6.17],[info@litespeedtech.com],[openlitespeed],[http://www.litespeedtech.com/]) AM_INIT_AUTOMAKE([1.0 foreign no-define subdir-objects]) diff --git a/dist/VERSION b/dist/VERSION index 9494224a9..5f3f7155d 100644 --- a/dist/VERSION +++ b/dist/VERSION @@ -1 +1 @@ -1.6.16 +1.6.17 diff --git a/dist/add-ons/webcachemgr/VERSION b/dist/add-ons/webcachemgr/VERSION index 46f2f0d5a..ac19c875f 100644 --- a/dist/add-ons/webcachemgr/VERSION +++ b/dist/add-ons/webcachemgr/VERSION @@ -1 +1 @@ -1.13.2.2 \ No newline at end of file +1.13.3.1 \ No newline at end of file diff --git a/dist/add-ons/webcachemgr/src/CliController.php b/dist/add-ons/webcachemgr/src/CliController.php index 7ee465b53..5b506dfee 100644 --- a/dist/add-ons/webcachemgr/src/CliController.php +++ b/dist/add-ons/webcachemgr/src/CliController.php @@ -680,7 +680,7 @@ private function displayCacheRoots() /** * * @param string[] $args - * @throws LSCMException + * @throws LSCMException Thrown directly and indirectly. */ private function parseCommands( $args ) { diff --git a/dist/add-ons/webcachemgr/src/Context/RootPanelContextOption.php b/dist/add-ons/webcachemgr/src/Context/RootPanelContextOption.php index 04223319b..bb28b30bf 100644 --- a/dist/add-ons/webcachemgr/src/Context/RootPanelContextOption.php +++ b/dist/add-ons/webcachemgr/src/Context/RootPanelContextOption.php @@ -1,6 +1,6 @@ getVhDir(); + + $cmd = 'grep -hro --exclude="stat_ttl.conf" --exclude="*.bak" ' + . '--exclude="last_httpd.conf" ' + . '"DocumentRoot.*\|ServerName.*\|ServerAlias.*" ' + . "{$vhDir}/system/*/conf/*"; exec( $cmd, $lines); /** diff --git a/dist/add-ons/webcachemgr/src/PanelController.php b/dist/add-ons/webcachemgr/src/PanelController.php index d2a7216cb..6e709fc6d 100644 --- a/dist/add-ons/webcachemgr/src/PanelController.php +++ b/dist/add-ons/webcachemgr/src/PanelController.php @@ -3,8 +3,8 @@ /** ********************************************* * LiteSpeed Web Server Cache Manager * - * @author: LiteSpeed Technologies, Inc. (https://www.litespeedtech.com) - * @copyright: (c) 2018-2020 + * @author LiteSpeed Technologies, Inc. (https://www.litespeedtech.com) + * @copyright (c) 2018-2020 * ******************************************* */ @@ -18,13 +18,44 @@ class PanelController { + /** + * @var int + */ const MGR_STEP_NONE = 0; + + /** + * @var int + */ const MGR_STEP_SCAN = 1; + + /** + * @var int + */ const MGR_STEP_DISCOVER_NEW = 2; + + /** + * @var int + */ const MGR_STEP_REFRESH_STATUS = 3; + + /** + * @var int + */ const MGR_STEP_MASS_UNFLAG = 4; + + /** + * @var int + */ const DASH_STEP_NONE = 0; + + /** + * @var int + */ const DASH_STEP_MASS_DASH_NOTIFY = 1; + + /** + * @var int + */ const DASH_STEP_MASS_DASH_DISABLE = 2; /** @@ -64,7 +95,7 @@ public function __construct( ControlPanel $panelEnv, /** * * @param string $type - * @return null|string[] + * @return void|string[] */ protected function getCurrentAction( $type = 'cacheMgr' ) { @@ -109,7 +140,7 @@ protected function getCurrentAction( $type = 'cacheMgr' ) * @deprecated * * @return int - * @throws LSCMException Thrown indireclty. + * @throws LSCMException Thrown indirectly. */ public function manageOperationsSubController() { @@ -117,6 +148,8 @@ public function manageOperationsSubController() } /** + * + * @deprecated 1.13.3 Use $this->>manageCacheOperations2() instead. * * @return int * @throws LSCMException Thrown indirectly. @@ -145,6 +178,37 @@ public function manageCacheOperations() return $this->mgrStep; } + /** + * + * @since 1.13.3 + * + * @return int + * @throws LSCMException Thrown indirectly. + */ + public function manageCacheOperations2() + { + if ( $this->checkScanAction2() + || $this->checkRefreshAction() + || $this->checkUnflagAction() + || ($actionInfo = $this->getCurrentAction()) == NULL ) { + + return $this->mgrStep; + } + + $actKey = $actionInfo['act_key']; + $action = $actionInfo['action']; + + if ( strcmp(substr($actKey, -3), 'sel') == 0 ) { + $this->doFormAction($action); + } + else { + $path = Util::get_request_var($actKey); + $this->doSingleAction($action, $path); + } + + return $this->mgrStep; + } + /** * * @return string @@ -174,7 +238,10 @@ protected function getDashMsgInfoJSON() /** * + * @param int $dashStep + * @param WPDashMsgs $wpDashMsgs * @return int + * @throws LSCMException Thrown indirectly. */ public function manageDashOperations( $dashStep, WPDashMsgs $wpDashMsgs ) { @@ -212,7 +279,7 @@ public function manageDashOperations( $dashStep, WPDashMsgs $wpDashMsgs ) * @return int * @throws LSCMException */ - protected function getBatchSize( &$array ) + protected function getBatchSize( $array ) { try { @@ -239,7 +306,8 @@ protected function getBatchSize( &$array ) * * @param object $viewModel * @param string $tplID - * @return type + * @return string + * @throws LSCMException Thrown indirectly. */ protected function getAjaxViewContent( $viewModel, $tplID = '' ) { @@ -273,6 +341,8 @@ protected function ajaxReturn( $ajaxInfo ) } /** + * + * @deprecated 1.13.3 Use $this->checkScanAction2() instead. * * @return boolean * @throws LSCMException Thrown indirectly. @@ -319,26 +389,35 @@ protected function checkScanAction() $completedCount = -1; if ( !isset($info['homeDirs']) ) { - Logger::uiError('Expected session data missing! Stopping mass operation.'); + Logger::uiError( + 'Expected session data missing! Stopping mass operation.' + ); } else { $batchSize = $this->getBatchSize($info['homeDirs']); $batch = array_splice($info['homeDirs'], 0, $batchSize); - $finishedList = $this->wpInstallStorage->doAction($action, - $batch); + $finishedList = $this->wpInstallStorage->doAction( + $action, + $batch + ); $completedCount = count($finishedList); if ( $completedCount != $batchSize ) { $info['homeDirs'] = array_merge( - array_slice($batch, $completedCount), $info['homeDirs']); + array_slice($batch, $completedCount), + $info['homeDirs'] + ); } } $msgs = $this->wpInstallStorage->getAllCmdMsgs(); - $errMsgs = array_merge($msgs['fail'], $msgs['err'], - Logger::getUiMsgs(Logger::UI_ERR)); + $errMsgs = array_merge( + $msgs['fail'], + $msgs['err'], + Logger::getUiMsgs(Logger::UI_ERR) + ); $ajaxInfo = array( 'completed' => $completedCount, @@ -357,8 +436,159 @@ protected function checkScanAction() } /** + * + * @since 1.13.3 * * @return boolean + * @throws LSCMException Thrown indirectly. + */ + protected function checkScanAction2() + { + $init = false; + + if ( $this->mgrStep == self::MGR_STEP_SCAN ) { + $action = WPInstallStorage::CMD_SCAN2; + } + elseif ( $this->mgrStep == self::MGR_STEP_DISCOVER_NEW ) { + $action = WPInstallStorage::CMD_DISCOVER_NEW2; + } + else { + if ( Util::get_request_var('re-scan') ) { + $this->mgrStep = self::MGR_STEP_SCAN; + $init = true; + } + elseif ( Util::get_request_var('scan_more') ) { + $this->mgrStep = self::MGR_STEP_DISCOVER_NEW; + $init = true; + } + else { + return false; + } + } + + if ( session_status() !== PHP_SESSION_ACTIVE ) { + session_start(); + } + + if ( Util::get_request_var('go_to_next') == 1 ){ + return true; + } + + $info = &$_SESSION['scanInfo']; + + if ( $init ) { + $docrootInfo = $this->panelEnv->getDocroots(); + + $info = array( + 'homeDirs' => $docrootInfo, + 'installs' => array() + ); + } + else { + $errMsgs = array(); + $completedCount = -1; + + if ( !is_array($info) + || !array_key_exists('homeDirs', $info) + || !array_key_exists('installs', $info) ) { + + Logger::uiError( + 'Expected session data missing! Stopping mass operation.' + ); + } + else { + + if ( $info['homeDirs'] !== null ) { + $scanStep = 1; + $batchSize = $this->getBatchSize($info['homeDirs']); + + $batch = array_splice($info['homeDirs'], 0, $batchSize); + + $wpPaths = array(); + + foreach ( $batch as $docroot ) { + $wpPaths = array_merge( + $wpPaths, + $this->wpInstallStorage->scan2($docroot) + ); + } + + $completedCount = $batchSize; + + if ( $action == WPInstallStorage::CMD_DISCOVER_NEW2 ) { + + foreach( $wpPaths as $wpPath ) { + + if ( $this->wpInstallStorage->getWPInstall($wpPath) == null) { + $info['installs'][] = $wpPath; + } + } + } + else { + $info['installs'] = array_merge( + $info['installs'], + $wpPaths + ); + } + + if ( empty($info['homeDirs']) ) { + $info['homeDirs'] = null; + } + } + elseif ( $info['installs'] !== null ) { + $scanStep = 2; + + $batchSize = $this->getBatchSize($info['installs']); + + $batch = + array_splice($info['installs'], 0, $batchSize); + + $finishedList = $this->wpInstallStorage->doAction( + WPInstallStorage::CMD_ADD_NEW_WPINSTALL, + $batch + ); + + $completedCount = count($finishedList); + + if ( $completedCount != $batchSize ) { + $info['installs'] = array_merge( + array_slice($batch, $completedCount), + $info['installs'] + ); + } + + $msgs = $this->wpInstallStorage->getAllCmdMsgs(); + $errMsgs = array_merge($msgs['fail'], $msgs['err']); + + if ( empty($info['installs']) ) { + $info['installs'] = null; + } + } + } + + $errMsgs = array_merge($errMsgs, Logger::getUiMsgs(Logger::UI_ERR)); + + $ajaxInfo = array( + 'scanStep' => $scanStep, + 'completed' => $completedCount, + 'errMsgs' => $errMsgs + ); + + if ( $info['homeDirs'] === null && $info['installs'] === null ) { + unset($_SESSION['scanInfo']); + } + + AjaxResponse::setAjaxContent(json_encode($ajaxInfo)); + AjaxResponse::outputAndExit(); + } + + return true; + } + + /** + * + * @return bool + * @throws LSCMException Thrown indirectly. */ protected function checkRefreshAction() { @@ -388,7 +618,9 @@ protected function checkRefreshAction() $completedCount = -1; if ( !isset($info['installs']) ) { - Logger::uiError('Expected session data missing! Stopping mass operation.'); + Logger::uiError( + 'Expected session data missing! Stopping mass operation.' + ); } else { $batchSize = $this->getBatchSize($info['installs']); @@ -396,19 +628,26 @@ protected function checkRefreshAction() $batch = array_splice($info['installs'], 0, $batchSize); $finishedList = $this->wpInstallStorage->doAction( - UserCommand::CMD_STATUS, $batch); + UserCommand::CMD_STATUS, + $batch + ); $completedCount = count($finishedList); if ( $completedCount != $batchSize ) { $info['installs'] = array_merge( - array_slice($batch, $completedCount), $info['installs']); + array_slice($batch, $completedCount), + $info['installs'] + ); } } $msgs = $this->wpInstallStorage->getAllCmdMsgs(); - $errMsgs = array_merge($msgs['fail'], $msgs['err'], - Logger::getUiMsgs(Logger::UI_ERR)); + $errMsgs = array_merge( + $msgs['fail'], + $msgs['err'], + Logger::getUiMsgs(Logger::UI_ERR) + ); $ajaxInfo = array( 'completed' => $completedCount, @@ -428,7 +667,8 @@ protected function checkRefreshAction() /** * - * @return boolean + * @return bool + * @throws LSCMException Thrown indirectly. */ protected function checkUnflagAction() { @@ -458,7 +698,9 @@ protected function checkUnflagAction() $completedCount = -1; if ( !isset($info['installs']) ) { - Logger::uiError('Expected session data missing! Stopping mass operation.'); + Logger::uiError( + 'Expected session data missing! Stopping mass operation.' + ); } else { $batchSize = $this->getBatchSize($info['installs']); @@ -466,21 +708,30 @@ protected function checkUnflagAction() $batch = array_splice($info['installs'], 0, $batchSize); $finishedList = $this->wpInstallStorage->doAction( - WPInstallStorage::CMD_MASS_UNFLAG, $batch); + WPInstallStorage::CMD_MASS_UNFLAG, + $batch + ); $completedCount = count($finishedList); if ( $completedCount != $batchSize ) { $info['installs'] = array_merge( - array_slice($batch, $completedCount), $info['installs']); + array_slice($batch, $completedCount), + $info['installs'] + ); } } $msgs = $this->wpInstallStorage->getAllCmdMsgs(); - $errMsgs = array_merge($msgs['fail'], $msgs['err'], - Logger::getUiMsgs(Logger::UI_ERR)); - $succMsgs = array_merge($msgs['succ'], - Logger::getUiMsgs(Logger::UI_SUCC)); + $errMsgs = array_merge( + $msgs['fail'], + $msgs['err'], + Logger::getUiMsgs(Logger::UI_ERR) + ); + $succMsgs = array_merge( + $msgs['succ'], + Logger::getUiMsgs(Logger::UI_SUCC) + ); $ajaxInfo = array( @@ -503,8 +754,8 @@ protected function checkUnflagAction() /** * * @param string $action - * @return null - * @throws LSCMException + * @return void + * @throws LSCMException Thrown directly and indirectly. */ protected function doFormAction( $action ) { @@ -521,7 +772,9 @@ protected function doFormAction( $action ) foreach ( $list as $wpPath ) { if ( $this->wpInstallStorage->getWPInstall($wpPath) === null ) { - Logger::uiError('Invalid input value detected - No Action Taken'); + Logger::uiError( + 'Invalid input value detected - No Action Taken' + ); return; } } @@ -575,23 +828,18 @@ protected function getStatusStrings( WPInstall $wpInstall ) $flagString = 'unflagged'; } - $statusInfo = array( + return array( 'status' => $statusString, 'flag_status' => $flagString ); - - return $statusInfo; } /** * * @param string $action * @param string $path - * @return null - * @throws LSCMException Indirectly thrown by Logger::uiError(), - * $this->wpInstallStorage->doAction(), - * Logger::getUiMsgs(), and - * AjaxResponse::outputAndExit(). + * @return void + * @throws LSCMException Thrown indirectly. */ protected function doSingleAction( $action, $path ) { @@ -681,6 +929,12 @@ protected function doSingleAction( $action, $path ) AjaxResponse::outputAndExit(); } + /** + * + * @param WPDashMsgs $wpDashMsgs + * @param string $action + * @throws LSCMException Thrown indirectly. + */ protected function doWpDashMsgOperation( WPDashMsgs $wpDashMsgs, $action ) { @@ -711,7 +965,6 @@ protected function doWpDashMsgOperation( WPDashMsgs $wpDashMsgs, break; case WPDashMsgs::ACTION_ADD_MSG: - $slug = ''; if ( ($msg = Util::get_request_var('notify_msg')) !== NULL ) { $msg = trim($msg); @@ -757,17 +1010,21 @@ protected function doWpDashMsgOperation( WPDashMsgs $wpDashMsgs, * * @param string $action * @param string $path - * @return null + * @param string $msgInfoJSON + * @throws LSCMException Thrown indirectly. */ protected function doSingleDashAction( $action, $path, - $msgInfoJSON = array() ) + $msgInfoJSON = '' ) { $wpInstall = $this->wpInstallStorage->getWPInstall($path); if ( $wpInstall === null ) { $ajaxReturn = array( - 'errMsgs' => array('Invalid input value detected - Please use the exact path ' - . 'displayed in the "Manage Cache Installations" list when testing.'), + 'errMsgs' => array( + 'Invalid input value detected - Please use the exact path ' + . 'displayed in the "Manage Cache Installations" list ' + . 'when testing.' + ), 'succMsgs' => array() ); @@ -775,14 +1032,22 @@ protected function doSingleDashAction( $action, $path, AjaxResponse::outputAndExit(); } - $this->wpInstallStorage->doAction($action, array( $path ), - array($msgInfoJSON)); + $this->wpInstallStorage->doAction( + $action, + array( $path ), + array( $msgInfoJSON ) + ); $msgs = $this->wpInstallStorage->getAllCmdMsgs(); - $errMsgs = array_merge($msgs['fail'], $msgs['err'], - Logger::getUiMsgs(Logger::UI_ERR)); - $succMsgs = array_merge($msgs['succ'], - Logger::getUiMsgs(Logger::UI_SUCC)); + $errMsgs = array_merge( + $msgs['fail'], + $msgs['err'], + Logger::getUiMsgs(Logger::UI_ERR) + ); + $succMsgs = array_merge( + $msgs['succ'], + Logger::getUiMsgs(Logger::UI_SUCC) + ); $ajaxReturn = array( 'errMsgs' => $errMsgs, @@ -797,7 +1062,7 @@ protected function doSingleDashAction( $action, $path, * * @param string $action * @param int $step - * @return null + * @throws LSCMException Thrown indirectly. */ public function massEnableDisable( $action, $step ) { @@ -820,7 +1085,9 @@ public function massEnableDisable( $action, $step ) $completedCount = -1; if ( !isset($info['installs']) ) { - Logger::uiError('Expected session data missing! Stopping mass operation.'); + Logger::uiError( + 'Expected session data missing! Stopping mass operation.' + ); } else { $batchSize = $this->getBatchSize($info['installs']); @@ -829,21 +1096,25 @@ public function massEnableDisable( $action, $step ) try { - $finishedList = - $this->wpInstallStorage->doAction("mass_{$action}", - $batch); + $finishedList = $this->wpInstallStorage->doAction( + "mass_{$action}", + $batch + ); $completedCount = count($finishedList); if ( $completedCount != $batchSize ) { $info['installs'] = array_merge( - array_slice($batch, $completedCount), - $info['installs']); + array_slice($batch, $completedCount), + $info['installs'] + ); } } catch ( LSCMException $e ) { - Logger::uiError($e->getMessage() . ' Stopping mass operation.'); + Logger::uiError( + $e->getMessage() . ' Stopping mass operation.' + ); $info['installs'] = array(); } @@ -877,10 +1148,15 @@ public function massEnableDisable( $action, $step ) } $msgs = $this->wpInstallStorage->getAllCmdMsgs(); - $errMsgs = array_merge($msgs['fail'], $msgs['err'], - Logger::getUiMsgs(Logger::UI_ERR)); - $succMsgs = array_merge($msgs['succ'], - Logger::getUiMsgs(Logger::UI_SUCC)); + $errMsgs = array_merge( + $msgs['fail'], + $msgs['err'], + Logger::getUiMsgs(Logger::UI_ERR) + ); + $succMsgs = array_merge( + $msgs['succ'], + Logger::getUiMsgs(Logger::UI_SUCC) + ); $ajaxReturn = array( 'completed' => $completedCount, @@ -907,6 +1183,8 @@ public function massEnableDisable( $action, $step ) * * @param int $step Value of 2 will prep session info, 3 will begin * changing installed LSCWP versions in batches. + * @return void + * @throws LSCMException Thrown indirectly. */ public function prepVersionChange( $step ) { @@ -928,7 +1206,7 @@ public function prepVersionChange( $step ) /** * Version list should not be empty */ - return 0; + return; } $info = array( @@ -941,7 +1219,9 @@ public function prepVersionChange( $step ) $completedCount = -1; if ( !isset($info['installs']) ) { - Logger::uiError('Expected session data missing! Stopping mass operation.'); + Logger::uiError( + 'Expected session data missing! Stopping mass operation.' + ); } else { $batchSize = $this->getBatchSize($info['installs']); @@ -956,27 +1236,36 @@ public function prepVersionChange( $step ) try { $finishedList = $this->wpInstallStorage->doAction( - UserCommand::CMD_MASS_UPGRADE, $batch, $extraArgs); + UserCommand::CMD_MASS_UPGRADE, + $batch, + $extraArgs + ); $completedCount = count($finishedList); if ( $completedCount != $batchSize ) { $info['installs'] = array_merge( - array_slice($batch, $completedCount), - $info['installs']); + array_slice($batch, $completedCount), + $info['installs'] + ); } } catch ( LSCMException $e ) { - Logger::uiError($e->getMessage() . ' Stopping mass operation.'); + Logger::uiError( + $e->getMessage() . ' Stopping mass operation.' + ); $info['installs'] = array(); } } $msgs = $this->wpInstallStorage->getAllCmdMsgs(); - $errMsgs = array_merge($msgs['fail'], $msgs['err'], - Logger::getUiMsgs(Logger::UI_ERR)); + $errMsgs = array_merge( + $msgs['fail'], + $msgs['err'], + Logger::getUiMsgs(Logger::UI_ERR) + ); $ajaxReturn = array( 'completed' => $completedCount, @@ -994,7 +1283,8 @@ public function prepVersionChange( $step ) /** * - * @return boolean + * @return bool + * @throws LSCMException Thrown indirectly. */ protected function checkDashMassNotifyAction() { @@ -1027,7 +1317,9 @@ protected function checkDashMassNotifyAction() $completedCount = -1; if ( !isset($info['installs']) ) { - Logger::uiError('Expected session data missing! Stopping mass operation.'); + Logger::uiError( + 'Expected session data missing! Stopping mass operation.' + ); } else { $batchSize = $this->getBatchSize($info['installs']); @@ -1038,19 +1330,25 @@ protected function checkDashMassNotifyAction() try { $finishedList = $this->wpInstallStorage->doAction( - UserCommand::CMD_MASS_DASH_NOTIFY, $batch, - array($msgInfoJSON)); + UserCommand::CMD_MASS_DASH_NOTIFY, + $batch, + array($msgInfoJSON) + ); $completedCount = count($finishedList); if ( $completedCount != $batchSize ) { $info['installs'] = array_merge( - array_slice($batch, $completedCount), $info['installs']); + array_slice($batch, $completedCount), + $info['installs'] + ); } } catch ( LSCMException $e ) { - Logger::uiError($e->getMessage() . ' Stopping mass operation.'); + Logger::uiError( + $e->getMessage() . ' Stopping mass operation.' + ); $info['installs'] = array(); } @@ -1084,10 +1382,15 @@ protected function checkDashMassNotifyAction() } $msgs = $this->wpInstallStorage->getAllCmdMsgs(); - $errMsgs = array_merge($msgs['fail'], $msgs['err'], - Logger::getUiMsgs(Logger::UI_ERR)); - $succMsgs = array_merge($msgs['succ'], - Logger::getUiMsgs(Logger::UI_SUCC)); + $errMsgs = array_merge( + $msgs['fail'], + $msgs['err'], + Logger::getUiMsgs(Logger::UI_ERR) + ); + $succMsgs = array_merge( + $msgs['succ'], + Logger::getUiMsgs(Logger::UI_SUCC) + ); $ajaxInfo = array( 'completed' => $completedCount, @@ -1112,6 +1415,7 @@ protected function checkDashMassNotifyAction() /** * * @return boolean + * @throws LSCMException Thrown indirectly. */ protected function checkDashMassDisableAction() { @@ -1141,7 +1445,9 @@ protected function checkDashMassDisableAction() $completedCount = -1; if ( !isset($info['installs']) ) { - Logger::uiError('Expected session data missing! Stopping mass operation.'); + Logger::uiError( + 'Expected session data missing! Stopping mass operation.' + ); } else { $batchSize = $this->getBatchSize($info['installs']); @@ -1151,18 +1457,24 @@ protected function checkDashMassDisableAction() try { $finishedList = $this->wpInstallStorage->doAction( - UserCommand::CMD_MASS_DASH_DISABLE, $batch); + UserCommand::CMD_MASS_DASH_DISABLE, + $batch + ); $completedCount = count($finishedList); if ( $completedCount != $batchSize ) { $info['installs'] = array_merge( - array_slice($batch, $completedCount), $info['installs']); + array_slice($batch, $completedCount), + $info['installs'] + ); } } catch ( LSCMException $e ) { - Logger::uiError($e->getMessage() . ' Stopping mass operation.'); + Logger::uiError( + $e->getMessage() . ' Stopping mass operation.' + ); $info['installs'] = array(); } @@ -1196,10 +1508,15 @@ protected function checkDashMassDisableAction() } $msgs = $this->wpInstallStorage->getAllCmdMsgs(); - $errMsgs = array_merge($msgs['fail'], $msgs['err'], - Logger::getUiMsgs(Logger::UI_ERR)); - $succMsgs = array_merge($msgs['succ'], - Logger::getUiMsgs(Logger::UI_SUCC)); + $errMsgs = array_merge( + $msgs['fail'], + $msgs['err'], + Logger::getUiMsgs(Logger::UI_ERR) + ); + $succMsgs = array_merge( + $msgs['succ'], + Logger::getUiMsgs(Logger::UI_SUCC) + ); $ajaxInfo = array( 'completed' => $completedCount, diff --git a/dist/add-ons/webcachemgr/src/View/AjaxView.php b/dist/add-ons/webcachemgr/src/View/AjaxView.php index 8b6269bf6..419ee9323 100644 --- a/dist/add-ons/webcachemgr/src/View/AjaxView.php +++ b/dist/add-ons/webcachemgr/src/View/AjaxView.php @@ -1,9 +1,10 @@ array( + 'sort' => 'disabled', + 'state' => '', + 'btn_content' => '', + 'btn_title' => 'Click to enable LSCache', + 'onclick' => 'onclick="javascript:lscwpEnableSingle(this);"', + 'btn_attributes' => 'data-uk-tooltip', + 'btn_state' => '' + ), + 'enabled' => array( + 'sort' => 'enabled', + 'state' => '', + 'btn_content' => '', + 'btn_title' => 'Click to disable LSCache', + 'onclick' => 'onclick="javascript:lscwpDisableSingle(this);"', + 'btn_attributes' => 'data-uk-tooltip', + 'btn_state' => '' + ), + 'adv_cache' => array( + 'sort' => 'warning', + 'state' => '', + 'btn_content' => '', + 'btn_title' => 'Click to disable LSCache', + 'onclick' => 'onclick="javascript:lscwpDisableSingle(this);"', + 'btn_attributes' => 'data-uk-tooltip', + 'btn_state' => '' + ), + 'disabled_no_active_ver' => array( + 'sort' => 'disabled', + 'state' => '', + 'btn_content' => '' + . '', + 'onclick' => '', + 'btn_attributes' => '', + 'btn_state' => 'disabled', + ), + 'error' => array( + 'sort' => 'error', + /** + * 'state' added individually later. + */ + 'btn_title' => '', + 'btn_content' => '', + 'onclick' => '', + 'btn_attributes' => '', + 'btn_state' => 'disabled' + ) + ); + + /** + * @since 1.13.3 + * @var string[][] + */ + protected $flagInfo = array( + 'unflagged' => array( + 'sort' => 'unflagged', + 'icon' => '' + . '', + 'btn_title' => 'Click to set flag', + 'onclick' => 'onclick="javascript:lscwpFlagSingle(this);"', + 'btn_attributes' => 'data-uk-tooltip' + ), + 'flagged' => array( + 'sort' => 'flagged', + 'icon' => '' + . '', + 'btn_title' => 'Click to unset flag', + 'onclick' => 'onclick="javascript:lscwpUnflagSingle(this);"', + 'btn_attributes' => 'data-uk-tooltip' + ), + ); + /** * * @param WPInstallStorage $wpInstallStorage @@ -112,13 +202,14 @@ protected function setBtnDataAndListVisibility() if ( $errStatus == WPInstallStorage::ERR_NOT_EXIST ) { $scanBtnName = 'Scan'; - $msg = 'Start by clicking Scan. This will discover all active WordPress ' - . 'installations and add them to a list below.'; + $msg = 'Start by clicking Scan. This will discover all active ' + . 'WordPress installations and add them to a list below.'; } elseif ( $errStatus == WPInstallStorage::ERR_VERSION_LOW ) { $scanBtnName = 'Scan'; - $msg = 'To further improve Cache Management features in this version, current ' - . 'installations must be re-discovered. Please perform a Scan now.'; + $msg = 'To further improve Cache Management features in this ' + . 'version, current installations must be re-discovered. ' + . 'Please perform a Scan now.'; } else { $msg = 'Scan data could not be read. Please perform a Re-scan.'; @@ -161,8 +252,9 @@ protected function setListAndCountData() foreach ( $wpInstalls as $wpInstall ) { $info = array( 'statusData' => - $this->getStatusDisplayData($wpInstall, $countData), - 'flagData' => $this->getFlagDisplayData($wpInstall, $countData), + $this->getStatusDisplayData($wpInstall, $countData), + 'flagData' => + $this->getFlagDisplayData($wpInstall, $countData), 'siteUrl' => $wpInstall->getData(WPInstall::FLD_SITEURL) ); @@ -183,71 +275,20 @@ protected function setListAndCountData() protected function getStatusDisplayData( WPInstall $wpInstall, &$countData ) { - $statusInfo = array( - 'disabled' => array( - 'sort' => 'disabled', - 'state' => '', - 'btn_content' => '', - 'btn_title' => 'Click to enable LSCache', - 'onclick' => 'onclick="javascript:lscwpEnableSingle(this);"', - 'btn_attributes' => 'data-uk-tooltip', - 'btn_state' => '' - ), - 'enabled' => array( - 'sort' => 'enabled', - 'state' => '', - 'btn_content' => '', - 'btn_title' => 'Click to disable LSCache', - 'onclick' => 'onclick="javascript:lscwpDisableSingle(this);"', - 'btn_attributes' => 'data-uk-tooltip', - 'btn_state' => '' - ), - 'adv_cache' => array( - 'sort' => 'warning', - 'state' => '', - 'btn_content' => '', - 'btn_title' => 'Click to disable LSCache', - 'onclick' => 'onclick="javascript:lscwpDisableSingle(this);"', - 'btn_attributes' => 'data-uk-tooltip', - 'btn_state' => '' - ), - 'disabled_no_active_ver' => array( - 'sort' => 'disabled', - 'state' => '', - 'btn_content' => '', - 'onclick' => '', - 'btn_attributes' => '', - 'btn_state' => 'disabled', - ), - 'error' => array( - 'sort' => 'error', - /** - * 'state' added individually later. - */ - 'btn_title' => '', - 'btn_content' => '', - 'onclick' => '', - 'btn_attributes' => '', - 'btn_state' => 'disabled' - ) - ); - $wpStatus = $wpInstall->getStatus(); if ( $wpInstall->hasFatalError($wpStatus) ) { $countData[self::COUNT_DATA_ERROR]++; - $link = 'https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cpanel:whm-plugin-cache-manager-error-status'; + $link = 'https://www.litespeedtech.com/support/wiki/doku.php/' + . 'litespeed_wiki:cpanel:whm-plugin-cache-manager-error-status'; + + $stateMsg = ''; if ( $wpStatus & WPInstall::ST_ERR_EXECMD ) { - $stateMsg = 'WordPress fatal error encountered during action execution. This is ' - . 'most likely caused by custom code in this WordPress installation.'; + $stateMsg = 'WordPress fatal error encountered during action ' + . 'execution. This is most likely caused by custom code in ' + . 'this WordPress installation.'; $link .= '#fatal_error_encountered_during_action_execution'; } if ( $wpStatus & WPInstall::ST_ERR_EXECMD_DB ) { @@ -263,9 +304,10 @@ protected function getStatusDisplayData( WPInstall $wpInstall, $link .= '#could_not_retrieve_wordpress_siteurl'; } elseif ( $wpStatus & WPInstall::ST_ERR_DOCROOT ) { - $stateMsg = 'Could not match WordPress siteURL to a known control panel ' - . 'docroot.'; - $link .= '#could_not_match_wordpress_siteurl_to_a_known_cpanel_docroot'; + $stateMsg = 'Could not match WordPress siteURL to a known ' + . 'control panel docroot.'; + $link .= '#could_not_match_wordpress_siteurl_to_a_known_' + . 'cpanel_docroot'; } elseif ( $wpStatus & WPInstall::ST_ERR_WPCONFIG ) { $stateMsg = 'Could not find a valid wp-config.php file.'; @@ -274,10 +316,10 @@ protected function getStatusDisplayData( WPInstall $wpInstall, $stateMsg .= ' Click for more information.'; - $currStatusData = $statusInfo['error']; - $currStatusData['state'] = - ""; + $currStatusData = $this->statusInfo['error']; + $currStatusData['state'] = "'; } elseif ( ($wpStatus & WPInstall::ST_PLUGIN_INACTIVE ) ) { $countData[self::COUNT_DATA_DISABLED]++; @@ -285,19 +327,19 @@ protected function getStatusDisplayData( WPInstall $wpInstall, $currVer = $this->getTplData(self::FLD_ACTIVE_VER); if ( $currVer == false ) { - $currStatusData = $statusInfo['disabled_no_active_ver']; + $currStatusData = $this->statusInfo['disabled_no_active_ver']; } else { - $currStatusData = $statusInfo['disabled']; + $currStatusData = $this->statusInfo['disabled']; } } elseif ( !($wpStatus & WPInstall::ST_LSC_ADVCACHE_DEFINED) ) { $countData[self::COUNT_DATA_WARN]++; - $currStatusData = $statusInfo['adv_cache']; + $currStatusData = $this->statusInfo['adv_cache']; } else { $countData[self::COUNT_DATA_ENABLED]++; - $currStatusData = $statusInfo['enabled']; + $currStatusData = $this->statusInfo['enabled']; } return $currStatusData; @@ -311,32 +353,15 @@ protected function getStatusDisplayData( WPInstall $wpInstall, */ protected function getFlagDisplayData( WPInstall $wpInstall, &$countData ) { - $flagInfo = array( - 0 => array( - 'sort' => 'unflagged', - 'icon' => '', - 'btn_title' => 'Click to set flag', - 'onclick' => 'onclick="javascript:lscwpFlagSingle(this);"', - 'btn_attributes' => 'data-uk-tooltip' - ), - 1 => array( - 'sort' => 'flagged', - 'icon' => '', - 'btn_title' => 'Click to unset flag', - 'onclick' => 'onclick="javascript:lscwpUnflagSingle(this);"', - 'btn_attributes' => 'data-uk-tooltip' - ), - ); - $wpStatus = $wpInstall->getStatus(); if ( ($wpStatus & WPInstall::ST_FLAGGED ) ) { $countData[self::COUNT_DATA_FLAGGED]++; - $currFlagData = $flagInfo[1]; + $currFlagData = $this->flagInfo['flagged']; } else { $countData[self::COUNT_DATA_UNFLAGGED]++; - $currFlagData = $flagInfo[0]; + $currFlagData = $this->flagInfo['unflagged']; } return $currFlagData; @@ -350,13 +375,17 @@ protected function setActiveVerData() } catch ( LSCMException $e ) { - Logger::debug($e->getMessage() . ' Could not get active LSCWP version.'); - - $displayWarning = 'Active LiteSpeed Cache Plugin version is not set. Enable operations ' - . 'cannot be performed. Please got to ' - . '' - . 'Version Manager to select a version.'; - Logger::uiWarning($displayWarning); + Logger::debug( + $e->getMessage() . ' Could not get active LSCWP version.' + ); + + Logger::uiWarning( + 'Active LiteSpeed Cache Plugin version is not set. Enable ' + . 'operations cannot be performed. Please go to ' + . 'Version Manager to ' + . 'select a version.' + ); $currVer = false; } @@ -369,10 +398,15 @@ protected function setMsgData() $msgs = $this->wpInstallStorage->getAllCmdMsgs(); $infoMsgs = Logger::getUiMsgs(Logger::UI_INFO); - $succMsgs = array_merge($msgs['succ'], - Logger::getUiMsgs(Logger::UI_SUCC)); - $errMsgs = array_merge($msgs['fail'], $msgs['err'], - Logger::getUiMsgs(Logger::UI_ERR)); + $succMsgs = array_merge( + $msgs['succ'], + Logger::getUiMsgs(Logger::UI_SUCC) + ); + $errMsgs = array_merge( + $msgs['fail'], + $msgs['err'], + Logger::getUiMsgs(Logger::UI_ERR) + ); $warnMsgs = Logger::getUiMsgs(Logger::UI_WARN); $this->tplData[self::FLD_INFO_MSGS] = $infoMsgs; diff --git a/dist/add-ons/webcachemgr/src/View/Model/ScanProgressStepViewModel.php b/dist/add-ons/webcachemgr/src/View/Model/ScanProgressStepViewModel.php new file mode 100644 index 000000000..c87ee1743 --- /dev/null +++ b/dist/add-ons/webcachemgr/src/View/Model/ScanProgressStepViewModel.php @@ -0,0 +1,193 @@ +mgrStep = $this->tplData[self::FLD_MGR_STEP] = $mgrStep; + + $this->init(); + } + + /** + * + * @since 1.13.3 + * + * @throws LSCMException Thrown indirectly. + */ + protected function init() + { + $this->setTitle(); + $this->setIconPath(); + $this->grabSessionData(); + } + + /** + * + * @since 1.13.3 + * + * @param string $field + * @return null|int|string + */ + public function getTplData( $field ) + { + if ( !isset($this->tplData[$field]) ) { + return null; + } + + return $this->tplData[$field]; + } + + /** + * + * @since 1.13.3 + */ + protected function setTitle() + { + + if ( $this->mgrStep == self::OP_SCAN ) { + $title = 'Scanning/Re-scanning For All WordPress Installations...'; + } + else { + $title = 'Discovering New WordPress Installations...'; + } + + $this->tplData[self::FLD_TITLE] = $title; + } + + /** + * + * @since 1.13.3 + * + * @throws LSCMException Thrown indirectly. + */ + protected function setIconPath() + { + $iconPath = ''; + + try + { + $iconDir = Context::getOption()->getIconDir(); + $iconPath = "{$iconDir}/manageCacheInstallations.svg"; + } + catch ( LSCMException $e ) + { + Logger::debug($e->getMessage() . ' Could not get icon directory.'); + } + + $this->tplData[self::FLD_ICON] = $iconPath; + } + + /** + * + * @since 1.13.3 + */ + protected function grabSessionData() + { + $info = $_SESSION['scanInfo']; + + if ( !empty($info['homeDirs']) ) { + $total = count($info['homeDirs']); + } + else { + $total = count($info['installs']); + } + + $this->tplData[self::FLD_TOTAL_COUNT] = $total; + } + + /** + * + * @since 1.13.3 + * + * @return string + * @throws LSCMException Thrown indirectly. + */ + public function getTpl() + { + $info = $_SESSION['scanInfo']; + + if ( !empty($info['homeDirs']) ) { + return Context::getOption()->getSharedTplDir() + . '/ScanProgressStep1.tpl'; + } + else { + return Context::getOption()->getSharedTplDir() + . '/ScanProgressStep2.tpl'; + } + } + +} diff --git a/dist/add-ons/webcachemgr/src/View/Model/ScanProgressViewModel.php b/dist/add-ons/webcachemgr/src/View/Model/ScanProgressViewModel.php index c54d47024..f3f4d9a2b 100644 --- a/dist/add-ons/webcachemgr/src/View/Model/ScanProgressViewModel.php +++ b/dist/add-ons/webcachemgr/src/View/Model/ScanProgressViewModel.php @@ -1,9 +1,11 @@ init(); } + /** + * + * @throws LSCMException Thrown indirectly. + */ protected function init() { $this->setTitle(); @@ -76,6 +88,10 @@ protected function setTitle() $this->tplData[self::FLD_TITLE] = $title; } + /** + * + * @throws LSCMException Thrown indirectly. + */ protected function setIconPath() { $iconPath = ''; @@ -100,6 +116,11 @@ protected function grabSessionData() $this->tplData[self::FLD_HOME_DIR_COUNT] = count($info['homeDirs']); } + /** + * + * @return string + * @throws LSCMException Thrown indirectly. + */ public function getTpl() { return Context::getOption()->getSharedTplDir() . '/ScanProgress.tpl'; diff --git a/dist/add-ons/webcachemgr/src/View/Tpl/ScanProgress.tpl b/dist/add-ons/webcachemgr/src/View/Tpl/ScanProgress.tpl index 21ae08153..ed9adc647 100644 --- a/dist/add-ons/webcachemgr/src/View/Tpl/ScanProgress.tpl +++ b/dist/add-ons/webcachemgr/src/View/Tpl/ScanProgress.tpl @@ -1,5 +1,11 @@ viewModel->getTplData(ViewModel::FLD_TITLE); diff --git a/dist/add-ons/webcachemgr/src/View/Tpl/ScanProgressStep1.tpl b/dist/add-ons/webcachemgr/src/View/Tpl/ScanProgressStep1.tpl new file mode 100644 index 000000000..ebded7227 --- /dev/null +++ b/dist/add-ons/webcachemgr/src/View/Tpl/ScanProgressStep1.tpl @@ -0,0 +1,69 @@ +viewModel->getTplData(ViewModel::FLD_TITLE); +$icon = $this->viewModel->getTplData(ViewModel::FLD_ICON); +$totalCount = $this->viewModel->getTplData(ViewModel::FLD_TOTAL_COUNT); +$mgrStep = $this->viewModel->getTplData(ViewModel::FLD_MGR_STEP); + +$d = array( + 'title' => $title, + 'icon' => $icon +); +$this->loadTplBlock('Title.tpl', $d); + +?> + +
+ Scanning 0 out of + ... +
+ +
+ Currently scanning known document roots for all WordPress Installations. +
+ If performing a Scan/Re-scan, all installations will be found and + added to the Cache Manager list. +
+ If Discovering New, only installations belonging to users not already + in the Cache Manager list will be discovered. +
+
+ + 'Back', + 'backDo' => 'lscwp_manage', + 'visibility' => 'hidden' +); +$this->loadTplBlock('ButtonPanelBackNext.tpl', $d); + +?> + + +
+ + 'errMsgs', + 'class' => 'scrollable', + ); + $this->loadTplBlock('DivMsgBox.tpl', $d); + + ?> + +
+ + + \ No newline at end of file diff --git a/dist/add-ons/webcachemgr/src/View/Tpl/ScanProgressStep2.tpl b/dist/add-ons/webcachemgr/src/View/Tpl/ScanProgressStep2.tpl new file mode 100644 index 000000000..78dbd6934 --- /dev/null +++ b/dist/add-ons/webcachemgr/src/View/Tpl/ScanProgressStep2.tpl @@ -0,0 +1,70 @@ +viewModel->getTplData(ViewModel::FLD_TITLE); +$icon = $this->viewModel->getTplData(ViewModel::FLD_ICON); +$totalCount = $this->viewModel->getTplData(ViewModel::FLD_TOTAL_COUNT); +$mgrStep = $this->viewModel->getTplData(ViewModel::FLD_MGR_STEP); + +$d = array( + 'title' => $title, + 'icon' => $icon +); +$this->loadTplBlock('Title.tpl', $d); + +?> + +
+ Scanning 0 out of + ... +
+ +
+ Currently attempting to refresh status for all WordPress installations found + in the previous discovery step. +
+ If performing a Scan/Re-scan, all installations will be found and + added to the Cache Manager list. +
+ If Discovering New, only installations belonging to users not already + in the Cache Manager list will be discovered. +
+
+ + 'Back', + 'backDo' => 'lscwp_manage', + 'visibility' => 'hidden' +); +$this->loadTplBlock('ButtonPanelBackNext.tpl', $d); + +?> + + +
+ + 'errMsgs', + 'class' => 'scrollable', + ); + $this->loadTplBlock('DivMsgBox.tpl', $d); + + ?> + +
+ + + \ No newline at end of file diff --git a/dist/add-ons/webcachemgr/src/WPCaller.php b/dist/add-ons/webcachemgr/src/WPCaller.php index 4acb954a4..e1890ef6b 100644 --- a/dist/add-ons/webcachemgr/src/WPCaller.php +++ b/dist/add-ons/webcachemgr/src/WPCaller.php @@ -262,7 +262,10 @@ private function checkStatus( WPInstall $install ) if ( $install->getDocRoot() == null ) { if ( ($siteUrl = $this->getSiteURL()) === '' ) { - Logger::uiError('Could not retrieve siteURL to match against known docroots.'); + Logger::uiError( + 'Could not retrieve siteURL to match against known ' + . 'docroots.' + ); $install->addUserFlagFile(); return (WPInstall::ST_ERR_SITEURL | WPInstall::ST_FLAGGED); diff --git a/dist/add-ons/webcachemgr/src/WPInstall.php b/dist/add-ons/webcachemgr/src/WPInstall.php index 7ac5d76c6..1f483cf6d 100644 --- a/dist/add-ons/webcachemgr/src/WPInstall.php +++ b/dist/add-ons/webcachemgr/src/WPInstall.php @@ -16,22 +16,89 @@ class WPInstall { + /** + * @var int + */ const ST_PLUGIN_ACTIVE = 1; + + /** + * @var int + */ const ST_PLUGIN_INACTIVE = 2; + + /** + * @var int + */ const ST_LSC_ADVCACHE_DEFINED = 4; + + /** + * @var int + */ const ST_FLAGGED = 8; + + /** + * @var int + */ const ST_ERR_SITEURL = 16; + + /** + * @var int + */ const ST_ERR_DOCROOT = 32; + + /** + * @var int + */ const ST_ERR_EXECMD = 64; + + /** + * @var int + */ const ST_ERR_TIMEOUT = 128; + + /** + * @var int + */ const ST_ERR_EXECMD_DB = 256; + + /** + * @var int + */ const ST_ERR_WPCONFIG = 1024; + + /** + * @var int + */ const ST_ERR_REMOVE = 2048; + + /** + * @var string + */ const FLD_STATUS = 'status'; + + /** + * @var string + */ const FLD_DOCROOT = 'docroot'; + + /** + * @var string + */ const FLD_SERVERNAME = 'server_name'; + + /** + * @var string + */ const FLD_SITEURL = 'site_url'; + + /** + * @var string + */ const FLAG_FILE = '.litespeed_flag'; + + /** + * @var string + */ const FLAG_NEW_LSCWP = '.lscm_new_lscwp'; /** @@ -120,9 +187,13 @@ protected function init( $path ) */ public function __toString() { - return sprintf("%s (status=%d docroot=%s siteurl=%s)", $this->path, - $this->data[self::FLD_STATUS], $this->data[self::FLD_DOCROOT], - $this->data[self::FLD_SITEURL]); + return sprintf( + "%s (status=%d docroot=%s siteurl=%s)", + $this->path, + $this->data[self::FLD_STATUS], + $this->data[self::FLD_DOCROOT], + $this->data[self::FLD_SITEURL] + ); } /** @@ -278,17 +349,15 @@ public function hasNewLscwpFlagFile() /** * * @return boolean - * @throws LSCMException Indirectly thrown by Logger::uiError(), - * Logger::notice(), $this->addUserFlagFile(), and - * Logger::debug(). + * @throws LSCMException Thrown indirectly. */ public function hasValidPath() { if ( !is_dir($this->path) || !is_dir("{$this->path}/wp-admin") ) { $this->setStatusBit(self::ST_ERR_REMOVE); - $msg = "{$this->path} - Could not be found and has been removed from Cache " - . 'Manager list.'; + $msg = "{$this->path} - Could not be found and has been removed " + . 'from Cache Manager list.'; Logger::uiError($msg); Logger::notice($msg); } @@ -296,9 +365,10 @@ public function hasValidPath() $this->setStatusBit(self::ST_ERR_WPCONFIG); $this->addUserFlagFile(false); - $msg = "{$this->path} - Could not find a valid wp-config.php file. Install has been " - . "flagged."; - Logger::debug($msg); + $msg = "{$this->path} - Could not find a valid wp-config.php file. " + . 'Install has been flagged.'; + Logger::uiError($msg); + Logger::error($msg); } else { return true; @@ -392,8 +462,12 @@ public function populateDataFromUrl( $url ) $serverName = strtolower($info['host']); $this->setData(self::FLD_SERVERNAME, $serverName); - $siteUrlTrim = - isset($info['path']) ? "{$info['host']}{$info['path']}" : $info['host']; + $siteUrlTrim = $info['host']; + + if ( isset($info['path']) ) { + $siteUrlTrim .= $info['path']; + } + $this->setData(self::FLD_SITEURL, $siteUrlTrim); $docRoot = ControlPanel::getClassInstance()->mapDocRoot($serverName); @@ -403,8 +477,8 @@ public function populateDataFromUrl( $url ) $this->setStatus(self::ST_ERR_DOCROOT); $this->addUserFlagFile(false); - $msg = "{$this->path} - Could not find matching document root for WP " - . "siteurl/servername {$serverName}."; + $msg = "{$this->path} - Could not find matching document root for " + . "WP siteurl/servername {$serverName}."; $this->setCmdStatusAndMsg(UserCommand::EXIT_ERROR, $msg); Logger::error($msg); @@ -420,6 +494,7 @@ public function populateDataFromUrl( $url ) * @deprecated * @param string $siteUrl * @return boolean + * @throws LSCMException Thrown indirectly. */ public function setSiteUrl( $siteUrl ) { @@ -431,8 +506,7 @@ public function setSiteUrl( $siteUrl ) * * @param boolean $runningAsUser * @return boolean True when install has a flag file created/already. - * @throws LSCMException Indirectly thrown by - * Context::getFlagFileContent(). + * @throws LSCMException Thrown indirectly. */ public function addUserFlagFile( $runningAsUser = true ) { @@ -523,7 +597,7 @@ public function removeNewLscwpFlagFile() * * @param boolean $forced * @return int - * @throws LSCMException Indirectly thrown by UserCommand::issue(). + * @throws LSCMException Thrown indirectly. */ public function refreshStatus( $forced = false ) { @@ -538,14 +612,15 @@ public function refreshStatus( $forced = false ) /** * * @param string $pluginDir + * @throws LSCMException Thrown indirectly. */ public function removePluginFiles( $pluginDir ) { if ( file_exists(dirname($pluginDir)) && file_exists($pluginDir) ) { exec("rm -rf {$pluginDir}"); - $msg = "{$this->path} - Removed LSCache for WordPress plugin files from plugins " - . 'directory'; + $msg = "{$this->path} - Removed LSCache for WordPress plugin files " + . 'from plugins directory'; Logger::debug($msg); } } @@ -564,7 +639,7 @@ public function isFlagBitSet() /** * * @param null|int $status - * @return boolean + * @return bool */ public function hasFatalError( $status = null ) { @@ -573,22 +648,20 @@ public function hasFatalError( $status = null ) } $errMask = (self::ST_ERR_EXECMD - | self::ST_ERR_EXECMD_DB - | self::ST_ERR_TIMEOUT - | self::ST_ERR_SITEURL - | self::ST_ERR_DOCROOT - | self::ST_ERR_WPCONFIG); - - $fatal = ($status & $errMask) > 0; + | self::ST_ERR_EXECMD_DB + | self::ST_ERR_TIMEOUT + | self::ST_ERR_SITEURL + | self::ST_ERR_DOCROOT + | self::ST_ERR_WPCONFIG + ); - return $fatal; + return (($status & $errMask) > 0); } /** * * @return string - * @throws LSCMException Indirectly thrown by - * ControlPanel::getClassInstance(). + * @throws LSCMException Thrown indirectly. */ public function getPhpBinary() { diff --git a/dist/add-ons/webcachemgr/src/WPInstallStorage.php b/dist/add-ons/webcachemgr/src/WPInstallStorage.php index bf976f372..7b1f5ab51 100644 --- a/dist/add-ons/webcachemgr/src/WPInstallStorage.php +++ b/dist/add-ons/webcachemgr/src/WPInstallStorage.php @@ -25,10 +25,23 @@ class WPInstallStorage const CMD_ADD_CUST_WPINSTALLS = 'addCustWPInstalls'; /** + * @since 1.13.3 + * @var string + */ + const CMD_ADD_NEW_WPINSTALL = 'addNewWPInstall'; + + /** + * @deprecated 1.13.3 Use CMD_DISCOVER_NEW2 instead. * @var string */ const CMD_DISCOVER_NEW = 'discoverNew'; + /** + * @since 1.13.3 + * @var string + */ + const CMD_DISCOVER_NEW2 = 'discoverNew2'; + /** * @var string */ @@ -40,10 +53,17 @@ class WPInstallStorage const CMD_MASS_UNFLAG = 'mass_unflag'; /** + * @deprecated 1.13.3 Use CMD_SCAN2 instead for now. * @var string */ const CMD_SCAN = 'scan'; + /** + * @since 1.13.3 + * @var string + */ + const CMD_SCAN2 = 'scan2'; + /** * @var string */ @@ -134,9 +154,10 @@ protected function init() if ( $this->customDataFile != '' && file_exists($this->customDataFile) ) { + $dataExists = true; $this->custWpInstalls = - $this->getDataFileData($this->customDataFile); + $this->getDataFileData($this->customDataFile); } } catch ( LSCMException $e ) { @@ -174,7 +195,10 @@ protected function getDataFileData( $dataFile ) } if ( ($err = $this->verifyDataFileVer($dataFile, $data['__VER__'])) ) { - throw new LSCMException("{$dataFile} - Data file version issue.", $err); + throw new LSCMException( + "{$dataFile} - Data file version issue.", + $err + ); } unset($data['__VER__']); @@ -201,7 +225,7 @@ public function getError() /** * - * @param boolean $nonFatalOnly + * @param bool $nonFatalOnly * @return int */ public function getCount( $nonFatalOnly = false ) @@ -399,7 +423,10 @@ protected function verifyDataFileVer( $dataFile, $dataFileVer ) $res = version_compare($dataFileVer, self::DATA_VERSION); if ( $res == 1 ) { - Logger::info('Data file version is higher than expected and cannot be used.'); + Logger::info( + 'Data file version is higher than expected and cannot be used.' + ); + return self::ERR_VERSION_HIGH; } @@ -414,12 +441,15 @@ protected function verifyDataFileVer( $dataFile, $dataFileVer ) * * @param string $dataFile * @param string $dataFileVer - * @return boolean + * @return bool * @throws LSCMException Thrown indirectly. */ public static function updateDataFile( $dataFile, $dataFileVer ) { - Logger::info("{$dataFile} - Old data file version detected. Attempting to update..."); + Logger::info( + "{$dataFile} - Old data file version detected. Attempting to " + . 'update...' + ); /** * Currently no versions are upgradeable to 1.5 @@ -429,9 +459,10 @@ public static function updateDataFile( $dataFile, $dataFileVer ) if ( ! in_array($dataFileVer, $updatableVersions) || ! Util::createBackup($dataFile) ) { - $msg = "{$dataFile} - Data file could not be updated to version " - . self::DATA_VERSION; - Logger::error($msg); + Logger::error( + "{$dataFile} - Data file could not be updated to version " + . self::DATA_VERSION + ); return false; } @@ -445,7 +476,7 @@ public static function updateDataFile( $dataFile, $dataFileVer ) /** * - * @param string $action + * @param string $action * @return string[] * @throws LSCMException Thrown indirectly. */ @@ -453,7 +484,9 @@ protected function prepareActionItems( $action ) { switch ($action) { case self::CMD_SCAN: + case self::CMD_SCAN2: case self::CMD_DISCOVER_NEW: + case self::CMD_DISCOVER_NEW2: try { @@ -461,9 +494,10 @@ protected function prepareActionItems( $action ) } catch ( LSCMException $e ) { - $msg = $e->getMessage() - . " Could not prepare {$action} action items."; - throw new LSCMException($msg); + throw new LSCMException( + $e->getMessage() + . " Could not prepare {$action} action items." + ); } case UserCommand::CMD_MASS_ENABLE: @@ -501,12 +535,16 @@ protected function doWPInstallAction( $action, $path, $extraArgs ) } if ( $wpInstall->addUserFlagFile(false) ) { - $msg = 'Flag file set'; - $wpInstall->setCmdStatusAndMsg(UserCommand::EXIT_SUCC, $msg); + $wpInstall->setCmdStatusAndMsg( + UserCommand::EXIT_SUCC, + 'Flag file set' + ); } else { - $msg = 'Could not create flag file'; - $wpInstall->setCmdStatusAndMsg(UserCommand::EXIT_FAIL, $msg); + $wpInstall->setCmdStatusAndMsg( + UserCommand::EXIT_FAIL, + 'Could not create flag file' + ); } $this->workingQueue[$path] = $wpInstall; @@ -522,8 +560,10 @@ protected function doWPInstallAction( $action, $path, $extraArgs ) $wpInstall->removeFlagFile(); - $msg = 'Flag file unset'; - $wpInstall->setCmdStatusAndMsg(UserCommand::EXIT_SUCC, $msg); + $wpInstall->setCmdStatusAndMsg( + UserCommand::EXIT_SUCC, + 'Flag file unset' + ); $this->workingQueue[$path] = $wpInstall; @@ -540,9 +580,10 @@ protected function doWPInstallAction( $action, $path, $extraArgs ) if ( $wpInstall->hasFatalError() ) { $wpInstall->addUserFlagFile(false); - $msg = 'Install skipped and flagged due to Error status.'; - $wpInstall->setCmdStatusAndMsg(UserCommand::EXIT_FAIL, - $msg); + $wpInstall->setCmdStatusAndMsg( + UserCommand::EXIT_FAIL, + 'Install skipped and flagged due to Error status.' + ); $this->workingQueue[$path] = $wpInstall; @@ -557,8 +598,10 @@ protected function doWPInstallAction( $action, $path, $extraArgs ) PluginVersion::getInstance()->getAllowedVersions(); if ( !in_array($extraArgs[1], $allowedVers) ) { - throw new LSCMException('Selected LSCWP version (' - . htmlspecialchars($extraArgs[1]) . ') is invalid.'); + throw new LSCMException( + 'Selected LSCWP version (' + . htmlspecialchars($extraArgs[1]) . ') is invalid.' + ); } break; @@ -573,8 +616,10 @@ protected function doWPInstallAction( $action, $path, $extraArgs ) $this->syncToDisk(); - throw new LSCMException('Could not download version ' - . htmlspecialchars($extraArgs[1]) . '.'); + throw new LSCMException( + 'Could not download version ' + . htmlspecialchars($extraArgs[1]) . '.' + ); } if ( $action = UserCommand::CMD_MASS_ENABLE @@ -592,9 +637,9 @@ protected function doWPInstallAction( $action, $path, $extraArgs ) /** * - * @param string $action - * @param null|string[] $list - * @param string[] $extraArgs + * @param string $action + * @param null|string[] $list + * @param string[]|string[][] $extraArgs * @return string[] * @throws LSCMException Thrown indirectly. */ @@ -612,9 +657,11 @@ public function doAction( $action, $list, $extraArgs = array() ) switch ( $action ) { case self::CMD_SCAN: + case self::CMD_DISCOVER_NEW: + $forceRefresh = ($action == self::CMD_SCAN); foreach ( $list as $path ) { - $this->scan($path, true); + $this->scan($path, $forceRefresh); $finishedList[] = $path; @@ -625,10 +672,10 @@ public function doAction( $action, $list, $extraArgs = array() ) break; - case self::CMD_DISCOVER_NEW: + case self::CMD_ADD_NEW_WPINSTALL: - foreach ( $list as $path ) { - $this->scan($path); + foreach ( $list as $path) { + $this->addNewWPInstall($path); $finishedList[] = $path; @@ -648,7 +695,7 @@ public function doAction( $action, $list, $extraArgs = array() ) default: if ( $action == UserCommand::CMD_ENABLE - || $action == UserCommand::CMD_MASS_ENABLE ) { + || $action == UserCommand::CMD_MASS_ENABLE ) { /** * Ensure that current version is locally downloaded. @@ -670,7 +717,7 @@ public function doAction( $action, $list, $extraArgs = array() ) $this->syncToDisk(); - if ( $action == self::CMD_SCAN ) { + if ( $action == self::CMD_SCAN || $action == self::CMD_SCAN2 ) { /** * Explicitly clear any data file errors after scanning in case of * multiple actions performed in the same process (cli). @@ -683,8 +730,10 @@ public function doAction( $action, $list, $extraArgs = array() ) /** * - * @param string $docroot - * @param boolean $forceRefresh + * @deprecated 1.13.3 Use $this->scan2() instead. + * + * @param string $docroot + * @param bool $forceRefresh * @return void * @throws LSCMException Thrown indirectly. */ @@ -700,9 +749,13 @@ protected function scan( $docroot, $forceRefresh = false ) * /home/user/public_html/blog/wp-admin * /home/user/public_html/wp/wp-admin */ - if ( !preg_match_all("|{$docroot}(.*)(?=/wp-admin)|", $directories, - $matches) ) { + $hasMatches = preg_match_all( + "|{$docroot}(.*)(?=/wp-admin)|", + $directories, + $matches + ); + if ( ! $hasMatches ) { /** * Nothing found. */ @@ -716,19 +769,28 @@ protected function scan( $docroot, $forceRefresh = false ) if ( !isset($this->wpInstalls[$wp_path]) ) { $this->wpInstalls[$wp_path] = new WPInstall($wp_path); $refresh = true; - $this->log("New installation found: {$wp_path}", Logger::L_INFO); + $this->log( + "New installation found: {$wp_path}", + Logger::L_INFO + ); if ( $this->custWpInstalls != null && isset($this->custWpInstalls[$wp_path]) ) { unset($this->custWpInstalls[$wp_path]); - $this->log("Installation removed from custom data file: {$wp_path}", - Logger::L_INFO); + $this->log( + "Installation removed from custom data file: " + . $wp_path, + Logger::L_INFO + ); } } else { - $this->log("Installation already found: {$wp_path}", Logger::L_DEBUG); + $this->log( + "Installation already found: {$wp_path}", + Logger::L_DEBUG + ); } if ( $refresh ) { @@ -738,6 +800,91 @@ protected function scan( $docroot, $forceRefresh = false ) } } + /** + * + * @since 1.13.3 + * + * @param string $docroot + * @return string[] + * @throws LSCMException Thrown indirectly. + */ + public function scan2( $docroot ) + { + $depth = Context::getScanDepth(); + $cmd = "find -L {$docroot} -maxdepth {$depth} -name wp-admin -print"; + $directories = shell_exec($cmd); + + /** + * Example: + * /home/user/public_html/wordpress/wp-admin + * /home/user/public_html/blog/wp-admin + * /home/user/public_html/wp/wp-admin + */ + $hasMatches = preg_match_all( + "|{$docroot}(.*)(?=/wp-admin)|", + $directories, + $matches + ); + + if ( ! $hasMatches ) { + /** + * Nothing found. + */ + return array(); + } + + $wpPaths = array(); + + foreach ( $matches[1] as $path ) { + $wpPath = realpath($docroot . $path); + $wpPaths[] = $wpPath; + } + + return $wpPaths; + } + + /** + * Add a new WPInstall object to WPInstallStorage's $wpInstalls[] given a + * path to a WordPress installation and refresh it's status . If a WPInstall + * object already exists for the given path, refresh it's status. + * + * @since 1.13.3 + * + * @param string $wpPath + * @throws LSCMException Thrown indirectly. + */ + protected function addNewWPInstall( $wpPath ) + { + if ( ($realPath = realpath($wpPath)) !== false ) { + $wpPath = $realPath; + } + + if ( !isset($this->wpInstalls[$wpPath]) ) { + $this->wpInstalls[$wpPath] = new WPInstall($wpPath); + $this->log("New installation found: {$wpPath}", Logger::L_INFO); + + if ( $this->custWpInstalls != null && + isset($this->custWpInstalls[$wpPath]) ) { + + unset($this->custWpInstalls[$wpPath]); + + $this->log( + "Installation removed from custom data file: {$wpPath}", + Logger::L_INFO + ); + } + } + else { + $this->log( + "Installation already found: {$wpPath}", + Logger::L_DEBUG + ); + } + + $this->wpInstalls[$wpPath]->refreshStatus(); + $this->workingQueue[$wpPath] = $this->wpInstalls[$wpPath]; + } + /** * * @param string[] $wpInstallsInfo @@ -747,8 +894,11 @@ protected function scan( $docroot, $forceRefresh = false ) protected function addCustomInstallations( $wpInstallsInfo ) { if ( $this->customDataFile == '' ) { - $this->log('No custom data file set, could not add custom Installation.', - Logger::L_INFO); + $this->log( + 'No custom data file set, could not add custom Installation.', + Logger::L_INFO + ); + return; } @@ -765,9 +915,11 @@ protected function addCustomInstallations( $wpInstallsInfo ) $line = $i + 1; if ( count($info) != 4 ) { - $msg = "Incorrect number of values for custom installation input string on line " - . "{$line}. Skipping."; - $this->log($msg, Logger::L_INFO); + $this->log( + 'Incorrect number of values for custom installation input ' + . "string on line {$line}. Skipping.", + Logger::L_INFO + ); continue; } @@ -779,15 +931,20 @@ protected function addCustomInstallations( $wpInstallsInfo ) if ( !file_exists("{$wpPath}/wp-admin") ) { $this->log( - "No 'wp-admin' directory found for {$wpPath} on line {$line}. Skipping.", - Logger::L_INFO); + "No 'wp-admin' directory found for {$wpPath} on line " + . "{$line}. Skipping.", + Logger::L_INFO + ); continue; } if ( !(substr($wpPath, 0, strlen($docroot)) === $docroot) ) { - $this->log("docroot not contained in {$wpPath} on line {$line}. Skipping.", - Logger::L_INFO); + $this->log( + "docroot not contained in {$wpPath} on line {$line}. " + . 'Skipping.', + Logger::L_INFO + ); continue; } @@ -799,12 +956,17 @@ protected function addCustomInstallations( $wpInstallsInfo ) $this->custWpInstalls[$wpPath]->setSiteUrlDirect($siteUrl); $this->custWpInstalls[$wpPath]->refreshStatus(); - $this->log("New installation added to custom data file: {$wpPath}", - Logger::L_INFO); + $this->log( + "New installation added to custom data file: {$wpPath}", + Logger::L_INFO + ); } else { - $this->log("Installation already found during scan: {$wpPath}. Skipping.", - Logger::L_INFO); + $this->log( + "Installation already found during scan: {$wpPath}. " + . 'Skipping.', + Logger::L_INFO + ); } } } @@ -812,7 +974,7 @@ protected function addCustomInstallations( $wpInstallsInfo ) /** * Get all WPInstall command messages as a key=>value array. * - * @return string[] + * @return string[][] */ public function getAllCmdMsgs() { diff --git a/dist/admin/html.open/lib/CValidation.php b/dist/admin/html.open/lib/CValidation.php index 617beaae3..87244412d 100644 --- a/dist/admin/html.open/lib/CValidation.php +++ b/dist/admin/html.open/lib/CValidation.php @@ -219,6 +219,8 @@ protected function chkPostTbl_L_GENERAL($d) $ip = $d->GetChildVal('ip'); $port = $d->GetChildVal('port'); + $is_v6ip = ($ip == '[ANY]') || (strpos($ip, ':') !== false); + $confdata = $this->_disp->Get(DInfo::FLD_ConfData); $lastref = $this->_disp->GetLast(DInfo::FLD_REF); $nodes = $confdata->GetRootNode()->GetChildren('listener'); @@ -233,7 +235,11 @@ protected function chkPostTbl_L_GENERAL($d) } $nodeip = $node->GetChildVal('ip'); - if ($ip == $nodeip || $ip == 'ANY' || $nodeip == 'ANY') { + $is_v6node = ($nodeip == '[ANY]') || (strpos($nodeip, ':') !== false); + if (($ip == $nodeip) + || ($ip == '[ANY]' && $is_v6node) || ($is_v6ip && $nodeip == '[ANY]') + || ($ip == 'ANY' && !$is_v6node) || (!$is_v6ip && $nodeip == 'ANY')) { + // ANY is IPv4, [ANY] is IPv6 $d->SetChildErr('port', 'This port is already in use.'); $isValid = -1; break; @@ -386,7 +392,7 @@ protected function chkAttr_name($attr, $node) protected function chkAttr_name_val($attr, $val, &$err) { - if (preg_match("/[<>&%]/", $val)) { + if (preg_match("/[{}<>&%]/", $val)) { $err = 'invalid characters in name'; return -1; } diff --git a/dist/admin/html.open/lib/DTblDefBase.php b/dist/admin/html.open/lib/DTblDefBase.php index 436b92af1..2cfcbc41f 100644 --- a/dist/admin/html.open/lib/DTblDefBase.php +++ b/dist/admin/html.open/lib/DTblDefBase.php @@ -213,7 +213,7 @@ protected function loadCommonOptions() } } $ipo = []; - $ipo['ANY'] = 'ANY'; + $ipo['ANY'] = 'ANY IPv4'; $ipstr = isset($_SERVER['LSWS_IPV4_ADDRS']) ? $_SERVER['LSWS_IPV4_ADDRS'] : ''; if ($ipstr != '') { $ips = explode(',', $ipstr); @@ -467,7 +467,7 @@ protected function add_S_TUNING_GZIP($id) protected function add_S_TUNING_QUIC($id) { $congest_options = ['' => 'Default', '1' => 'Cubic', '2' => 'BBR']; - $attrs = array( + $attrs = [ self::NewBoolAttr('quicEnable', DMsg::ALbl('l_enablequic')), self::NewTextAttr('quicShmDir', DMsg::ALbl('l_quicshmdir'), 'cust'), self::NewTextAttr('quicVersions', DMsg::ALbl('l_quicversions'), 'cust'), @@ -479,7 +479,10 @@ protected function add_S_TUNING_QUIC($id) self::NewIntAttr('quicMaxStreams', DMsg::ALbl('l_quicmaxstreams'), true, 10, 1000), self::NewIntAttr('quicHandshakeTimeout', DMsg::ALbl('l_quichandshaketimeout'), true, 1, 15), self::NewIntAttr('quicIdleTimeout', DMsg::ALbl('l_quicidletimeout'), true, 10, 30), - ); + self::NewBoolAttr('quicEnableDPLPMTUD', DMsg::ALbl('l_quicenabledplpmtud')), + self::NewIntAttr('quicBasePLPMTU', DMsg::ALbl('l_quicbaseplpmtu'), true, 0, 65527), + self::NewIntAttr('quicMaxPLPMTU', DMsg::ALbl('l_quicmaxplpmtu'), true, 0, 65527), + ]; $this->_tblDef[$id] = DTbl::NewRegular($id, DMsg::ALbl('l_quic'), $attrs); } @@ -1386,7 +1389,7 @@ protected function add_T_GENERAL1($id) self::NewParseTextAttr('configFile', DMsg::ALbl('l_configfile'), '/\$VH_NAME.*\.conf$/', DMsg::ALbl('parse_tpvhconffile'), false, 'templateVHConfigFile'), $this->_attrs['vh_maxKeepAliveReq'], ); - $this->_tblDef[$id] = DTbl::NewRegular($id, 'Base', $attrs); // todo: title change + $this->_tblDef[$id] = DTbl::NewRegular($id, DMsg::ALbl('l_base'), $attrs); } protected function add_T_SEC_FILE($id) diff --git a/dist/admin/html.open/lib/ows/DTblDef.php b/dist/admin/html.open/lib/ows/DTblDef.php index 400a5c3af..123cefab6 100644 --- a/dist/admin/html.open/lib/ows/DTblDef.php +++ b/dist/admin/html.open/lib/ows/DTblDef.php @@ -492,6 +492,7 @@ protected function add_VT_CTX_TOP($id) $attrs = array( $this->_attrs['ctx_type'], self::NewViewAttr('uri', DMsg::ALbl('l_uri')), + self::NewBoolAttr('allowBrowse', DMsg::ALbl('l_allowbrowse'), false), self::NewCustFlagAttr('order', DMsg::ALbl('l_order'), (DAttr::BM_NOFILE | DAttr::BM_NOEDIT), true, 'ctxseq'), self::NewActionAttr($this->_options['ctxTbl'], 'vEd') ); diff --git a/dist/admin/html.open/lib/util/build_php/BuildConfig.php b/dist/admin/html.open/lib/util/build_php/BuildConfig.php index 1e6259eea..ec2b57636 100644 --- a/dist/admin/html.open/lib/util/build_php/BuildConfig.php +++ b/dist/admin/html.open/lib/util/build_php/BuildConfig.php @@ -25,9 +25,9 @@ public static function GetVersion($field) case self::PHP_VERSION: return array( - '7.4.10', - '7.3.22', - '7.2.33', + '7.4.11', + '7.3.23', + '7.2.34', '7.1.33', '7.0.33', '5.6.40', diff --git a/dist/admin/html.open/res/lang/en-US_msg.php b/dist/admin/html.open/res/lang/en-US_msg.php index bfd5b0313..08abb2e64 100644 --- a/dist/admin/html.open/res/lang/en-US_msg.php +++ b/dist/admin/html.open/res/lang/en-US_msg.php @@ -418,10 +418,13 @@ $_gmsg['l_procsoftlimit'] = 'Process Soft Limit'; $_gmsg['l_protocolver'] = 'Protocol Version'; $_gmsg['l_quic'] = 'QUIC'; +$_gmsg['l_quicbaseplpmtu'] = 'PLPMTU Base Value'; $_gmsg['l_quiccfcw'] = 'Connection Flow Control Window'; +$_gmsg['l_quicenabledplpmtud'] = 'Enable DPLPMTUD'; $_gmsg['l_quichandshaketimeout'] = 'Handshake Timeout (secs)'; $_gmsg['l_quicidletimeout'] = 'Idle Timeout (secs)'; $_gmsg['l_quicmaxcfcw'] = 'Max Connection Flow Control Window'; +$_gmsg['l_quicmaxplpmtu'] = 'PLPMTU Max Value'; $_gmsg['l_quicmaxsfcw'] = 'Max Stream Flow Control Window'; $_gmsg['l_quicmaxstreams'] = 'Max Concurrent Streams Per Connection'; $_gmsg['l_quicsfcw'] = 'Stream Flow Control Window'; diff --git a/dist/admin/html.open/res/lang/en-US_tips.php b/dist/admin/html.open/res/lang/en-US_tips.php index 085b3bd81..38629578f 100644 --- a/dist/admin/html.open/res/lang/en-US_tips.php +++ b/dist/admin/html.open/res/lang/en-US_tips.php @@ -496,18 +496,24 @@ $_tipsdb['proxyWebServer'] = new DAttrHelp("Web Server", 'Specifies the name of the external web server. This external web server must be defined in the "External Apps" section at the server or virtual host level.', '', 'Select from drop down list', ''); +$_tipsdb['quicBasePLPMTU'] = new DAttrHelp("PLPMTU Base Value", 'The maximum value of PLPMTU (maximum packet size without headers) in bytes that QUIC will use by default. Setting this to 0 will allow QUIC to pick the size.

This setting should be set lower than "PLPMTU Max Value".

Default value: 0', '', '0 or integer number between 1200 and 65527', ''); + $_tipsdb['quicCfcw'] = new DAttrHelp("Connection Flow Control Window", 'The initial size of the buffer allocated for a QUIC connection. Default value is 1.5M.', 'A larger window size will use more memory.', 'Number between 64K and 512M', ''); $_tipsdb['quicCongestionCtrl'] = new DAttrHelp("Congestion Control", 'The congestion control algorithm used. This can be set manually or left up to the QUIC library in use by selecting the "Default" option.

Default value: Default', '', 'Select from drop down list', ''); $_tipsdb['quicEnable'] = new DAttrHelp("Enable QUIC", 'Enables the QUIC network protocol server wide. Default value is Yes.', 'When this setting is set to Yes, QUIC can still be disabled at the listener level through the "Allow QUIC" setting, or at the virtual host level through the "Enable QUIC" setting.', 'Select from radio box', ''); +$_tipsdb['quicEnableDPLPMTUD'] = new DAttrHelp("Enable DPLPMTUD", 'Enable Datagram Packetization Layer Path Maximum Transmission Unit Discovery (DPLPMTUD).

Background on DPLPMTUD (RFC 8899)

Default value: Yes', '', 'Select from radio box', ''); + $_tipsdb['quicHandshakeTimeout'] = new DAttrHelp("Handshake Timeout", 'The time in seconds a new QUIC connection is given to complete its handshake, after which the connection is aborted. Default value is 10.', '', 'Integer number between 1 and 15', ''); $_tipsdb['quicIdleTimeout'] = new DAttrHelp("Idle Timeout", 'The time in seconds after which an idle QUIC connection will be closed. Default value is 30.', '', 'Integer number between 10 and 30', ''); $_tipsdb['quicMaxCfcw'] = new DAttrHelp("Max Connection Flow Control Window", 'Specifies the maximum size that a connection flow control window buffer is allowed to reach due to window auto-tuning.

Default value is 0, which means that the value of "Connection Flow Control Window" is used and no auto-tuning is performed.', 'A larger window size will use more memory.', '0 or a number between 64K and 512M', ''); +$_tipsdb['quicMaxPLPMTU'] = new DAttrHelp("PLPMTU Max Value", 'The PLPMTU (maximum packet size without headers) probe upper limit in bytes. This setting is used to limit the "maximum packet size" in the DPLPMTUD search space. Setting this to 0 will allow QUIC to pick the size (By default LSQUIC assumes that MTU is 1,500 bytes (Ethernet)).

This setting should be set higher than "PLPMTU Base Value".
Default value: 0', '', '0 or integer number between 1200 and 65527', ''); + $_tipsdb['quicMaxSfcw'] = new DAttrHelp("Max Stream Flow Control Window", 'Specifies the maximum size that a stream flow control window is allowed to reach due to window auto-tuning.

Default value is 0, which means that the value of "Stream Flow Control Window" is used and no auto-tuning is performed.', 'A larger window size will use more memory.', '0 or a number between 64K and 128M', ''); $_tipsdb['quicMaxStreams'] = new DAttrHelp("Max Concurrent Streams Per Connection", 'The maximum number of concurrent streams allowed per QUIC connection. Default value is 100.', '', 'Integer number between 10 and 1000', ''); diff --git a/dist/admin/html.open/res/lang/ja-JP_tips.php b/dist/admin/html.open/res/lang/ja-JP_tips.php index 11645da7a..c6a921b5b 100644 --- a/dist/admin/html.open/res/lang/ja-JP_tips.php +++ b/dist/admin/html.open/res/lang/ja-JP_tips.php @@ -496,18 +496,24 @@ $_tipsdb['proxyWebServer'] = new DAttrHelp("Webサーバー", '外部Webサーバーの名前を指定します。 この外部Webサーバーは、サーバーまたはバーチャルホストレベルの"外部アプリケーション"セクションで定義する必要があります。', '', '選択', ''); +$_tipsdb['quicBasePLPMTU'] = new DAttrHelp("PLPMTU Base Value", 'The maximum value of PLPMTU (maximum packet size without headers) in bytes that QUIC will use by default. Setting this to 0 will allow QUIC to pick the size.

This setting should be set lower than "PLPMTU Max Value".

Default value: 0', '', '0 or integer number between 1200 and 65527', ''); + $_tipsdb['quicCfcw'] = new DAttrHelp("Connection Flow Control Window", 'The initial size of the buffer allocated for a QUIC connection. Default value is 1.5M.', 'A larger window size will use more memory.', 'Number between 64K and 512M', ''); $_tipsdb['quicCongestionCtrl'] = new DAttrHelp("Congestion Control", 'The congestion control algorithm used. This can be set manually or left up to the QUIC library in use by selecting the "Default" option.

Default value: Default', '', 'ドロップダウンリストから選択', ''); $_tipsdb['quicEnable'] = new DAttrHelp("Enable QUIC", 'Enables the QUIC network protocol server wide. Default value is Yes.', 'When this setting is set to Yes, QUIC can still be disabled at the listener level through the "Allow QUIC" setting, or at the virtual host level through the "Enable QUIC" setting.', 'ラジオボックスから選択', ''); +$_tipsdb['quicEnableDPLPMTUD'] = new DAttrHelp("Enable DPLPMTUD", 'Enable Datagram Packetization Layer Path Maximum Transmission Unit Discovery (DPLPMTUD).

Background on DPLPMTUD (RFC 8899)

Default value: Yes', '', 'ラジオボックスから選択', ''); + $_tipsdb['quicHandshakeTimeout'] = new DAttrHelp("Handshake Timeout", 'The time in seconds a new QUIC connection is given to complete its handshake, after which the connection is aborted. Default value is 10.', '', 'Integer number between 1 and 15', ''); $_tipsdb['quicIdleTimeout'] = new DAttrHelp("Idle Timeout", 'The time in seconds after which an idle QUIC connection will be closed. Default value is 30.', '', 'Integer number between 10 and 30', ''); $_tipsdb['quicMaxCfcw'] = new DAttrHelp("Max Connection Flow Control Window", 'Specifies the maximum size that a connection flow control window buffer is allowed to reach due to window auto-tuning.

Default value is 0, which means that the value of "Connection Flow Control Window" is used and no auto-tuning is performed.', 'A larger window size will use more memory.', '0 or a number between 64K and 512M', ''); +$_tipsdb['quicMaxPLPMTU'] = new DAttrHelp("PLPMTU Max Value", 'The PLPMTU (maximum packet size without headers) probe upper limit in bytes. This setting is used to limit the "maximum packet size" in the DPLPMTUD search space. Setting this to 0 will allow QUIC to pick the size (By default LSQUIC assumes that MTU is 1,500 bytes (Ethernet)).

This setting should be set higher than "PLPMTU Base Value".
Default value: 0', '', '0 or integer number between 1200 and 65527', ''); + $_tipsdb['quicMaxSfcw'] = new DAttrHelp("Max Stream Flow Control Window", 'Specifies the maximum size that a stream flow control window is allowed to reach due to window auto-tuning.

Default value is 0, which means that the value of "Stream Flow Control Window" is used and no auto-tuning is performed.', 'A larger window size will use more memory.', '0 or a number between 64K and 128M', ''); $_tipsdb['quicMaxStreams'] = new DAttrHelp("Max Concurrent Streams Per Connection", 'The maximum number of concurrent streams allowed per QUIC connection. Default value is 100.', '', 'Integer number between 10 and 1000', ''); diff --git a/dist/admin/html.open/res/lang/zh-CN_tips.php b/dist/admin/html.open/res/lang/zh-CN_tips.php index f44102507..8db4be2a3 100644 --- a/dist/admin/html.open/res/lang/zh-CN_tips.php +++ b/dist/admin/html.open/res/lang/zh-CN_tips.php @@ -496,18 +496,24 @@ $_tipsdb['proxyWebServer'] = new DAttrHelp("Web服务器", '指定外部Web服务器的名称。 此外部Web服务器必须在服务器或虚拟主机级别的"External Apps"中定义', '', '从列表中选择', ''); +$_tipsdb['quicBasePLPMTU'] = new DAttrHelp("PLPMTU Base Value", 'The maximum value of PLPMTU (maximum packet size without headers) in bytes that QUIC will use by default. Setting this to 0 will allow QUIC to pick the size.

This setting should be set lower than "PLPMTU Max Value".

Default value: 0', '', '0 or integer number between 1200 and 65527', ''); + $_tipsdb['quicCfcw'] = new DAttrHelp("流连接窗口控制", '为QUIC连接分配的缓冲区的初始大小。 默认值为 1.5M 。', '更大的窗口大小将使用更多的内存。', 'Number between 64K and 512M', ''); $_tipsdb['quicCongestionCtrl'] = new DAttrHelp("拥塞控制", '使用的拥塞控制算法。 可以手动设置,也可以选择“默认”选项,将其保留到的QUIC库中。

默认值:: Default', '', '从列表中选择', ''); $_tipsdb['quicEnable'] = new DAttrHelp("启用QUIC", '在整个服务器范围内启用QUIC网络协议。 默认值为是。', '当此设置设置为是时,仍然可以通过"允许QUIC"设置在侦听器级别 或通过"启用QUIC"设置在虚拟主机级别禁用QUIC', '从单选框选择', ''); +$_tipsdb['quicEnableDPLPMTUD'] = new DAttrHelp("Enable DPLPMTUD", 'Enable Datagram Packetization Layer Path Maximum Transmission Unit Discovery (DPLPMTUD).

Background on DPLPMTUD (RFC 8899)

Default value: Yes', '', '从单选框选择', ''); + $_tipsdb['quicHandshakeTimeout'] = new DAttrHelp("握手超时时间", '给出新的QUIC连接完成其握手的时间(以秒为单位),超过限制时间后连接将中止。 默认值为10。', '', 'Integer number between 1 and 15', ''); $_tipsdb['quicIdleTimeout'] = new DAttrHelp("空闲超时时间(秒)", '空闲的QUIC连接将被关闭的时间(以秒为单位)。 默认值为 30 。', '', 'Integer number between 10 and 30', ''); $_tipsdb['quicMaxCfcw'] = new DAttrHelp("最大连接流量窗口值设置", '指定由于连接流控制窗口缓冲区的最大大小 auto-tuning.

默认值为 0 ,这意味着将使用"流连接窗口控制"的值,并且不会自动调整。', '更大的窗口大小将使用更多的内存。', '0 or a number between 64K and 512M', ''); +$_tipsdb['quicMaxPLPMTU'] = new DAttrHelp("PLPMTU Max Value", 'The PLPMTU (maximum packet size without headers) probe upper limit in bytes. This setting is used to limit the "maximum packet size" in the DPLPMTUD search space. Setting this to 0 will allow QUIC to pick the size (By default LSQUIC assumes that MTU is 1,500 bytes (Ethernet)).

This setting should be set higher than "PLPMTU Base Value".
Default value: 0', '', '0 or integer number between 1200 and 65527', ''); + $_tipsdb['quicMaxSfcw'] = new DAttrHelp("最大流量窗口值设置", '指定由于自动调整而允许流控制窗口达到的最大大小。

默认值为0,这意味着将使用"连接流量窗口值"的值,并且不会自动调整', '更大的窗口大小将使用更多的内存。', '0 or a number between 64K and 128M', ''); $_tipsdb['quicMaxStreams'] = new DAttrHelp("每个连接的最大并发数", '每个QUIC连接的最大并发数。 默认值为100。', '', 'Integer number between 10 and 1000', ''); diff --git a/dist/admin/html.open/view/dashboard.php b/dist/admin/html.open/view/dashboard.php index da43b96d2..6eb3b346e 100644 --- a/dist/admin/html.open/view/dashboard.php +++ b/dist/admin/html.open/view/dashboard.php @@ -402,9 +402,9 @@ function vhcontrol(act, acttitle, vn) { $.SmartMessageBox({ title: " " + acttitle + "", content: vn, - buttons: '[No][Yes]' + buttons: '' }, function (ButtonPressed) { - if (ButtonPressed === "Yes") { + if (ButtonPressed === "") { $.ajax({ type: "POST", diff --git a/dist/admin/html.open/view/inc/configui.php b/dist/admin/html.open/view/inc/configui.php index 55078d262..b24f0d246 100644 --- a/dist/admin/html.open/view/inc/configui.php +++ b/dist/admin/html.open/view/inc/configui.php @@ -94,7 +94,7 @@ 'url_target' => '_blank'), 'slack' => array( 'title' => DMsg::UIStr('menu_slack'), - 'url' => 'https://join.slack.com/t/golitespeed/shared_invite/enQtMzE5ODgxMTUyNTgzLWVhZDNhZDNmYWRhZmIwNzUxN2Y2ZDRjZGUwZjFiMDk1ZTNjZDJmMDg5NTcyZjFiZDM4MDY1NjkwYjkzM2E5YmE', + 'url' => 'https://litespeedtech.com/slack', 'url_target' => '_blank'), 'cloudimage' => array( 'title' => DMsg::UIStr('menu_cloudimage'), diff --git a/dist/admin/misc/lshttpd.service.in b/dist/admin/misc/lshttpd.service.in index 0fdd934b2..d3a8f0c08 100644 --- a/dist/admin/misc/lshttpd.service.in +++ b/dist/admin/misc/lshttpd.service.in @@ -22,5 +22,5 @@ MemoryAccounting=false [Install] WantedBy=multi-user.target -Alias=lsws.service +#Alias=lsws.service Alias=openlitespeed.service diff --git a/dist/admin/misc/lsup.sh b/dist/admin/misc/lsup.sh index 5d31cf32c..c096d55f2 100755 --- a/dist/admin/misc/lsup.sh +++ b/dist/admin/misc/lsup.sh @@ -1,6 +1,6 @@ #! /bin/sh -LSUPVERSION=v2.82-9/10/2020 +LSUPVERSION=v2.83-9/29/2020 LOCKFILE=/tmp/olsupdatingflag PIDFILE=/tmp/lshttpd/lshttpd.pid @@ -65,6 +65,18 @@ stopService() if [ $RUNNING -eq 1 ] ; then ${LSWSCTRL} stop fi + + FPID=`cat $PIDFILE` + if [ "x$FPID" != "x" ]; then + kill -9 $FPID 2>/dev/null + fi + + #when FPID not exist, try again + FPID=`ps -ef | grep openlitespeed | grep -v grep | awk '{print $2}'` + if [ "x$FPID" != "x" ]; then + kill -9 $FPID 2>/dev/null + fi + } @@ -441,7 +453,7 @@ if [ -f ${LOCKFILE} ] ; then echoG "${LOCKFILE} exists, timestamp is $FILETIME, current time is $SYSTEMTIME, removed it." rm -rf ${LOCKFILE} else - echoR "Openlitespeed is updating, quit." + echoR "Openlitespeed is updating, quit. (You may run -c to remove the lock file and try again.)" exit 0 fi fi @@ -536,7 +548,9 @@ if [ -f ${LSWSHOME}/VERSION ] ; then fi stopService -mv /tmp/lshttpd/bak_core /tmp/lshttpdcore +if [ -e /tmp/lshttpd/bak_core ] ; then + mv /tmp/lshttpd/bak_core /tmp/lshttpdcore +fi rm -rf /tmp/lshttpd/* if [ -e /dev/shm/ols ] ; then rm -rf /dev/shm/ols/* diff --git a/dist/admin/misc/rc-inst.sh b/dist/admin/misc/rc-inst.sh index 8a6ec84c3..3a3e7702b 100755 --- a/dist/admin/misc/rc-inst.sh +++ b/dist/admin/misc/rc-inst.sh @@ -111,6 +111,7 @@ if [ "${SYSTEMDDIR}" != "" ] ; then cp -f ${CURDIR}/lshttpd.service ${SYSTEMDDIR}/lshttpd.service chmod 644 ${SYSTEMDDIR}/lshttpd.service + ln -sf ${SYSTEMDDIR}/lshttpd.service ${SYSTEMDDIR}/lsws.service systemctl daemon-reload systemctl enable lshttpd.service diff --git a/dist/conf/mime.properties b/dist/conf/mime.properties index fa55ee882..43f98bde2 100755 --- a/dist/conf/mime.properties +++ b/dist/conf/mime.properties @@ -8,6 +8,7 @@ asf = video/asf asx = video/x-ms-asf au = audio/basic avi = video/x-msvideo +avif = image/avif bcpio = application/x-bcpio bmp = image/bmp bin = application/octet-stream @@ -61,7 +62,7 @@ mid, midi = audio/midi mif = application/vnd.mif movie = video/x-sgi-movie mov = video/quicktime -mp2, mp3, mpga = audio/mpeg +mp2, mp3, mpga = audio/mpeg mpeg, mpe, mpg = video/mpeg mp4 = video/mp4 mpp = application/vnd.ms-project diff --git a/dist/docs/AdminGeneral_Help.html b/dist/docs/AdminGeneral_Help.html index e9d6da4a3..ae18438db 100644 --- a/dist/docs/AdminGeneral_Help.html +++ b/dist/docs/AdminGeneral_Help.html @@ -17,7 +17,7 @@

OpenLiteSpeed Web Server Users' Manual

-

Version 1.7  — Rev. 17

+

Version 1.7  — Rev. 18


    diff --git a/dist/docs/AdminListeners_General_Help.html b/dist/docs/AdminListeners_General_Help.html index a060ce303..c23a57081 100644 --- a/dist/docs/AdminListeners_General_Help.html +++ b/dist/docs/AdminListeners_General_Help.html @@ -17,7 +17,7 @@

    OpenLiteSpeed Web Server Users' Manual

    -

    Version 1.7  — Rev. 17

    +

    Version 1.7  — Rev. 18


      diff --git a/dist/docs/AdminListeners_SSL_Help.html b/dist/docs/AdminListeners_SSL_Help.html index f833026fc..49cdda727 100644 --- a/dist/docs/AdminListeners_SSL_Help.html +++ b/dist/docs/AdminListeners_SSL_Help.html @@ -17,7 +17,7 @@

      OpenLiteSpeed Web Server Users' Manual

      -

      Version 1.7  — Rev. 17

      +

      Version 1.7  — Rev. 18


        diff --git a/dist/docs/AdminSecurity_Help.html b/dist/docs/AdminSecurity_Help.html index b614e17da..58af21a87 100644 --- a/dist/docs/AdminSecurity_Help.html +++ b/dist/docs/AdminSecurity_Help.html @@ -17,7 +17,7 @@

        OpenLiteSpeed Web Server Users' Manual

        -

        Version 1.7  — Rev. 17

        +

        Version 1.7  — Rev. 18


          diff --git a/dist/docs/App_Server_Context.html b/dist/docs/App_Server_Context.html index 42221a0b4..d4e2aa11d 100644 --- a/dist/docs/App_Server_Context.html +++ b/dist/docs/App_Server_Context.html @@ -17,7 +17,7 @@

          OpenLiteSpeed Web Server Users' Manual

          -

          Version 1.7  — Rev. 17

          +

          Version 1.7  — Rev. 18


            diff --git a/dist/docs/App_Server_Help.html b/dist/docs/App_Server_Help.html index dbcbb709f..d56f626c5 100644 --- a/dist/docs/App_Server_Help.html +++ b/dist/docs/App_Server_Help.html @@ -17,7 +17,7 @@

            OpenLiteSpeed Web Server Users' Manual

            -

            Version 1.7  — Rev. 17

            +

            Version 1.7  — Rev. 18


              diff --git a/dist/docs/CGI_Context.html b/dist/docs/CGI_Context.html index 31ef06eb3..960dd4a7b 100644 --- a/dist/docs/CGI_Context.html +++ b/dist/docs/CGI_Context.html @@ -17,7 +17,7 @@

              OpenLiteSpeed Web Server Users' Manual

              -

              Version 1.7  — Rev. 17

              +

              Version 1.7  — Rev. 18


                diff --git a/dist/docs/CompilePHP_Help.html b/dist/docs/CompilePHP_Help.html index 10e8efc64..5071cf5ca 100644 --- a/dist/docs/CompilePHP_Help.html +++ b/dist/docs/CompilePHP_Help.html @@ -17,7 +17,7 @@

                OpenLiteSpeed Web Server Users' Manual

                -

                Version 1.7  — Rev. 17

                +

                Version 1.7  — Rev. 18


                  diff --git a/dist/docs/Context_Help.html b/dist/docs/Context_Help.html index 79cf1b670..95e850fc1 100644 --- a/dist/docs/Context_Help.html +++ b/dist/docs/Context_Help.html @@ -17,7 +17,7 @@

                  OpenLiteSpeed Web Server Users' Manual

                  -

                  Version 1.7  — Rev. 17

                  +

                  Version 1.7  — Rev. 18


                    diff --git a/dist/docs/ExtApp_Help.html b/dist/docs/ExtApp_Help.html index 7b77b52fa..bd3a8495f 100644 --- a/dist/docs/ExtApp_Help.html +++ b/dist/docs/ExtApp_Help.html @@ -17,7 +17,7 @@

                    OpenLiteSpeed Web Server Users' Manual

                    -

                    Version 1.7  — Rev. 17

                    +

                    Version 1.7  — Rev. 18


                      diff --git a/dist/docs/External_FCGI.html b/dist/docs/External_FCGI.html index 266cc6594..2d01a4c44 100644 --- a/dist/docs/External_FCGI.html +++ b/dist/docs/External_FCGI.html @@ -17,7 +17,7 @@

                      OpenLiteSpeed Web Server Users' Manual

                      -

                      Version 1.7  — Rev. 17

                      +

                      Version 1.7  — Rev. 18


                        diff --git a/dist/docs/External_FCGI_Auth.html b/dist/docs/External_FCGI_Auth.html index 9f4bed6fd..405596fbf 100644 --- a/dist/docs/External_FCGI_Auth.html +++ b/dist/docs/External_FCGI_Auth.html @@ -17,7 +17,7 @@

                        OpenLiteSpeed Web Server Users' Manual

                        -

                        Version 1.7  — Rev. 17

                        +

                        Version 1.7  — Rev. 18


                          diff --git a/dist/docs/External_LB.html b/dist/docs/External_LB.html index 6c82f5351..c74ff4257 100644 --- a/dist/docs/External_LB.html +++ b/dist/docs/External_LB.html @@ -17,7 +17,7 @@

                          OpenLiteSpeed Web Server Users' Manual

                          -

                          Version 1.7  — Rev. 17

                          +

                          Version 1.7  — Rev. 18


                            diff --git a/dist/docs/External_LSAPI.html b/dist/docs/External_LSAPI.html index e37a3042d..9e2a0ced9 100644 --- a/dist/docs/External_LSAPI.html +++ b/dist/docs/External_LSAPI.html @@ -17,7 +17,7 @@

                            OpenLiteSpeed Web Server Users' Manual

                            -

                            Version 1.7  — Rev. 17

                            +

                            Version 1.7  — Rev. 18


                              diff --git a/dist/docs/External_PL.html b/dist/docs/External_PL.html index 5085cfd42..9270ffcf8 100644 --- a/dist/docs/External_PL.html +++ b/dist/docs/External_PL.html @@ -17,7 +17,7 @@

                              OpenLiteSpeed Web Server Users' Manual

                              -

                              Version 1.7  — Rev. 17

                              +

                              Version 1.7  — Rev. 18


                                diff --git a/dist/docs/External_Servlet.html b/dist/docs/External_Servlet.html index 3ce5e608d..aff2daa64 100644 --- a/dist/docs/External_Servlet.html +++ b/dist/docs/External_Servlet.html @@ -17,7 +17,7 @@

                                OpenLiteSpeed Web Server Users' Manual

                                -

                                Version 1.7  — Rev. 17

                                +

                                Version 1.7  — Rev. 18


                                  diff --git a/dist/docs/External_WS.html b/dist/docs/External_WS.html index 02b7da871..2aa62c89a 100644 --- a/dist/docs/External_WS.html +++ b/dist/docs/External_WS.html @@ -17,7 +17,7 @@

                                  OpenLiteSpeed Web Server Users' Manual

                                  -

                                  Version 1.7  — Rev. 17

                                  +

                                  Version 1.7  — Rev. 18


                                    diff --git a/dist/docs/FCGI_Context.html b/dist/docs/FCGI_Context.html index 3578b283d..a6861e790 100644 --- a/dist/docs/FCGI_Context.html +++ b/dist/docs/FCGI_Context.html @@ -17,7 +17,7 @@

                                    OpenLiteSpeed Web Server Users' Manual

                                    -

                                    Version 1.7  — Rev. 17

                                    +

                                    Version 1.7  — Rev. 18


                                      diff --git a/dist/docs/Java_Web_App_Context.html b/dist/docs/Java_Web_App_Context.html index afb9b9748..bfc2e5566 100644 --- a/dist/docs/Java_Web_App_Context.html +++ b/dist/docs/Java_Web_App_Context.html @@ -17,7 +17,7 @@

                                      OpenLiteSpeed Web Server Users' Manual

                                      -

                                      Version 1.7  — Rev. 17

                                      +

                                      Version 1.7  — Rev. 18


                                        diff --git a/dist/docs/LB_Context.html b/dist/docs/LB_Context.html index 9291f5845..b41d36a9e 100644 --- a/dist/docs/LB_Context.html +++ b/dist/docs/LB_Context.html @@ -17,7 +17,7 @@

                                        OpenLiteSpeed Web Server Users' Manual

                                        -

                                        Version 1.7  — Rev. 17

                                        +

                                        Version 1.7  — Rev. 18


                                          diff --git a/dist/docs/LSAPI_Context.html b/dist/docs/LSAPI_Context.html index 094b3d3e1..a9d541d3c 100644 --- a/dist/docs/LSAPI_Context.html +++ b/dist/docs/LSAPI_Context.html @@ -17,7 +17,7 @@

                                          OpenLiteSpeed Web Server Users' Manual

                                          -

                                          Version 1.7  — Rev. 17

                                          +

                                          Version 1.7  — Rev. 18


                                            diff --git a/dist/docs/Listeners_General_Help.html b/dist/docs/Listeners_General_Help.html index eeb3c5b57..cc5c1d235 100644 --- a/dist/docs/Listeners_General_Help.html +++ b/dist/docs/Listeners_General_Help.html @@ -17,7 +17,7 @@

                                            OpenLiteSpeed Web Server Users' Manual

                                            -

                                            Version 1.7  — Rev. 17

                                            +

                                            Version 1.7  — Rev. 18


                                              diff --git a/dist/docs/Listeners_SSL_Help.html b/dist/docs/Listeners_SSL_Help.html index 0f972ea42..9b1ca43c6 100644 --- a/dist/docs/Listeners_SSL_Help.html +++ b/dist/docs/Listeners_SSL_Help.html @@ -17,7 +17,7 @@

                                              OpenLiteSpeed Web Server Users' Manual

                                              -

                                              Version 1.7  — Rev. 17

                                              +

                                              Version 1.7  — Rev. 18


                                                diff --git a/dist/docs/Module_Context.html b/dist/docs/Module_Context.html index b69c19067..f4b5c27d0 100644 --- a/dist/docs/Module_Context.html +++ b/dist/docs/Module_Context.html @@ -17,7 +17,7 @@

                                                OpenLiteSpeed Web Server Users' Manual

                                                -

                                                Version 1.7  — Rev. 17

                                                +

                                                Version 1.7  — Rev. 18


                                                  diff --git a/dist/docs/Module_Help.html b/dist/docs/Module_Help.html index 94b77233f..574ada64e 100644 --- a/dist/docs/Module_Help.html +++ b/dist/docs/Module_Help.html @@ -17,7 +17,7 @@

                                                  OpenLiteSpeed Web Server Users' Manual

                                                  -

                                                  Version 1.7  — Rev. 17

                                                  +

                                                  Version 1.7  — Rev. 18


                                                    diff --git a/dist/docs/Proxy_Context.html b/dist/docs/Proxy_Context.html index 0bd11f666..50d2116ec 100644 --- a/dist/docs/Proxy_Context.html +++ b/dist/docs/Proxy_Context.html @@ -17,7 +17,7 @@

                                                    OpenLiteSpeed Web Server Users' Manual

                                                    -

                                                    Version 1.7  — Rev. 17

                                                    +

                                                    Version 1.7  — Rev. 18


                                                      diff --git a/dist/docs/Redirect_Context.html b/dist/docs/Redirect_Context.html index 011a97d64..8bb9a9311 100644 --- a/dist/docs/Redirect_Context.html +++ b/dist/docs/Redirect_Context.html @@ -17,7 +17,7 @@

                                                      OpenLiteSpeed Web Server Users' Manual

                                                      -

                                                      Version 1.7  — Rev. 17

                                                      +

                                                      Version 1.7  — Rev. 18


                                                        diff --git a/dist/docs/Rewrite_Help.html b/dist/docs/Rewrite_Help.html index c0afe13cb..c42cb0849 100644 --- a/dist/docs/Rewrite_Help.html +++ b/dist/docs/Rewrite_Help.html @@ -17,7 +17,7 @@

                                                        OpenLiteSpeed Web Server Users' Manual

                                                        -

                                                        Version 1.7  — Rev. 17

                                                        +

                                                        Version 1.7  — Rev. 18


                                                          diff --git a/dist/docs/ScriptHandler_Help.html b/dist/docs/ScriptHandler_Help.html index 8d3c18dd5..75d24db0d 100644 --- a/dist/docs/ScriptHandler_Help.html +++ b/dist/docs/ScriptHandler_Help.html @@ -17,7 +17,7 @@

                                                          OpenLiteSpeed Web Server Users' Manual

                                                          -

                                                          Version 1.7  — Rev. 17

                                                          +

                                                          Version 1.7  — Rev. 18


                                                            diff --git a/dist/docs/ServGeneral_Help.html b/dist/docs/ServGeneral_Help.html index 59ddc534a..4a11e91a1 100644 --- a/dist/docs/ServGeneral_Help.html +++ b/dist/docs/ServGeneral_Help.html @@ -17,7 +17,7 @@

                                                            OpenLiteSpeed Web Server Users' Manual

                                                            -

                                                            Version 1.7  — Rev. 17

                                                            +

                                                            Version 1.7  — Rev. 18


                                                              diff --git a/dist/docs/ServLog_Help.html b/dist/docs/ServLog_Help.html index 45e81193d..d4c0e7360 100644 --- a/dist/docs/ServLog_Help.html +++ b/dist/docs/ServLog_Help.html @@ -17,7 +17,7 @@

                                                              OpenLiteSpeed Web Server Users' Manual

                                                              -

                                                              Version 1.7  — Rev. 17

                                                              +

                                                              Version 1.7  — Rev. 18


                                                                diff --git a/dist/docs/ServSecurity_Help.html b/dist/docs/ServSecurity_Help.html index a97f18bfc..73cac24d9 100644 --- a/dist/docs/ServSecurity_Help.html +++ b/dist/docs/ServSecurity_Help.html @@ -17,7 +17,7 @@

                                                                OpenLiteSpeed Web Server Users' Manual

                                                                -

                                                                Version 1.7  — Rev. 17

                                                                +

                                                                Version 1.7  — Rev. 18


                                                                diff --git a/dist/docs/ServerStat_Help.html b/dist/docs/ServerStat_Help.html index 046326029..e47846703 100644 --- a/dist/docs/ServerStat_Help.html +++ b/dist/docs/ServerStat_Help.html @@ -17,7 +17,7 @@

                                                                OpenLiteSpeed Web Server Users' Manual

                                                                -

                                                                Version 1.7  — Rev. 17

                                                                +

                                                                Version 1.7  — Rev. 18


                                                                  diff --git a/dist/docs/Servlet_Context.html b/dist/docs/Servlet_Context.html index 5d692ca20..821a1f244 100644 --- a/dist/docs/Servlet_Context.html +++ b/dist/docs/Servlet_Context.html @@ -17,7 +17,7 @@

                                                                  OpenLiteSpeed Web Server Users' Manual

                                                                  -

                                                                  Version 1.7  — Rev. 17

                                                                  +

                                                                  Version 1.7  — Rev. 18


                                                                    diff --git a/dist/docs/Static_Context.html b/dist/docs/Static_Context.html index ab4d3ba07..a5a54f239 100644 --- a/dist/docs/Static_Context.html +++ b/dist/docs/Static_Context.html @@ -17,7 +17,7 @@

                                                                    OpenLiteSpeed Web Server Users' Manual

                                                                    -

                                                                    Version 1.7  — Rev. 17

                                                                    +

                                                                    Version 1.7  — Rev. 18


                                                                      diff --git a/dist/docs/Templates_Help.html b/dist/docs/Templates_Help.html index 0fde520fa..9cfb4e3da 100644 --- a/dist/docs/Templates_Help.html +++ b/dist/docs/Templates_Help.html @@ -17,7 +17,7 @@

                                                                      OpenLiteSpeed Web Server Users' Manual

                                                                      -

                                                                      Version 1.7  — Rev. 17

                                                                      +

                                                                      Version 1.7  — Rev. 18


                                                                        diff --git a/dist/docs/VHGeneral_Help.html b/dist/docs/VHGeneral_Help.html index 2e406a608..3eeb64656 100644 --- a/dist/docs/VHGeneral_Help.html +++ b/dist/docs/VHGeneral_Help.html @@ -17,7 +17,7 @@

                                                                        OpenLiteSpeed Web Server Users' Manual

                                                                        -

                                                                        Version 1.7  — Rev. 17

                                                                        +

                                                                        Version 1.7  — Rev. 18


                                                                          diff --git a/dist/docs/VHSSL_Help.html b/dist/docs/VHSSL_Help.html index 97a2701da..7c7a2f6eb 100644 --- a/dist/docs/VHSSL_Help.html +++ b/dist/docs/VHSSL_Help.html @@ -17,7 +17,7 @@

                                                                          OpenLiteSpeed Web Server Users' Manual

                                                                          -

                                                                          Version 1.7  — Rev. 17

                                                                          +

                                                                          Version 1.7  — Rev. 18


                                                                            diff --git a/dist/docs/VHSecurity_Help.html b/dist/docs/VHSecurity_Help.html index 7b6ae7e2c..3eaab9e73 100644 --- a/dist/docs/VHSecurity_Help.html +++ b/dist/docs/VHSecurity_Help.html @@ -17,7 +17,7 @@

                                                                            OpenLiteSpeed Web Server Users' Manual

                                                                            -

                                                                            Version 1.7  — Rev. 17

                                                                            +

                                                                            Version 1.7  — Rev. 18


                                                                              diff --git a/dist/docs/VHWebSocket_Help.html b/dist/docs/VHWebSocket_Help.html index 32e8f485e..3c9416608 100644 --- a/dist/docs/VHWebSocket_Help.html +++ b/dist/docs/VHWebSocket_Help.html @@ -17,7 +17,7 @@

                                                                              OpenLiteSpeed Web Server Users' Manual

                                                                              -

                                                                              Version 1.7  — Rev. 17

                                                                              +

                                                                              Version 1.7  — Rev. 18


                                                                                diff --git a/dist/docs/VirtualHosts_Help.html b/dist/docs/VirtualHosts_Help.html index c534ba67b..c3841fac5 100644 --- a/dist/docs/VirtualHosts_Help.html +++ b/dist/docs/VirtualHosts_Help.html @@ -17,7 +17,7 @@

                                                                                OpenLiteSpeed Web Server Users' Manual

                                                                                -

                                                                                Version 1.7  — Rev. 17

                                                                                +

                                                                                Version 1.7  — Rev. 18


                                                                                  diff --git a/dist/docs/admin.html b/dist/docs/admin.html index c209437ee..6b6fb2d0a 100644 --- a/dist/docs/admin.html +++ b/dist/docs/admin.html @@ -17,7 +17,7 @@

                                                                                  OpenLiteSpeed Web Server Users' Manual

                                                                                  -

                                                                                  Version 1.7  — Rev. 17

                                                                                  +

                                                                                  Version 1.7  — Rev. 18


                                                                                    diff --git a/dist/docs/config.html b/dist/docs/config.html index 37118839d..c2075f288 100644 --- a/dist/docs/config.html +++ b/dist/docs/config.html @@ -17,7 +17,7 @@

                                                                                    OpenLiteSpeed Web Server Users' Manual

                                                                                    -

                                                                                    Version 1.7  — Rev. 17

                                                                                    +

                                                                                    Version 1.7  — Rev. 18


                                                                                      diff --git a/dist/docs/index.html b/dist/docs/index.html index defbf021c..5db48f065 100644 --- a/dist/docs/index.html +++ b/dist/docs/index.html @@ -17,7 +17,7 @@

                                                                                      OpenLiteSpeed Web Server Users' Manual

                                                                                      -

                                                                                      Version 1.7  — Rev. 17

                                                                                      +

                                                                                      Version 1.7  — Rev. 18


                                                                                        @@ -102,7 +102,7 @@



                                                                                        Users' Manual

                                                                                        - — Rev. 17 + — Rev. 18


                                                                                        diff --git a/dist/docs/install.html b/dist/docs/install.html index 5bb7275ab..6410550e4 100644 --- a/dist/docs/install.html +++ b/dist/docs/install.html @@ -17,7 +17,7 @@

                                                                                        OpenLiteSpeed Web Server Users' Manual

                                                                                        -

                                                                                        Version 1.7  — Rev. 17

                                                                                        +

                                                                                        Version 1.7  — Rev. 18


                                                                                        diff --git a/dist/docs/license.html b/dist/docs/license.html index eb40bbf67..a961ba121 100644 --- a/dist/docs/license.html +++ b/dist/docs/license.html @@ -17,7 +17,7 @@

                                                                                        OpenLiteSpeed Web Server Users' Manual

                                                                                        -

                                                                                        Version 1.7  — Rev. 17

                                                                                        +

                                                                                        Version 1.7  — Rev. 18


                                                                                          diff --git a/dist/docs/security.html b/dist/docs/security.html index bc3241d83..677a888cd 100644 --- a/dist/docs/security.html +++ b/dist/docs/security.html @@ -17,7 +17,7 @@

                                                                                          OpenLiteSpeed Web Server Users' Manual

                                                                                          -

                                                                                          Version 1.7  — Rev. 17

                                                                                          +

                                                                                          Version 1.7  — Rev. 18


                                                                                            diff --git a/dist/docs/webconsole.html b/dist/docs/webconsole.html index d17f1065d..84c9ef9df 100644 --- a/dist/docs/webconsole.html +++ b/dist/docs/webconsole.html @@ -17,7 +17,7 @@

                                                                                            OpenLiteSpeed Web Server Users' Manual

                                                                                            -

                                                                                            Version 1.7  — Rev. 17

                                                                                            +

                                                                                            Version 1.7  — Rev. 18


                                                                                              diff --git a/dist/docs/zh-CN/AdminGeneral_Help.html b/dist/docs/zh-CN/AdminGeneral_Help.html index 4ec2f7d38..eda7b84b2 100644 --- a/dist/docs/zh-CN/AdminGeneral_Help.html +++ b/dist/docs/zh-CN/AdminGeneral_Help.html @@ -17,7 +17,7 @@

                                                                                              OpenLiteSpeed Web Server Users' Manual

                                                                                              -

                                                                                              Version 1.7  — Rev. 17

                                                                                              +

                                                                                              Version 1.7  — Rev. 18


                                                                                                diff --git a/dist/docs/zh-CN/AdminListeners_General_Help.html b/dist/docs/zh-CN/AdminListeners_General_Help.html index c214b993d..127f96963 100644 --- a/dist/docs/zh-CN/AdminListeners_General_Help.html +++ b/dist/docs/zh-CN/AdminListeners_General_Help.html @@ -17,7 +17,7 @@

                                                                                                OpenLiteSpeed Web Server Users' Manual

                                                                                                -

                                                                                                Version 1.7  — Rev. 17

                                                                                                +

                                                                                                Version 1.7  — Rev. 18


                                                                                                  @@ -99,10 +99,10 @@

                                                                                                  Version 1.7  — Rev. 17

                                                                                                  Admin Listeners General

                                                                                                  Admin Listeners are dedicated to the Admin Server. Secure (SSL) listeners are recommended for the Admin Server.

                                                                                                  Table of Contents

                                                                                                  General

                                                                                                  -侦听器名称 | IP地址 | 端口 | 安全

                                                                                                  +侦听器名称 | IP Address | 端口 | 安全

                                                                                                  侦听器名称

                                                                                                  Description

                                                                                                  此侦听器的唯一名称。

                                                                                                  -

                                                                                                  IP地址

                                                                                                  Description

                                                                                                  指定此侦听器的IP。 列出了所有可用的IP地址。 IPv6地址包含在“ []”中。 要监听所有IPv4 IP地址,请使用 ANY. 要侦听所有IPv4和IPv6 IP地址,请使用[ANY]. clients, 为了同时为IPv4和IPv6客户端提供服务,应使用IPv4映射的IPv6地址代替纯IPv4地址。 IPv4映射的IPv6地址写为[::FFFF:x.x.x.x]。

                                                                                                  Syntax

                                                                                                  从列表中选择

                                                                                                  提示

                                                                                                  If your machine has multiple IPs on different sub-networks, you can select a specific IP to only allow traffic from the corresponding sub-network.

                                                                                                  +

                                                                                                  IP Address

                                                                                                  Description

                                                                                                  指定此监听器的IP地址.所有可用的IP地址都列出了. IPv6地址应包含"[ ]".

                                                                                                  如果要监听所有IPV4地址, 选择 ANY. 要监听所有IPV4和IPV6地址,选择 [ANY].

                                                                                                  为了同时为IPv4和IPv6客户端提供服务,应使用IPv4映射的IPv6地址代替纯IPv4地址。 IPv4映射的IPv6地址应写为[::FFFF:x.x.x.x].

                                                                                                  Syntax

                                                                                                  从列表中选择

                                                                                                  提示

                                                                                                  [安全建议] 如果您的计算机在不同的子网中具有多个IP, 您可以选择特定的IP以仅允许来自相应子网的流量。

                                                                                                  端口

                                                                                                  Description

                                                                                                  指定侦听器的TCP端口。 只有超级用户(root)可以使用低于1024的端口。 端口80是默认的HTTP端口。 端口443是默认的HTTPS端口。

                                                                                                  Syntax

                                                                                                  整数

                                                                                                  安全

                                                                                                  Description

                                                                                                  指定这是否是安全(SSL)侦听器。 对于安全的侦听器,需要正确设置其他SSL设置。

                                                                                                  Syntax

                                                                                                  从单选框选择

                                                                                                  diff --git a/dist/docs/zh-CN/AdminListeners_SSL_Help.html b/dist/docs/zh-CN/AdminListeners_SSL_Help.html index e1be42036..9683f9871 100644 --- a/dist/docs/zh-CN/AdminListeners_SSL_Help.html +++ b/dist/docs/zh-CN/AdminListeners_SSL_Help.html @@ -17,7 +17,7 @@

                                                                                                  OpenLiteSpeed Web Server Users' Manual

                                                                                                  -

                                                                                                  Version 1.7  — Rev. 17

                                                                                                  +

                                                                                                  Version 1.7  — Rev. 18


                                                                                                    diff --git a/dist/docs/zh-CN/AdminSecurity_Help.html b/dist/docs/zh-CN/AdminSecurity_Help.html index 6e25696bb..66a729936 100644 --- a/dist/docs/zh-CN/AdminSecurity_Help.html +++ b/dist/docs/zh-CN/AdminSecurity_Help.html @@ -17,7 +17,7 @@

                                                                                                    OpenLiteSpeed Web Server Users' Manual

                                                                                                    -

                                                                                                    Version 1.7  — Rev. 17

                                                                                                    +

                                                                                                    Version 1.7  — Rev. 18


                                                                                                      diff --git a/dist/docs/zh-CN/App_Server_Context.html b/dist/docs/zh-CN/App_Server_Context.html index 2490110b9..c83117662 100644 --- a/dist/docs/zh-CN/App_Server_Context.html +++ b/dist/docs/zh-CN/App_Server_Context.html @@ -17,7 +17,7 @@

                                                                                                      OpenLiteSpeed Web Server Users' Manual

                                                                                                      -

                                                                                                      Version 1.7  — Rev. 17

                                                                                                      +

                                                                                                      Version 1.7  — Rev. 18


                                                                                                        @@ -123,7 +123,7 @@

                                                                                                        App Server Context

                                                                                                        Table of Contents

                                                                                                        启用重写

                                                                                                        Description

                                                                                                        指定是否启用LiteSpeed的URL重写. 可以在虚拟主机或context级别上自定义此选项, 并且沿目录树继承该选项,直到被其他选项覆。

                                                                                                        Syntax

                                                                                                        从单选框选择

                                                                                                      重写继承

                                                                                                      Description

                                                                                                      指定是否从父级context继承重写规则。 如果启用重写但不继承,将启用本context的重写基准及重写规则。

                                                                                                      Syntax

                                                                                                      从单选框选择

                                                                                                      重写基准

                                                                                                      Description

                                                                                                      指定重写规则的基准URL。

                                                                                                      Syntax

                                                                                                      URL

                                                                                                      -

                                                                                                      重写规则

                                                                                                      Description

                                                                                                      指定虚拟主机级别的重写规则。

                                                                                                      请勿在此处添加任何目录级重写规则。 如果您在.htaccess有任何目录级的重写规则,则应该使用uri"/"创建一个静态context, 并在那里添加重写规则。 (注:我也不知道这里说的什么鬼意思)

                                                                                                      重写规则由一个RewriteRule组成,并可可以在多个RewriteCond之后。

                                                                                                      • 每行仅能有一条规则
                                                                                                      • RewriteCondRewriteRule 遵循Apache的rewrite语法。 只需从Apache配置文件中复制并粘贴重写规则即可。
                                                                                                      • LiteSpeed和Apache mod_rewrite之间有细微差别:
                                                                                                        • %\{LA-U:variable\} and %\{LA-F:variable\} 在Litespeed 重写中将被忽略
                                                                                                        • Litespeed中加入了两个新变量: %\{CURRENT_URI\}表示正在处理的URL %\{SCRIPT_NAME\}表示为相应的CGI环境变量。
                                                                                                        • Litespeed在遇到[L]后为了避免循环将停止处理此及此后的重写规则 而Apache mod_rewrite将仅停止处理该条重写规则。此行为类似于apachemod_rewrite中的[END]标志。

                                                                                                      LiteSpeed的重写规则遵循Apache的重写规范。 有关重写规则的更多详细信息,请参阅 Apache's mod_rewrite document(英文文档) Apache's URL rewriting guide(英文文档) .

                                                                                                      Syntax

                                                                                                      string

                                                                                                      +

                                                                                                      重写规则

                                                                                                      Description

                                                                                                      指定虚拟主机级别的重写规则。

                                                                                                      请勿在此处添加任何目录级重写规则。 如果您在.htaccess有任何目录级的重写规则,则应该使用uri"/"创建一个静态context, 并在那里添加重写规则。

                                                                                                      重写规则由一个RewriteRule组成,并可可以在多个RewriteCond之后。

                                                                                                      • 每行仅能有一条规则
                                                                                                      • RewriteCondRewriteRule 遵循Apache的rewrite语法。 只需从Apache配置文件中复制并粘贴重写规则即可。
                                                                                                      • LiteSpeed和Apache mod_rewrite之间有细微差别:
                                                                                                        • %\{LA-U:variable\} and %\{LA-F:variable\} 在Litespeed 重写中将被忽略
                                                                                                        • Litespeed中加入了两个新变量: %\{CURRENT_URI\}表示正在处理的URL %\{SCRIPT_NAME\}表示为相应的CGI环境变量。
                                                                                                        • Litespeed在遇到[L]后为了避免循环将停止处理此及此后的重写规则 而Apache mod_rewrite将仅停止处理该条重写规则。此行为类似于apachemod_rewrite中的[END]标志。

                                                                                                      LiteSpeed的重写规则遵循Apache的重写规范。 有关重写规则的更多详细信息,请参阅 Apache's mod_rewrite document(英文文档) Apache's URL rewriting guide(英文文档) .

                                                                                                      Syntax

                                                                                                      string

                                                                                                      添加默认的字符集

                                                                                                      Description

                                                                                                      S指定当内容类型是"text/html"或"text/plain"且没有参数时,是否添加字符集标记到"Content-Type"响应报头中。当设置为Off时,该功能禁用。当设置为On时,将添加自定义默认字符集中指定的字符集,如果没有指定,将添加默认的"iso-8859-1"字符集。

                                                                                                      Syntax

                                                                                                      从单选框选择

                                                                                                      diff --git a/dist/docs/zh-CN/App_Server_Help.html b/dist/docs/zh-CN/App_Server_Help.html index 97bf15383..2cccbfd13 100644 --- a/dist/docs/zh-CN/App_Server_Help.html +++ b/dist/docs/zh-CN/App_Server_Help.html @@ -17,7 +17,7 @@

                                                                                                      OpenLiteSpeed Web Server Users' Manual

                                                                                                      -

                                                                                                      Version 1.7  — Rev. 17

                                                                                                      +

                                                                                                      Version 1.7  — Rev. 18


                                                                                                        diff --git a/dist/docs/zh-CN/CGI_Context.html b/dist/docs/zh-CN/CGI_Context.html index 3c1c04564..c091ebafb 100644 --- a/dist/docs/zh-CN/CGI_Context.html +++ b/dist/docs/zh-CN/CGI_Context.html @@ -17,7 +17,7 @@

                                                                                                        OpenLiteSpeed Web Server Users' Manual

                                                                                                        -

                                                                                                        Version 1.7  — Rev. 17

                                                                                                        +

                                                                                                        Version 1.7  — Rev. 18


                                                                                                          @@ -115,7 +115,7 @@

                                                                                                          CGI Context

                                                                                                          Table of Contents

                                                                                                          启用重写

                                                                                                          Description

                                                                                                          指定是否启用LiteSpeed的URL重写. 可以在虚拟主机或context级别上自定义此选项, 并且沿目录树继承该选项,直到被其他选项覆。

                                                                                                          Syntax

                                                                                                          从单选框选择

                                                                                                        重写继承

                                                                                                        Description

                                                                                                        指定是否从父级context继承重写规则。 如果启用重写但不继承,将启用本context的重写基准及重写规则。

                                                                                                        Syntax

                                                                                                        从单选框选择

                                                                                                        重写基准

                                                                                                        Description

                                                                                                        指定重写规则的基准URL。

                                                                                                        Syntax

                                                                                                        URL

                                                                                                        -

                                                                                                        重写规则

                                                                                                        Description

                                                                                                        指定虚拟主机级别的重写规则。

                                                                                                        请勿在此处添加任何目录级重写规则。 如果您在.htaccess有任何目录级的重写规则,则应该使用uri"/"创建一个静态context, 并在那里添加重写规则。 (注:我也不知道这里说的什么鬼意思)

                                                                                                        重写规则由一个RewriteRule组成,并可可以在多个RewriteCond之后。

                                                                                                        • 每行仅能有一条规则
                                                                                                        • RewriteCondRewriteRule 遵循Apache的rewrite语法。 只需从Apache配置文件中复制并粘贴重写规则即可。
                                                                                                        • LiteSpeed和Apache mod_rewrite之间有细微差别:
                                                                                                          • %\{LA-U:variable\} and %\{LA-F:variable\} 在Litespeed 重写中将被忽略
                                                                                                          • Litespeed中加入了两个新变量: %\{CURRENT_URI\}表示正在处理的URL %\{SCRIPT_NAME\}表示为相应的CGI环境变量。
                                                                                                          • Litespeed在遇到[L]后为了避免循环将停止处理此及此后的重写规则 而Apache mod_rewrite将仅停止处理该条重写规则。此行为类似于apachemod_rewrite中的[END]标志。

                                                                                                        LiteSpeed的重写规则遵循Apache的重写规范。 有关重写规则的更多详细信息,请参阅 Apache's mod_rewrite document(英文文档) Apache's URL rewriting guide(英文文档) .

                                                                                                        Syntax

                                                                                                        string

                                                                                                        +

                                                                                                        重写规则

                                                                                                        Description

                                                                                                        指定虚拟主机级别的重写规则。

                                                                                                        请勿在此处添加任何目录级重写规则。 如果您在.htaccess有任何目录级的重写规则,则应该使用uri"/"创建一个静态context, 并在那里添加重写规则。

                                                                                                        重写规则由一个RewriteRule组成,并可可以在多个RewriteCond之后。

                                                                                                        • 每行仅能有一条规则
                                                                                                        • RewriteCondRewriteRule 遵循Apache的rewrite语法。 只需从Apache配置文件中复制并粘贴重写规则即可。
                                                                                                        • LiteSpeed和Apache mod_rewrite之间有细微差别:
                                                                                                          • %\{LA-U:variable\} and %\{LA-F:variable\} 在Litespeed 重写中将被忽略
                                                                                                          • Litespeed中加入了两个新变量: %\{CURRENT_URI\}表示正在处理的URL %\{SCRIPT_NAME\}表示为相应的CGI环境变量。
                                                                                                          • Litespeed在遇到[L]后为了避免循环将停止处理此及此后的重写规则 而Apache mod_rewrite将仅停止处理该条重写规则。此行为类似于apachemod_rewrite中的[END]标志。

                                                                                                        LiteSpeed的重写规则遵循Apache的重写规范。 有关重写规则的更多详细信息,请参阅 Apache's mod_rewrite document(英文文档) Apache's URL rewriting guide(英文文档) .

                                                                                                        Syntax

                                                                                                        string

                                                                                                        diff --git a/dist/docs/zh-CN/CompilePHP_Help.html b/dist/docs/zh-CN/CompilePHP_Help.html index 737d517d8..ba3f0eb56 100644 --- a/dist/docs/zh-CN/CompilePHP_Help.html +++ b/dist/docs/zh-CN/CompilePHP_Help.html @@ -17,7 +17,7 @@

                                                                                                        OpenLiteSpeed Web Server Users' Manual

                                                                                                        -

                                                                                                        Version 1.7  — Rev. 17

                                                                                                        +

                                                                                                        Version 1.7  — Rev. 18


                                                                                                          diff --git a/dist/docs/zh-CN/Context_Help.html b/dist/docs/zh-CN/Context_Help.html index f8c4c8a3d..246b3b2ec 100644 --- a/dist/docs/zh-CN/Context_Help.html +++ b/dist/docs/zh-CN/Context_Help.html @@ -17,7 +17,7 @@

                                                                                                          OpenLiteSpeed Web Server Users' Manual

                                                                                                          -

                                                                                                          Version 1.7  — Rev. 17

                                                                                                          +

                                                                                                          Version 1.7  — Rev. 18


                                                                                                            diff --git a/dist/docs/zh-CN/ExtApp_Help.html b/dist/docs/zh-CN/ExtApp_Help.html index a418abe8b..dbec4d157 100644 --- a/dist/docs/zh-CN/ExtApp_Help.html +++ b/dist/docs/zh-CN/ExtApp_Help.html @@ -17,7 +17,7 @@

                                                                                                            OpenLiteSpeed Web Server Users' Manual

                                                                                                            -

                                                                                                            Version 1.7  — Rev. 17

                                                                                                            +

                                                                                                            Version 1.7  — Rev. 18


                                                                                                              diff --git a/dist/docs/zh-CN/External_FCGI.html b/dist/docs/zh-CN/External_FCGI.html index 305905cb6..ce5f22871 100644 --- a/dist/docs/zh-CN/External_FCGI.html +++ b/dist/docs/zh-CN/External_FCGI.html @@ -17,7 +17,7 @@

                                                                                                              OpenLiteSpeed Web Server Users' Manual

                                                                                                              -

                                                                                                              Version 1.7  — Rev. 17

                                                                                                              +

                                                                                                              Version 1.7  — Rev. 18


                                                                                                                diff --git a/dist/docs/zh-CN/External_FCGI_Auth.html b/dist/docs/zh-CN/External_FCGI_Auth.html index ad132f7ad..94a0d6864 100644 --- a/dist/docs/zh-CN/External_FCGI_Auth.html +++ b/dist/docs/zh-CN/External_FCGI_Auth.html @@ -17,7 +17,7 @@

                                                                                                                OpenLiteSpeed Web Server Users' Manual

                                                                                                                -

                                                                                                                Version 1.7  — Rev. 17

                                                                                                                +

                                                                                                                Version 1.7  — Rev. 18


                                                                                                                  diff --git a/dist/docs/zh-CN/External_LB.html b/dist/docs/zh-CN/External_LB.html index 1bdc64e12..241663f4a 100644 --- a/dist/docs/zh-CN/External_LB.html +++ b/dist/docs/zh-CN/External_LB.html @@ -17,7 +17,7 @@

                                                                                                                  OpenLiteSpeed Web Server Users' Manual

                                                                                                                  -

                                                                                                                  Version 1.7  — Rev. 17

                                                                                                                  +

                                                                                                                  Version 1.7  — Rev. 18


                                                                                                                    diff --git a/dist/docs/zh-CN/External_LSAPI.html b/dist/docs/zh-CN/External_LSAPI.html index c3e9e609c..a823615b4 100644 --- a/dist/docs/zh-CN/External_LSAPI.html +++ b/dist/docs/zh-CN/External_LSAPI.html @@ -17,7 +17,7 @@

                                                                                                                    OpenLiteSpeed Web Server Users' Manual

                                                                                                                    -

                                                                                                                    Version 1.7  — Rev. 17

                                                                                                                    +

                                                                                                                    Version 1.7  — Rev. 18


                                                                                                                      diff --git a/dist/docs/zh-CN/External_PL.html b/dist/docs/zh-CN/External_PL.html index 5e49f836c..cefecaa02 100644 --- a/dist/docs/zh-CN/External_PL.html +++ b/dist/docs/zh-CN/External_PL.html @@ -17,7 +17,7 @@

                                                                                                                      OpenLiteSpeed Web Server Users' Manual

                                                                                                                      -

                                                                                                                      Version 1.7  — Rev. 17

                                                                                                                      +

                                                                                                                      Version 1.7  — Rev. 18


                                                                                                                        diff --git a/dist/docs/zh-CN/External_Servlet.html b/dist/docs/zh-CN/External_Servlet.html index bab92021f..4647104e6 100644 --- a/dist/docs/zh-CN/External_Servlet.html +++ b/dist/docs/zh-CN/External_Servlet.html @@ -17,7 +17,7 @@

                                                                                                                        OpenLiteSpeed Web Server Users' Manual

                                                                                                                        -

                                                                                                                        Version 1.7  — Rev. 17

                                                                                                                        +

                                                                                                                        Version 1.7  — Rev. 18


                                                                                                                          diff --git a/dist/docs/zh-CN/External_WS.html b/dist/docs/zh-CN/External_WS.html index 623f58e7f..f2b58d154 100644 --- a/dist/docs/zh-CN/External_WS.html +++ b/dist/docs/zh-CN/External_WS.html @@ -17,7 +17,7 @@

                                                                                                                          OpenLiteSpeed Web Server Users' Manual

                                                                                                                          -

                                                                                                                          Version 1.7  — Rev. 17

                                                                                                                          +

                                                                                                                          Version 1.7  — Rev. 18


                                                                                                                            diff --git a/dist/docs/zh-CN/FCGI_Context.html b/dist/docs/zh-CN/FCGI_Context.html index 2ce53d76e..6d8f3cb79 100644 --- a/dist/docs/zh-CN/FCGI_Context.html +++ b/dist/docs/zh-CN/FCGI_Context.html @@ -17,7 +17,7 @@

                                                                                                                            OpenLiteSpeed Web Server Users' Manual

                                                                                                                            -

                                                                                                                            Version 1.7  — Rev. 17

                                                                                                                            +

                                                                                                                            Version 1.7  — Rev. 18


                                                                                                                              diff --git a/dist/docs/zh-CN/Java_Web_App_Context.html b/dist/docs/zh-CN/Java_Web_App_Context.html index 237ab1fe2..ae8db104b 100644 --- a/dist/docs/zh-CN/Java_Web_App_Context.html +++ b/dist/docs/zh-CN/Java_Web_App_Context.html @@ -17,7 +17,7 @@

                                                                                                                              OpenLiteSpeed Web Server Users' Manual

                                                                                                                              -

                                                                                                                              Version 1.7  — Rev. 17

                                                                                                                              +

                                                                                                                              Version 1.7  — Rev. 18


                                                                                                                                diff --git a/dist/docs/zh-CN/LB_Context.html b/dist/docs/zh-CN/LB_Context.html index b0e157418..1e5871bae 100644 --- a/dist/docs/zh-CN/LB_Context.html +++ b/dist/docs/zh-CN/LB_Context.html @@ -17,7 +17,7 @@

                                                                                                                                OpenLiteSpeed Web Server Users' Manual

                                                                                                                                -

                                                                                                                                Version 1.7  — Rev. 17

                                                                                                                                +

                                                                                                                                Version 1.7  — Rev. 18


                                                                                                                                  diff --git a/dist/docs/zh-CN/LSAPI_Context.html b/dist/docs/zh-CN/LSAPI_Context.html index b9c821056..263ed07fa 100644 --- a/dist/docs/zh-CN/LSAPI_Context.html +++ b/dist/docs/zh-CN/LSAPI_Context.html @@ -17,7 +17,7 @@

                                                                                                                                  OpenLiteSpeed Web Server Users' Manual

                                                                                                                                  -

                                                                                                                                  Version 1.7  — Rev. 17

                                                                                                                                  +

                                                                                                                                  Version 1.7  — Rev. 18


                                                                                                                                    diff --git a/dist/docs/zh-CN/Listeners_General_Help.html b/dist/docs/zh-CN/Listeners_General_Help.html index 346d97e3f..2f30af75e 100644 --- a/dist/docs/zh-CN/Listeners_General_Help.html +++ b/dist/docs/zh-CN/Listeners_General_Help.html @@ -17,7 +17,7 @@

                                                                                                                                    OpenLiteSpeed Web Server Users' Manual

                                                                                                                                    -

                                                                                                                                    Version 1.7  — Rev. 17

                                                                                                                                    +

                                                                                                                                    Version 1.7  — Rev. 18


                                                                                                                                      @@ -97,12 +97,12 @@

                                                                                                                                      Version 1.7  — Rev. 17

                                                                                                                                      侦听器设置

                                                                                                                                      Table of Contents

                                                                                                                                      地址设定

                                                                                                                                      -侦听器名称 | IP地址 | 端口 | 绑定 | 启用REUSEPORT | 安全

                                                                                                                                      +侦听器名称 | IP Address | 端口 | 绑定 | 启用REUSEPORT | 安全

                                                                                                                                      虚拟主机映射

                                                                                                                                      虚拟主机 | 域名

                                                                                                                                      侦听器名称

                                                                                                                                      Description

                                                                                                                                      此侦听器的唯一名称。

                                                                                                                                      -

                                                                                                                                      IP地址

                                                                                                                                      Description

                                                                                                                                      指定此侦听器的IP。 列出了所有可用的IP地址。 IPv6地址包含在“ []”中。 要监听所有IPv4 IP地址,请使用 ANY. 要侦听所有IPv4和IPv6 IP地址,请使用[ANY]. clients, 为了同时为IPv4和IPv6客户端提供服务,应使用IPv4映射的IPv6地址代替纯IPv4地址。 IPv4映射的IPv6地址写为[::FFFF:x.x.x.x]。

                                                                                                                                      Syntax

                                                                                                                                      从列表中选择

                                                                                                                                      提示

                                                                                                                                      If your machine has multiple IPs on different sub-networks, you can select a specific IP to only allow traffic from the corresponding sub-network.

                                                                                                                                      +

                                                                                                                                      IP Address

                                                                                                                                      Description

                                                                                                                                      指定此监听器的IP地址.所有可用的IP地址都列出了. IPv6地址应包含"[ ]".

                                                                                                                                      如果要监听所有IPV4地址, 选择 ANY. 要监听所有IPV4和IPV6地址,选择 [ANY].

                                                                                                                                      为了同时为IPv4和IPv6客户端提供服务,应使用IPv4映射的IPv6地址代替纯IPv4地址。 IPv4映射的IPv6地址应写为[::FFFF:x.x.x.x].

                                                                                                                                      Syntax

                                                                                                                                      从列表中选择

                                                                                                                                      提示

                                                                                                                                      [安全建议] 如果您的计算机在不同的子网中具有多个IP, 您可以选择特定的IP以仅允许来自相应子网的流量。

                                                                                                                                      端口

                                                                                                                                      Description

                                                                                                                                      指定侦听器的TCP端口。 只有超级用户(root)可以使用低于1024的端口。 端口80是默认的HTTP端口。 端口443是默认的HTTPS端口。

                                                                                                                                      Syntax

                                                                                                                                      整数

                                                                                                                                      绑定

                                                                                                                                      Description

                                                                                                                                      指定侦听器分配给哪个lshttpd子进程。 通过手动将侦听器与进程相关联,可以使用不同的子进程来处理对不同侦听器的请求。 默认情况下,将侦听器分配给所有子进程。

                                                                                                                                      Syntax

                                                                                                                                      从复选框中选择

                                                                                                                                      启用REUSEPORT

                                                                                                                                      Description

                                                                                                                                      使用SO_REUSEPORT套接字选项将传入流量分配给多个工作进程。 此设置仅对multi-worker可证有效。 启用后,所有工作程序都将自动绑定到此侦听器,并且将忽略“绑定”配置。

                                                                                                                                      Default value: On

                                                                                                                                      Syntax

                                                                                                                                      从单选框选择

                                                                                                                                      diff --git a/dist/docs/zh-CN/Listeners_SSL_Help.html b/dist/docs/zh-CN/Listeners_SSL_Help.html index f7457ab2d..5da283226 100644 --- a/dist/docs/zh-CN/Listeners_SSL_Help.html +++ b/dist/docs/zh-CN/Listeners_SSL_Help.html @@ -17,7 +17,7 @@

                                                                                                                                      OpenLiteSpeed Web Server Users' Manual

                                                                                                                                      -

                                                                                                                                      Version 1.7  — Rev. 17

                                                                                                                                      +

                                                                                                                                      Version 1.7  — Rev. 18


                                                                                                                                        diff --git a/dist/docs/zh-CN/Module_Context.html b/dist/docs/zh-CN/Module_Context.html index a04aab778..e00d90d17 100644 --- a/dist/docs/zh-CN/Module_Context.html +++ b/dist/docs/zh-CN/Module_Context.html @@ -17,7 +17,7 @@

                                                                                                                                        OpenLiteSpeed Web Server Users' Manual

                                                                                                                                        -

                                                                                                                                        Version 1.7  — Rev. 17

                                                                                                                                        +

                                                                                                                                        Version 1.7  — Rev. 18


                                                                                                                                          diff --git a/dist/docs/zh-CN/Module_Help.html b/dist/docs/zh-CN/Module_Help.html index f0e9cd352..9741329f5 100644 --- a/dist/docs/zh-CN/Module_Help.html +++ b/dist/docs/zh-CN/Module_Help.html @@ -17,7 +17,7 @@

                                                                                                                                          OpenLiteSpeed Web Server Users' Manual

                                                                                                                                          -

                                                                                                                                          Version 1.7  — Rev. 17

                                                                                                                                          +

                                                                                                                                          Version 1.7  — Rev. 18


                                                                                                                                            diff --git a/dist/docs/zh-CN/Proxy_Context.html b/dist/docs/zh-CN/Proxy_Context.html index 6441f0506..fcc347636 100644 --- a/dist/docs/zh-CN/Proxy_Context.html +++ b/dist/docs/zh-CN/Proxy_Context.html @@ -17,7 +17,7 @@

                                                                                                                                            OpenLiteSpeed Web Server Users' Manual

                                                                                                                                            -

                                                                                                                                            Version 1.7  — Rev. 17

                                                                                                                                            +

                                                                                                                                            Version 1.7  — Rev. 18


                                                                                                                                              diff --git a/dist/docs/zh-CN/Redirect_Context.html b/dist/docs/zh-CN/Redirect_Context.html index 98b16ecb8..88f6fe767 100644 --- a/dist/docs/zh-CN/Redirect_Context.html +++ b/dist/docs/zh-CN/Redirect_Context.html @@ -17,7 +17,7 @@

                                                                                                                                              OpenLiteSpeed Web Server Users' Manual

                                                                                                                                              -

                                                                                                                                              Version 1.7  — Rev. 17

                                                                                                                                              +

                                                                                                                                              Version 1.7  — Rev. 18


                                                                                                                                                diff --git a/dist/docs/zh-CN/Rewrite_Help.html b/dist/docs/zh-CN/Rewrite_Help.html index 75c0a5240..47c1d55fb 100644 --- a/dist/docs/zh-CN/Rewrite_Help.html +++ b/dist/docs/zh-CN/Rewrite_Help.html @@ -17,7 +17,7 @@

                                                                                                                                                OpenLiteSpeed Web Server Users' Manual

                                                                                                                                                -

                                                                                                                                                Version 1.7  — Rev. 17

                                                                                                                                                +

                                                                                                                                                Version 1.7  — Rev. 18


                                                                                                                                                  @@ -108,7 +108,7 @@

                                                                                                                                                  重写帮助

                                                                                                                                                  Table of Contents

                                                                                                                                                  日志级别

                                                                                                                                                  Description

                                                                                                                                                  指定重写调试输出的详细程度。 此值的范围是0-9。 设置为0将禁用日志记录。 设置为9将产生 最详细的日志。 服务器和虚拟主机的错误日志日志级别 至少设置为INFO才能使此选项生效。 这对测试重写规则很有帮助。

                                                                                                                                                  Syntax

                                                                                                                                                  整数

                                                                                                                                                  See Also

                                                                                                                                                  Server 日志级别, Virtual Host 日志级别

                                                                                                                                                名称

                                                                                                                                                Description

                                                                                                                                                Specifies a unique name for the rewrite map at the virtual host level. This name will be used by a mapping-reference in rewrite rules. When referencing this name, one of the following syntaxes should be used:

                                                                                                                                                $\{MapName:LookupKey\}
                                                                                                                                                $\{MapName:LookupKey|DefaultValue\}

                                                                                                                                                The implementation of LiteSpeed's rewrite engine follows the specifications of Apache's rewrite engine. For more details about rewrite maps, please refer to Apache's mod_rewrite document.

                                                                                                                                                Syntax

                                                                                                                                                string

                                                                                                                                                Location

                                                                                                                                                Description

                                                                                                                                                Specifies the location of the rewrite map using the syntax MapType:MapSource.
                                                                                                                                                LiteSpeed's rewrite engine supports three types of rewrite maps:

                                                                                                                                                • Standard Plain Text
                                                                                                                                                  MapType: txt;
                                                                                                                                                  MapSource: file path to a valid plain ASCII file.
                                                                                                                                                  Each line of this file should contain two elements separated by blank spaces. The first element is the key and the second element is the value. Comments can be added with a leading "#" sign.
                                                                                                                                                • Randomized Plain Text
                                                                                                                                                  MapType: rnd;
                                                                                                                                                  MapSource: file path of a valid plain ASCII file.
                                                                                                                                                  File format is similar to the Standard Plain Text file, except that the second element can contain multiple choices separated by a "|" sign and chosen randomly by the rewrite engine.
                                                                                                                                                • Internal Function
                                                                                                                                                  MapType: int;
                                                                                                                                                  MapSource: Internal string function
                                                                                                                                                  4 functions are available:
                                                                                                                                                  • toupper: converts lookup key to upper cases.
                                                                                                                                                  • tolower: converts lookup key to lower cases.
                                                                                                                                                  • escape: perform URL encoding on lookup key.
                                                                                                                                                  • unescape: perform URL decoding on lookup key.
                                                                                                                                                • The following map types available in Apache have not been implemented in LiteSpeed:
                                                                                                                                                  Hash File and External Rewriting Program.
                                                                                                                                                The implementation of LiteSpeed's rewrite engine follows the specifications of Apache's rewrite engine. For more details about rewrite map, please refer to Apache's mod_rewrite document.

                                                                                                                                                Syntax

                                                                                                                                                String

                                                                                                                                                -

                                                                                                                                                重写规则

                                                                                                                                                Description

                                                                                                                                                指定虚拟主机级别的重写规则。

                                                                                                                                                请勿在此处添加任何目录级重写规则。 如果您在.htaccess有任何目录级的重写规则,则应该使用uri"/"创建一个静态context, 并在那里添加重写规则。 (注:我也不知道这里说的什么鬼意思)

                                                                                                                                                重写规则由一个RewriteRule组成,并可可以在多个RewriteCond之后。

                                                                                                                                                • 每行仅能有一条规则
                                                                                                                                                • RewriteCondRewriteRule 遵循Apache的rewrite语法。 只需从Apache配置文件中复制并粘贴重写规则即可。
                                                                                                                                                • LiteSpeed和Apache mod_rewrite之间有细微差别:
                                                                                                                                                  • %\{LA-U:variable\} and %\{LA-F:variable\} 在Litespeed 重写中将被忽略
                                                                                                                                                  • Litespeed中加入了两个新变量: %\{CURRENT_URI\}表示正在处理的URL %\{SCRIPT_NAME\}表示为相应的CGI环境变量。
                                                                                                                                                  • Litespeed在遇到[L]后为了避免循环将停止处理此及此后的重写规则 而Apache mod_rewrite将仅停止处理该条重写规则。此行为类似于apachemod_rewrite中的[END]标志。

                                                                                                                                                LiteSpeed的重写规则遵循Apache的重写规范。 有关重写规则的更多详细信息,请参阅 Apache's mod_rewrite document(英文文档) Apache's URL rewriting guide(英文文档) .

                                                                                                                                                Syntax

                                                                                                                                                string

                                                                                                                                                +

                                                                                                                                                重写规则

                                                                                                                                                Description

                                                                                                                                                指定虚拟主机级别的重写规则。

                                                                                                                                                请勿在此处添加任何目录级重写规则。 如果您在.htaccess有任何目录级的重写规则,则应该使用uri"/"创建一个静态context, 并在那里添加重写规则。

                                                                                                                                                重写规则由一个RewriteRule组成,并可可以在多个RewriteCond之后。

                                                                                                                                                • 每行仅能有一条规则
                                                                                                                                                • RewriteCondRewriteRule 遵循Apache的rewrite语法。 只需从Apache配置文件中复制并粘贴重写规则即可。
                                                                                                                                                • LiteSpeed和Apache mod_rewrite之间有细微差别:
                                                                                                                                                  • %\{LA-U:variable\} and %\{LA-F:variable\} 在Litespeed 重写中将被忽略
                                                                                                                                                  • Litespeed中加入了两个新变量: %\{CURRENT_URI\}表示正在处理的URL %\{SCRIPT_NAME\}表示为相应的CGI环境变量。
                                                                                                                                                  • Litespeed在遇到[L]后为了避免循环将停止处理此及此后的重写规则 而Apache mod_rewrite将仅停止处理该条重写规则。此行为类似于apachemod_rewrite中的[END]标志。

                                                                                                                                                LiteSpeed的重写规则遵循Apache的重写规范。 有关重写规则的更多详细信息,请参阅 Apache's mod_rewrite document(英文文档) Apache's URL rewriting guide(英文文档) .

                                                                                                                                                Syntax

                                                                                                                                                string

                                                                                                                                    diff --git a/dist/docs/zh-CN/ScriptHandler_Help.html b/dist/docs/zh-CN/ScriptHandler_Help.html index 920e9a30f..63af0b735 100644 --- a/dist/docs/zh-CN/ScriptHandler_Help.html +++ b/dist/docs/zh-CN/ScriptHandler_Help.html @@ -17,7 +17,7 @@

                                                                                                                                    OpenLiteSpeed Web Server Users' Manual

                                                                                                                                    -

                                                                                                                                    Version 1.7  — Rev. 17

                                                                                                                                    +

                                                                                                                                    Version 1.7  — Rev. 18


                                                                                                                                      diff --git a/dist/docs/zh-CN/ServGeneral_Help.html b/dist/docs/zh-CN/ServGeneral_Help.html index b2be6412b..7d3878e8b 100644 --- a/dist/docs/zh-CN/ServGeneral_Help.html +++ b/dist/docs/zh-CN/ServGeneral_Help.html @@ -17,7 +17,7 @@

                                                                                                                                      OpenLiteSpeed Web Server Users' Manual

                                                                                                                                      -

                                                                                                                                      Version 1.7  — Rev. 17

                                                                                                                                      +

                                                                                                                                      Version 1.7  — Rev. 18


                                                                                                                                        diff --git a/dist/docs/zh-CN/ServLog_Help.html b/dist/docs/zh-CN/ServLog_Help.html index 6b1e50c64..01a6ce4ee 100644 --- a/dist/docs/zh-CN/ServLog_Help.html +++ b/dist/docs/zh-CN/ServLog_Help.html @@ -17,7 +17,7 @@

                                                                                                                                        OpenLiteSpeed Web Server Users' Manual

                                                                                                                                        -

                                                                                                                                        Version 1.7  — Rev. 17

                                                                                                                                        +

                                                                                                                                        Version 1.7  — Rev. 18


                                                                                                                                          diff --git a/dist/docs/zh-CN/ServSecurity_Help.html b/dist/docs/zh-CN/ServSecurity_Help.html index 1408625db..b6d5e76a5 100644 --- a/dist/docs/zh-CN/ServSecurity_Help.html +++ b/dist/docs/zh-CN/ServSecurity_Help.html @@ -17,7 +17,7 @@

                                                                                                                                          OpenLiteSpeed Web Server Users' Manual

                                                                                                                                          -

                                                                                                                                          Version 1.7  — Rev. 17

                                                                                                                                          +

                                                                                                                                          Version 1.7  — Rev. 18


                                                                                                                                            diff --git a/dist/docs/zh-CN/ServTuning_Help.html b/dist/docs/zh-CN/ServTuning_Help.html index 96293e114..f827ec7e1 100644 --- a/dist/docs/zh-CN/ServTuning_Help.html +++ b/dist/docs/zh-CN/ServTuning_Help.html @@ -17,7 +17,7 @@

                                                                                                                                            OpenLiteSpeed Web Server Users' Manual

                                                                                                                                            -

                                                                                                                                            Version 1.7  — Rev. 17

                                                                                                                                            +

                                                                                                                                            Version 1.7  — Rev. 18


                                                                                                                                            diff --git a/dist/docs/zh-CN/ServerStat_Help.html b/dist/docs/zh-CN/ServerStat_Help.html index a4590ba73..db537a18c 100644 --- a/dist/docs/zh-CN/ServerStat_Help.html +++ b/dist/docs/zh-CN/ServerStat_Help.html @@ -17,7 +17,7 @@

                                                                                                                                            OpenLiteSpeed Web Server Users' Manual

                                                                                                                                            -

                                                                                                                                            Version 1.7  — Rev. 17

                                                                                                                                            +

                                                                                                                                            Version 1.7  — Rev. 18


                                                                                                                                              diff --git a/dist/docs/zh-CN/Servlet_Context.html b/dist/docs/zh-CN/Servlet_Context.html index 3347a7944..0e4733568 100644 --- a/dist/docs/zh-CN/Servlet_Context.html +++ b/dist/docs/zh-CN/Servlet_Context.html @@ -17,7 +17,7 @@

                                                                                                                                              OpenLiteSpeed Web Server Users' Manual

                                                                                                                                              -

                                                                                                                                              Version 1.7  — Rev. 17

                                                                                                                                              +

                                                                                                                                              Version 1.7  — Rev. 18


                                                                                                                                                diff --git a/dist/docs/zh-CN/Static_Context.html b/dist/docs/zh-CN/Static_Context.html index 9d315b4de..f9eb526bb 100644 --- a/dist/docs/zh-CN/Static_Context.html +++ b/dist/docs/zh-CN/Static_Context.html @@ -17,7 +17,7 @@

                                                                                                                                                OpenLiteSpeed Web Server Users' Manual

                                                                                                                                                -

                                                                                                                                                Version 1.7  — Rev. 17

                                                                                                                                                +

                                                                                                                                                Version 1.7  — Rev. 18


                                                                                                                                                  @@ -123,7 +123,7 @@

                                                                                                                                                  Static Context

                                                                                                                                                  Table of Contents

                                                                                                                                                  <

                                                                                                                                                  启用重写

                                                                                                                                                  Description

                                                                                                                                                  指定是否启用LiteSpeed的URL重写. 可以在虚拟主机或context级别上自定义此选项, 并且沿目录树继承该选项,直到被其他选项覆。

                                                                                                                                                  Syntax

                                                                                                                                                  从单选框选择

                                                                                                                                                  重写继承

                                                                                                                                                  Description

                                                                                                                                                  指定是否从父级context继承重写规则。 如果启用重写但不继承,将启用本context的重写基准及重写规则。

                                                                                                                                                  Syntax

                                                                                                                                                  从单选框选择

                                                                                                                                                  重写基准

                                                                                                                                                  Description

                                                                                                                                                  指定重写规则的基准URL。

                                                                                                                                                  Syntax

                                                                                                                                                  URL

                                                                                                                                                  -

                                                                                                                                                  重写规则

                                                                                                                                                  Description

                                                                                                                                                  指定虚拟主机级别的重写规则。

                                                                                                                                                  请勿在此处添加任何目录级重写规则。 如果您在.htaccess有任何目录级的重写规则,则应该使用uri"/"创建一个静态context, 并在那里添加重写规则。 (注:我也不知道这里说的什么鬼意思)

                                                                                                                                                  重写规则由一个RewriteRule组成,并可可以在多个RewriteCond之后。

                                                                                                                                                  • 每行仅能有一条规则
                                                                                                                                                  • RewriteCondRewriteRule 遵循Apache的rewrite语法。 只需从Apache配置文件中复制并粘贴重写规则即可。
                                                                                                                                                  • LiteSpeed和Apache mod_rewrite之间有细微差别:
                                                                                                                                                    • %\{LA-U:variable\} and %\{LA-F:variable\} 在Litespeed 重写中将被忽略
                                                                                                                                                    • Litespeed中加入了两个新变量: %\{CURRENT_URI\}表示正在处理的URL %\{SCRIPT_NAME\}表示为相应的CGI环境变量。
                                                                                                                                                    • Litespeed在遇到[L]后为了避免循环将停止处理此及此后的重写规则 而Apache mod_rewrite将仅停止处理该条重写规则。此行为类似于apachemod_rewrite中的[END]标志。

                                                                                                                                                  LiteSpeed的重写规则遵循Apache的重写规范。 有关重写规则的更多详细信息,请参阅 Apache's mod_rewrite document(英文文档) Apache's URL rewriting guide(英文文档) .

                                                                                                                                                  Syntax

                                                                                                                                                  string

                                                                                                                                                  +

                                                                                                                                                  重写规则

                                                                                                                                                  Description

                                                                                                                                                  指定虚拟主机级别的重写规则。

                                                                                                                                                  请勿在此处添加任何目录级重写规则。 如果您在.htaccess有任何目录级的重写规则,则应该使用uri"/"创建一个静态context, 并在那里添加重写规则。

                                                                                                                                                  重写规则由一个RewriteRule组成,并可可以在多个RewriteCond之后。

                                                                                                                                                  • 每行仅能有一条规则
                                                                                                                                                  • RewriteCondRewriteRule 遵循Apache的rewrite语法。 只需从Apache配置文件中复制并粘贴重写规则即可。
                                                                                                                                                  • LiteSpeed和Apache mod_rewrite之间有细微差别:
                                                                                                                                                    • %\{LA-U:variable\} and %\{LA-F:variable\} 在Litespeed 重写中将被忽略
                                                                                                                                                    • Litespeed中加入了两个新变量: %\{CURRENT_URI\}表示正在处理的URL %\{SCRIPT_NAME\}表示为相应的CGI环境变量。
                                                                                                                                                    • Litespeed在遇到[L]后为了避免循环将停止处理此及此后的重写规则 而Apache mod_rewrite将仅停止处理该条重写规则。此行为类似于apachemod_rewrite中的[END]标志。

                                                                                                                                                  LiteSpeed的重写规则遵循Apache的重写规范。 有关重写规则的更多详细信息,请参阅 Apache's mod_rewrite document(英文文档) Apache's URL rewriting guide(英文文档) .

                                                                                                                                                  Syntax

                                                                                                                                                  string

                                                                                                                                                  php.ini 重写

                                                                                                                                                  Description

                                                                                                                                                  用于覆盖当前context(虚拟主机级别或context级别)中的php.ini设置。

                                                                                                                                                  支持的指令是:
                                                                                                                                                  php_value
                                                                                                                                                  php_flag
                                                                                                                                                  php_admin_value
                                                                                                                                                  php_admin_flag

                                                                                                                                                  所有其他行/指令将被忽略。

                                                                                                                                                  Syntax

                                                                                                                                                  Override syntax is similar to Apache, a newline separated list of directives and their values with each directive being prepended by php_value, php_flag, php_admin_value, or php_admin_flag appropriately.

                                                                                                                                                  例子

                                                                                                                                                  php_value include_path ".:/usr/local/lib/php"
                                                                                                                                                  php_admin_flag engine on
                                                                                                                                                  php_admin_value open_basedir "/home"
                                                                                                                                                  diff --git a/dist/docs/zh-CN/Templates_Help.html b/dist/docs/zh-CN/Templates_Help.html index 0fdec5de4..7a8e15f0a 100644 --- a/dist/docs/zh-CN/Templates_Help.html +++ b/dist/docs/zh-CN/Templates_Help.html @@ -17,7 +17,7 @@

                                                                                                                                                  OpenLiteSpeed Web Server Users' Manual

                                                                                                                                                  -

                                                                                                                                                  Version 1.7  — Rev. 17

                                                                                                                                                  +

                                                                                                                                                  Version 1.7  — Rev. 18


                                                                                                                                                    diff --git a/dist/docs/zh-CN/VHGeneral_Help.html b/dist/docs/zh-CN/VHGeneral_Help.html index 0e0e100a9..6820b7737 100644 --- a/dist/docs/zh-CN/VHGeneral_Help.html +++ b/dist/docs/zh-CN/VHGeneral_Help.html @@ -17,7 +17,7 @@

                                                                                                                                                    OpenLiteSpeed Web Server Users' Manual

                                                                                                                                                    -

                                                                                                                                                    Version 1.7  — Rev. 17

                                                                                                                                                    +

                                                                                                                                                    Version 1.7  — Rev. 18


                                                                                                                                                      diff --git a/dist/docs/zh-CN/VHSSL_Help.html b/dist/docs/zh-CN/VHSSL_Help.html index baf1cc07f..b9a8b610b 100644 --- a/dist/docs/zh-CN/VHSSL_Help.html +++ b/dist/docs/zh-CN/VHSSL_Help.html @@ -17,7 +17,7 @@

                                                                                                                                                      OpenLiteSpeed Web Server Users' Manual

                                                                                                                                                      -

                                                                                                                                                      Version 1.7  — Rev. 17

                                                                                                                                                      +

                                                                                                                                                      Version 1.7  — Rev. 18


                                                                                                                                                        diff --git a/dist/docs/zh-CN/VHSecurity_Help.html b/dist/docs/zh-CN/VHSecurity_Help.html index 732caebb8..b4cca845c 100644 --- a/dist/docs/zh-CN/VHSecurity_Help.html +++ b/dist/docs/zh-CN/VHSecurity_Help.html @@ -17,7 +17,7 @@

                                                                                                                                                        OpenLiteSpeed Web Server Users' Manual

                                                                                                                                                        -

                                                                                                                                                        Version 1.7  — Rev. 17

                                                                                                                                                        +

                                                                                                                                                        Version 1.7  — Rev. 18


                                                                                                                                                          diff --git a/dist/docs/zh-CN/VHWebSocket_Help.html b/dist/docs/zh-CN/VHWebSocket_Help.html index 3fef2eb77..7d84835ea 100644 --- a/dist/docs/zh-CN/VHWebSocket_Help.html +++ b/dist/docs/zh-CN/VHWebSocket_Help.html @@ -17,7 +17,7 @@

                                                                                                                                                          OpenLiteSpeed Web Server Users' Manual

                                                                                                                                                          -

                                                                                                                                                          Version 1.7  — Rev. 17

                                                                                                                                                          +

                                                                                                                                                          Version 1.7  — Rev. 18


                                                                                                                                                            diff --git a/dist/docs/zh-CN/VirtualHosts_Help.html b/dist/docs/zh-CN/VirtualHosts_Help.html index bc682f8db..0ceab77d8 100644 --- a/dist/docs/zh-CN/VirtualHosts_Help.html +++ b/dist/docs/zh-CN/VirtualHosts_Help.html @@ -17,7 +17,7 @@

                                                                                                                                                            OpenLiteSpeed Web Server Users' Manual

                                                                                                                                                            -

                                                                                                                                                            Version 1.7  — Rev. 17

                                                                                                                                                            +

                                                                                                                                                            Version 1.7  — Rev. 18


                                                                                                                                                              diff --git a/dist/docs/zh-CN/admin.html b/dist/docs/zh-CN/admin.html index 5d8e1c450..7e9c6a7df 100644 --- a/dist/docs/zh-CN/admin.html +++ b/dist/docs/zh-CN/admin.html @@ -17,7 +17,7 @@

                                                                                                                                                              OpenLiteSpeed Web Server Users' Manual

                                                                                                                                                              -

                                                                                                                                                              Version 1.7  — Rev. 17

                                                                                                                                                              +

                                                                                                                                                              Version 1.7  — Rev. 18


                                                                                                                                                                @@ -98,54 +98,54 @@

                                                                                                                                                                Version 1.7  — Rev. 17

                                                                                                                                                                Administration

                                                                                                                                                                -

                                                                                                                                                                LiteSpeed web server can be controlled in three ways: through the WebAdmin console, from the command line, or by sending signals.

                                                                                                                                                                +

                                                                                                                                                                可以通过三种方式控制LiteSpeed Web服务器:通过WebAdmin控制台,从命令行或通过发送信号进行控制.

                                                                                                                                                                  -
                                                                                                                                                                1. Through the WebAdmin console:

                                                                                                                                                                  -

                                                                                                                                                                  WebAdmin console is a centralized control panel to control and configure all LiteSpeed Web Server settings.

                                                                                                                                                                  -

                                                                                                                                                                  Log on to the WebAdmin console (by default http://[your site's address]:7080/). - Select "Service Manager". Here you will find a control panel with links to perform common tasks: -server restart, server configuration reload, log viewing, real-time monitoring, -virtual host reload, and virtual host enable/disable.

                                                                                                                                                                  -

                                                                                                                                                                  More details on how to control LiteSpeed Web Server through the WebAdmin console - Service Manager

                                                                                                                                                                  -

                                                                                                                                                                  To change the login name and password for the WebAdmin interface, run the following command from the shell:
                                                                                                                                                                  +

                                                                                                                                                                2. 通过WebAdmin控制台:

                                                                                                                                                                  +

                                                                                                                                                                  WebAdmin控制台是一个集中式控制面板,用于控制和配置所有LiteSpeed Web服务器设置.

                                                                                                                                                                  +

                                                                                                                                                                  登录到WebAdmin控制台 (默认: http://[您的服务器IP]:7080/). + 选择“服务管理”,您将找到一个包含执行常见任务的控制面板的链接: +重新启动服务器,重新加载服务器配置,查看日志,实时监控, +虚拟主机重新加载,以及虚拟主机启用/禁用。

                                                                                                                                                                  +

                                                                                                                                                                  有关如何通过WebAdmin控制台控制LiteSpeed Web Server的更多信息 - 服务管理

                                                                                                                                                                  +

                                                                                                                                                                  要更改WebAdmin界面的登录名和密码,请从shell运行以下命令:
                                                                                                                                                                  [your install dir]/admin/misc/admpass.sh

                                                                                                                                                                3. -
                                                                                                                                                                4. Through the command line interface:

                                                                                                                                                                  -

                                                                                                                                                                  Assuming the web server is installed at /usr/local/lsws.

                                                                                                                                                                  -

                                                                                                                                                                  Use the lswsctrl control script in /usr/local/lsws/bin/ directory.

                                                                                                                                                                  -

                                                                                                                                                                  To start the web server:
                                                                                                                                                                  +

                                                                                                                                                                5. 通过命令行界面:

                                                                                                                                                                  +

                                                                                                                                                                  假设Web服务器安装在 /usr/local/lsws.

                                                                                                                                                                  +

                                                                                                                                                                  使用 lswsctrl /usr/local/lsws/bin/中的控制脚本.

                                                                                                                                                                  +

                                                                                                                                                                  启动Web服务器:
                                                                                                                                                                  /usr/local/lsws/bin/lswsctrl start

                                                                                                                                                                  -

                                                                                                                                                                  To stop the web server:
                                                                                                                                                                  +

                                                                                                                                                                  停止Web服务器:
                                                                                                                                                                  /usr/local/lsws/bin/lswsctrl stop

                                                                                                                                                                  -

                                                                                                                                                                  To restart the web server:
                                                                                                                                                                  +

                                                                                                                                                                  重启Web服务器:
                                                                                                                                                                  /usr/local/lsws/bin/lswsctrl restart

                                                                                                                                                                  -

                                                                                                                                                                  To reload the configuration:
                                                                                                                                                                  +

                                                                                                                                                                  重新加载配置:
                                                                                                                                                                  /usr/local/lsws/bin/lswsctrl reload

                                                                                                                                                                6. -
                                                                                                                                                                7. By sending signals:

                                                                                                                                                                  -

                                                                                                                                                                  You can stop server processes and reload configurations by sending signals to the server processes.

                                                                                                                                                                  -

                                                                                                                                                                  First, you need to know the server's process ID, either from the PID file or by running a "ps" command.

                                                                                                                                                                  -

                                                                                                                                                                  To read the PID file:
                                                                                                                                                                  +

                                                                                                                                                                8. 通过发送信号:

                                                                                                                                                                  +

                                                                                                                                                                  您可以通过向服务器进程发送信号来停止服务器进程,重新加载配置。

                                                                                                                                                                  +

                                                                                                                                                                  首先,您需要知道服务器的进程ID,可以通过PID文件或通过运行 "ps" 命令.

                                                                                                                                                                  +

                                                                                                                                                                  读取PID文件:
                                                                                                                                                                  cat /tmp/lshttpd/lshttpd.pid

                                                                                                                                                                  -

                                                                                                                                                                  By running a "ps" command:
                                                                                                                                                                  +

                                                                                                                                                                  通过使用 "ps" 命令:
                                                                                                                                                                  FreeBSD: ps -x | grep lshttpd
                                                                                                                                                                  Others: ps -ef | grep lshttpd

                                                                                                                                                                  - If multiple processes are listed, use the process with PPID equal to 1. + 如果列出了多个进程,请使用PPID等于1的进程。

                                                                                                                                                                  -

                                                                                                                                                                  To stop the web server: +

                                                                                                                                                                  停止Web服务器: kill XXXX - (XXXX is the PID)
                                                                                                                                                                  - If the server did not stop, use: + (XXXX 是PID)
                                                                                                                                                                  + 如果服务器没有停止使用: kill -9 XXXX

                                                                                                                                                                  -

                                                                                                                                                                  To reload the configurations, use: +

                                                                                                                                                                  要重新加载配置,请使用: kill -HUP XXXX

                                                                                                                                                                9. diff --git a/dist/docs/zh-CN/config.html b/dist/docs/zh-CN/config.html index 4a17b3eca..6c4ddf361 100644 --- a/dist/docs/zh-CN/config.html +++ b/dist/docs/zh-CN/config.html @@ -17,7 +17,7 @@

                                                                                                                                                                  OpenLiteSpeed Web Server Users' Manual

                                                                                                                                                                  -

                                                                                                                                                                  Version 1.7  — Rev. 17

                                                                                                                                                                  +

                                                                                                                                                                  Version 1.7  — Rev. 18


                                                                                                                                                                    @@ -96,97 +96,82 @@

                                                                                                                                                                    Version 1.7  — Rev. 17

                                                                                                                                                                  -

                                                                                                                                                                  Configuration

                                                                                                                                                                  +

                                                                                                                                                                  配置

                                                                                                                                                                  Concepts

                                                                                                                                                                  -

                                                                                                                                                                  Here are some basic concepts you should know before going into the detail of the configuration.

                                                                                                                                                                  +

                                                                                                                                                                  在配置之前,您需要了解以下一些基本概念.

                                                                                                                                                                  -

                                                                                                                                                                  Virtual Hosts

                                                                                                                                                                  +

                                                                                                                                                                  虚拟主机

                                                                                                                                                                  -

                                                                                                                                                                  LiteSpeed web server can host multiple web sites (virtual hosts) with one server instance.

                                                                                                                                                                  +

                                                                                                                                                                  LiteSpeed Web服务器可以通过一个服务器托管多个网站(虚拟主机).

                                                                                                                                                                  -

                                                                                                                                                                  Traditionally, virtual hosts are classified into two types: IP-based virtual hosts and - name-based virtual hosts. - IP-based virtual hosts are web sites that have their own unique IP addresses. Name-based - virtual hosts are web sites that are distinguished by their domain name and - thus may share an IP address with other sites. There is no clear - distinction between these two categories in LiteSpeed - Web Server. IP-based virtual hosts are considered just a special kind of - name-based virtual host. Both of them can be easily configured, or even mixed - together.

                                                                                                                                                                  -

                                                                                                                                                                  Unlike other web servers, LiteSpeed Web Server does not have a default web site. - Every web site is configured as a virtual host even if only one web site is hosted.

                                                                                                                                                                  +

                                                                                                                                                                  传统上,虚拟主机分为两种:基于IP的虚拟主机和 基于域的虚拟主机。 + 基于IP的虚拟主机是具有自己唯一IP地址的网站. 基于域的虚拟主机是通过域名区分的, + 因此可以与其他网站共享IP地址。在LiteSpeed Web Server中的这两个类别之间没有明显区别. + 基于IP的虚拟主机只是一种特殊的基于域的虚拟主机。 它们都可以轻松配置,甚至可以混合.

                                                                                                                                                                  +

                                                                                                                                                                  与其他Web服务器不同,LiteSpeed Web Server没有默认网站。 + 即使仅托管一个网站,每个网站都被配置为虚拟主机。

                                                                                                                                                                  -

                                                                                                                                                                  Listeners

                                                                                                                                                                  +

                                                                                                                                                                  侦听器

                                                                                                                                                                  -

                                                                                                                                                                  In LiteSpeed Web Server, a listener is a server socket that listens on a - specific IP address and TCP port. If you imagine the web server as a building, the listeners are - the doors (each with its own IP address and port). - Clients (browsers) have to go through a door (a listener) to submit their requests.

                                                                                                                                                                  +

                                                                                                                                                                  在LiteSpeed Web Server中,侦听器是一个服务器套接字,用于侦听特定的IP地址和TCP端口. + 如果您将Web服务器想象为建筑物,那么侦听器就是门(每个都有自己的IP地址和端口) + 客户(浏览器)必须经过一扇门(侦听器)才能提交他们的请求。

                                                                                                                                                                  -

                                                                                                                                                                  For each listener, an IP address and a port number need to be specified. - IP address can be any valid local IP address, or you can set a wildcard IP - (*) that refers to all available IP addresses on that machine. - A port is an integer between 0 and 65535. - The default port for HTTP is 80 and 443 for HTTPS. - Other ports can be used, though, on UNIX machines, only the super user "root" - has permission to use ports below 1024.

                                                                                                                                                                  +

                                                                                                                                                                  对于每个侦听器,需要指定IP地址和端口号。 + IP地址可以是任何有效的本地IP地址, + 也可以设置一个通配符IP(*)来引用该计算机上的所有可用IP地址。 + 端口是0到65535之间的整数。 + HTTP的默认端口是80,HTTPS的默认端口是443。 + 其他端口也可以使用,但是在UNIX机器上,只有超级用户 "root" 才有权使用1024以下的端口。

                                                                                                                                                                  -

                                                                                                                                                                  Only one listener is allowed for each IP and port combination. - Thus, if a listener is configured to one port with the wildcard IP address, - you cannot configure another listener to the same port, even if you specify - a particular IP. For example, if there are multiple IP addresses on the web - server machine, and HTTP traffic needs to be allowed on port 8080 for all - IP addresses, this can be configured in two ways: set up one - listener using the wildcard IP (*) and port 8080, or set up multiple - listeners, one for each IP, all listening to port 8080. These two methods - cannot be mixed on a single port.

                                                                                                                                                                  +

                                                                                                                                                                  每个IP和端口组合只允许一个侦听器。 + 因此,如果将侦听器配置为一个具有通配符IP地址的端口 + 即使指定了特定的IP,也不能将另一个侦听器配置到同一端口。 + 例如, 如果web服务器上有多个IP地址, + 所有IP地址的8080端口都需要允许HTTP通信, 有两种方式: + 使用通配符IP(*)和端口8080设置一个侦听器, + 或者设置多个侦听器, + 每个IP一个,全部监听端口8080. + 这两种方法不能在一个端口上混合使用。

                                                                                                                                                                  -

                                                                                                                                                                  There are two types of listeners in LiteSpeed Web Server: plain and secure - (SSL). Each secure listener requires a paired SSL private key and SSL certificate. - The private key can be generated with an SSL toolkit like - OpenSSL. The SSL certificate can be self-signed or obtained from - an SSL certificate issuer like VeriSign or Thawte. You can share the same private - key and certificate pair among multiple listeners.

                                                                                                                                                                  +

                                                                                                                                                                  LiteSpeed Web Server中有两种类型的侦听器: 简单和安全(SSL). + 每个安全侦听器都需要成对的SSL私钥和SSL证书。 + 私钥可以使用SSL工具包生成,例如OpenSSL. + SSL证书可以是自签名的,也可以从 + SSL证书颁发者购买,例如VeriSign或Thawte。 + 您可以在多个侦听器之间共享相同的私钥和证书。

                                                                                                                                                                  -

                                                                                                                                                                  Listener to Virtual Host Mapping

                                                                                                                                                                  +

                                                                                                                                                                  虚拟主机映射的侦听器

                                                                                                                                                                  -

                                                                                                                                                                  LiteSpeed's Listener to Virtual Host Mapping provides extra flexibility, allowing you - to:

                                                                                                                                                                  +

                                                                                                                                                                  LiteSpeed的虚拟主机映射侦听器的灵活性,使您能够:

                                                                                                                                                                    -
                                                                                                                                                                  • map one listener to one virtual host.
                                                                                                                                                                  • -
                                                                                                                                                                  • map one listener to different virtual hosts for different domain names.
                                                                                                                                                                  • -
                                                                                                                                                                  • map multiple listeners to the same virtual host.
                                                                                                                                                                  • -
                                                                                                                                                                  • map multiple listeners to multiple virtual hosts depending on their domain names.
                                                                                                                                                                  • +
                                                                                                                                                                  • 将一个侦听器映射到一个虚拟主机.
                                                                                                                                                                  • +
                                                                                                                                                                  • 将一个侦听器映射到不同域名的不同虚拟主机。
                                                                                                                                                                  • +
                                                                                                                                                                  • 将多个侦听器映射到同一虚拟主机.
                                                                                                                                                                  • +
                                                                                                                                                                  • 根据其域名将多个侦听器映射到多个虚拟主机.
                                                                                                                                                                  -

                                                                                                                                                                  In Listener to Virtual Host Mapping, every listener has a virtual host lookup table - with key-value pairs that specify a domain name (key) for - a particular virtual host (value).

                                                                                                                                                                  +

                                                                                                                                                                  在虚拟主机映射的侦听器中,每个侦听器都有一个虚拟主机查找表, +该表具有键值对,这些键值对为特定的虚拟主机(值)指定域名(键)。

                                                                                                                                                                  -

                                                                                                                                                                  When a browser tries to retrieve a web page from a web server, it first uses a DNS lookup to -find the IP address associated with that domain name. It then sends a request to establish a -TCP connection with the web server on a specific IP and port. If there is a listener assigned -to that IP and port, a connection is established. The browser then sends an HTTP -  request, which includes, in the header, the domain name of the web site being accessed. - The web server checks the lookup table associated with that listener for the domain name - in the request. If a match is found, the request is routed to the virtual host for processing.

                                                                                                                                                                  +

                                                                                                                                                                  当浏览器尝试从Web服务器检索网页时, 它首先使用DNS查找来查找与该域名关联的IP地址. + 然后,它发送一个请求,以在特定IP和端口上与Web服务器建立TCP连接。 + 如果有分配给该IP和端口的侦听器,则建立连接。 然后浏览器发送HTTP请求, + 请求在标头种含有的域名.网络服务器检查与该侦听器关联的查找表中请求中的域名. + 如果找到匹配项,则将请求路由到虚拟主机进行处理。

                                                                                                                                                                  -

                                                                                                                                                                  In order to make a virtual host accessible through a specific listener, you must -make sure that:

                                                                                                                                                                  +

                                                                                                                                                                  为了使虚拟主机可以通过特定的侦听器访问,您必须确保:

                                                                                                                                                                    -
                                                                                                                                                                  1. DNS is configured properly to map the domain name of the web site to the -IP used by that listener. How to configure DNS is beyond the scope of this document.
                                                                                                                                                                  2. -
                                                                                                                                                                  3. A mapping to the virtual host for that domain name exists in the listener's - lookup table.
                                                                                                                                                                  4. +
                                                                                                                                                                  5. DNS已正确配置为网站域名映射到的侦听器的IP。 如何配置DNS超出了本文档的范围.
                                                                                                                                                                  6. +
                                                                                                                                                                  7. 侦听器的查找表中存在该域名到虚拟主机的映射.
                                                                                                                                                                  -

                                                                                                                                                                  A catchall virtual host can be specified for one listener with the wild card domain name - "*". When the server cannot find a matching virtual host, the request will be routed - to the catchall virtual host. If there is no such catchall virtual host configured, - the web server will return error code 404.

                                                                                                                                                                  +

                                                                                                                                                                  可以为一个侦听器使用通配符域名“*”指定一个默认虚拟主机。 + 当服务器找不到匹配的虚拟主机时,请求将被路由到默认虚拟主机。 + 如果没有配置这样的的虚拟主机,则Web服务器将返回错误代码404。

                                                                                                                                                                  diff --git a/dist/docs/zh-CN/index.html b/dist/docs/zh-CN/index.html index 19f2b581a..3da215689 100644 --- a/dist/docs/zh-CN/index.html +++ b/dist/docs/zh-CN/index.html @@ -17,7 +17,7 @@

                                                                                                                                                                  OpenLiteSpeed Web Server Users' Manual

                                                                                                                                                                  -

                                                                                                                                                                  Version 1.7  — Rev. 17

                                                                                                                                                                  +

                                                                                                                                                                  Version 1.7  — Rev. 18


                                                                                                                                                                  diff --git a/dist/docs/zh-CN/install.html b/dist/docs/zh-CN/install.html index 948ad93a7..6b3525731 100644 --- a/dist/docs/zh-CN/install.html +++ b/dist/docs/zh-CN/install.html @@ -17,7 +17,7 @@

                                                                                                                                                                  OpenLiteSpeed Web Server Users' Manual

                                                                                                                                                                  -

                                                                                                                                                                  Version 1.7  — Rev. 17

                                                                                                                                                                  +

                                                                                                                                                                  Version 1.7  — Rev. 18


                                                                                                                                                                    @@ -96,17 +96,17 @@

                                                                                                                                                                    Version 1.7  — Rev. 17

                                                                                                                                                                  -

                                                                                                                                                                  Installation/Uninstallation

                                                                                                                                                                  +

                                                                                                                                                                  安装/卸载

                                                                                                                                                                  -

                                                                                                                                                                  Minimum system requirements

                                                                                                                                                                  +

                                                                                                                                                                  最低系统要求

                                                                                                                                                                  • - Operating System: + 操作系统:
                                                                                                                                                                      -
                                                                                                                                                                    • Linux(i386): kernel 2.4 and up, glibc-2.2 and up
                                                                                                                                                                    • -
                                                                                                                                                                    • CentOS: 5 and up
                                                                                                                                                                    • -
                                                                                                                                                                    • Ubuntu: 8.04 and up
                                                                                                                                                                    • -
                                                                                                                                                                    • Debian: 4 and up
                                                                                                                                                                    • +
                                                                                                                                                                    • Linux(i386): kernel 2.4或更高, glibc-2.2 或更高
                                                                                                                                                                    • +
                                                                                                                                                                    • CentOS: 5 或更高
                                                                                                                                                                    • +
                                                                                                                                                                    • Ubuntu: 8.04 或更高
                                                                                                                                                                    • +
                                                                                                                                                                    • Debian: 4 或更高
                                                                                                                                                                    • FreeBSD(i386): 4.5 and up
                                                                                                                                                                    • MacOSX: 10.3 and up
                                                                                                                                                                    @@ -114,130 +114,109 @@

                                                                                                                                                                    Minimum system requirements

                                                                                                                                                                  • CPU:
                                                                                                                                                                      -
                                                                                                                                                                    • Intel: 80486 and up
                                                                                                                                                                    • +
                                                                                                                                                                    • Intel: 80486 或更高
                                                                                                                                                                    • PowerPC: PowerPC G4
                                                                                                                                                                  • -
                                                                                                                                                                  • Memory: 32MB and up
                                                                                                                                                                  • +
                                                                                                                                                                  • 内存: 32MB 或更高
                                                                                                                                                                  • - Disk: + 硬盘:
                                                                                                                                                                      -
                                                                                                                                                                    • Installation: 200MB
                                                                                                                                                                    • -
                                                                                                                                                                    • Runtime: 300MB and up, swapping space depends on usage.
                                                                                                                                                                    • +
                                                                                                                                                                    • 安装时: 200MB
                                                                                                                                                                    • +
                                                                                                                                                                    • 运行时: 300MB或更高, 交换空间取决于使用情况。
                                                                                                                                                                  -

                                                                                                                                                                  Installation

                                                                                                                                                                  +

                                                                                                                                                                  安装

                                                                                                                                                                  - Installation must be performed in a command line terminal. For testing - purposes, LiteSpeed Web Server can be installed into a home directory by a - non-privileged user. For production use, it should be installed into a system - directory. + 安装必须在命令行终端中执行。 出于测试目的, + 非特权用户可以将LiteSpeed Web Server安装到主目录中。 + 对于生产用途,应将其安装到系统目录中。

                                                                                                                                                                  - In Mac OS X, the root user is disabled by default. It can be enabled using a - series of actions detailed on the Apple website. You can also use the sudo - command to install LSWS into a system directory without enabling the root - user, but system folders will still only be manipulable by the root user. - This means that every time you want to control LSWS from the command line - terminal (like when you want to start or stop LSWS), you will have to use the - sudo command. + 在Mac OS X中,默认情况下禁用root用户。 可以使用Apple网站上的详述操作来启用它. + 您也可以使用sudo命令在不启用root用户的情况下将LSWS安装到系统目录中, + 但是系统文件夹仍然只能由root用户操作。 + 这意味着每次您要从命令行终端控制LSWS时(例如,启动或停止LSWS时), + 都必须使用sudo命令。

                                                                                                                                                                  -

                                                                                                                                                                  Installation Steps:

                                                                                                                                                                  +

                                                                                                                                                                  安装步骤:

                                                                                                                                                                  - Visit the + 访问 - OpenLiteSpeed Knowledge Base + OpenLiteSpeed知识库 - for a list of installation methods. + 查看有关安装方法的列表。

                                                                                                                                                                  -

                                                                                                                                                                  Getting Started

                                                                                                                                                                  +

                                                                                                                                                                  开始

                                                                                                                                                                  1. - For detailed information on controlling the server processes, please see - the Administration Guide. + 有关控制服务器进程的详细信息,请参阅《管理指南》。

                                                                                                                                                                    - To start the server, simply run [your_install_dir]/bin/lswsctrl start. - (To stop it, run [your_install_dir]/bin/lswsctrl stop.) + 要启动LSWS,只需运行 [您的安装文件夹]/bin/lswsctrl. + (停止请运行 [您的安装文件夹]/bin/lswsctrl.)

                                                                                                                                                                  2. -

                                                                                                                                                                    A sample site should be running on the server.

                                                                                                                                                                    +

                                                                                                                                                                    示例站点应在服务器上运行.

                                                                                                                                                                    - To access your site, point your browser to http://[address]:8088/, - [address] being the IP address or domain name of your web server machine. - Use "localhost" if the server is on the machine you are using. - "8088" is the default port. If you chose another port for LiteSpeed - during installation, use the port you designated. + 如果想访问您的网站,请访问 http://[address]:8088/, + [address] 是您的Web服务器的IP地址或域名。 + 如果服务器在您使用的计算机上,使用"localhost" + "8088"是默认的端口. 如果在安装过程中为LiteSpeed选择了另一个端口,请使用您指定的端口。

                                                                                                                                                                    - A congratulations page linked to other testing pages should load into the - browser when pointed to the above address. If not, try testing the - WebAdmin Console interface. + 当访问上述地址时,应为祝贺的测试页面。 如果不是,请尝试访问WebAdmin控制台界面。

                                                                                                                                                                  3. -

                                                                                                                                                                    The default port for the WebAdmin console is 7080.

                                                                                                                                                                    +

                                                                                                                                                                    WebAdmin控制台的默认端口是 7080.

                                                                                                                                                                    - Plug http://[address]:7080/, into your browser to go to the WebAdmin - interface. (If you changed the port for WebAdmin during installation, - use that port instead.) + 访问http://[address]:7080/来进入WebAdmin. + (如果在安装过程中更改了WebAdmin的端口,请改用该端口。)

                                                                                                                                                                    - Remember that for [address] you can use "localhost" if you're - currently using the machine the server is on. + 记住对于[address],如果服务器在您使用的计算机上你可以使用 "localhost"

                                                                                                                                                                    - The WebAdmin welcome page should load. Click the "Log on" link - and use the administrator's username and password specified during - installation to log on. + TWebAdmin欢迎页面应该加载。 点击 "Log on" 链接, + 并使用安装期间指定的管理员用户名和密码登录。

                                                                                                                                                                    - For detailed information regarding configuration, please refer to our - Configuration Guide, or click the "Help" link at the top of - each page. + 有关配置的详细信息,请参阅我们的配置指南,或单击顶部的“帮助”。

                                                                                                                                                                  4. - If your server uses firewall, please make sure that localhost is trusted. + 如果您的服务器使用防火墙,请确保本地主机受信任。

                                                                                                                                                                    - For instance, Linux with IPTables should include a rule ALLOW INPUT from - LO. + 例如,带有IPTables的Linux应该包括LO的ALLOW INPUT规则。

                                                                                                                                                                  5. - If your web site and the WebAdmin Console are inaccessible, please take - a look at the error log [your_install_dir]/logs/error.log. + 如果您的网站和WebAdmin Console无法访问,请查看错误日志 [your_install_dir]/logs/error.log.

                                                                                                                                                                    - If there is a TCP port conflict with other server applications, the web - server should be reinstalled with an available port. The following - command can be used to find an available port: + 如果与其他服务器应用程序存在TCP端口冲突,则应使用可用端口重新安装Web服务器。 可以使用以下命令查找可用端口: netstat -an | grep XXXX - XXXX is a port number. If the port is available, the command will produce - no output. + XXXX是端口号。 如果端口可用,该命令将不产生任何输出。

                                                                                                                                                                    - If the swapping directory is not writable, you can either grant writing - permission for the swapping directory to the user whom the web server is - running as, or change the swapping directory's configurations manually. - The swapping directory is configured in the server's XML configuration - file: [your_install_dir]/conf/httpd_config.xml. Search the XML file for - swappingDir. The default location for the swapping directory is - /tmp/lshttpd/swap. + 如果交换目录不可写,则可以将交换目录的写权限授予运行Web服务器的用户,也可以手动更改交换目录的配置。 + 交换目录在服务器的XML配置文件中配置: + [your_install_dir]/conf/httpd_config.xml. + 在XML文件中搜索swappingDir。 交换目录的默认位置是/tmp/lshttpd/swap。

                                                                                                                                                                    - If you still have problems with installation, please check out our wiki - or post your problem on our support forum. + 如果您仍然有安装问题,请查看我们的Wiki或将您的问题发布在我们的支持论坛上。

                                                                                                                                                                  @@ -245,24 +224,21 @@

                                                                                                                                                                  Getting Started

                                                                                                                                                                  Notes

                                                                                                                                                                  • - OpenLiteSpeed supports both native LiteSpeed XML configuration files and - plain text configuration files (for those used to editing Apache's - httpd.conf). Run [your_install_dir]/conf/switch_config.sh to switch between - these formats. + OpenLiteSpeed支持本机LiteSpeed XML配置文件和纯文本配置文件(用于编辑Apache的httpd.conf的文件) + 运行 [your_install_dir]/conf/switch_config.sh l来在这些格式之间切换。
                                                                                                                                                                  • - On FreeBSD, Mac OS X, Ubuntu, and Debian, the shipped PHP (for CentOS) will - not run. You will need to build a new PHP for OpenLiteSpeed in order to run - PHP applications with OpenLiteSpeed. + 在FreeBSD,Mac OS X,Ubuntu和Debian上,附带的PHP(对于CentOS)将无法运行。 + 您将需要为OpenLiteSpeed构建新的PHP,以便使用OpenLiteSpeed运行PHP应用程序。
                                                                                                                                                                  -

                                                                                                                                                                  Uninstallation Steps

                                                                                                                                                                  +

                                                                                                                                                                  卸载步骤

                                                                                                                                                                  1. - Stop OpenLiteSpeed if it is running: [your_install_dir]/bin/lswsctrl stop + 如果OpenLiteSpeed正在运行,则停止它: [your_install_dir]/bin/lswsctrl stop
                                                                                                                                                                  2. -
                                                                                                                                                                  3. Remove the install directory: rm -rf [your_install_dir]
                                                                                                                                                                  4. +
                                                                                                                                                                  5. 删除安装文件夹: rm -rf [your_install_dir]
                                                                                                                                                                  diff --git a/dist/docs/zh-CN/intro.html b/dist/docs/zh-CN/intro.html index d44f1e88c..10a32b61e 100644 --- a/dist/docs/zh-CN/intro.html +++ b/dist/docs/zh-CN/intro.html @@ -17,7 +17,7 @@

                                                                                                                                                                  OpenLiteSpeed Web Server Users' Manual

                                                                                                                                                                  -

                                                                                                                                                                  Version 1.7  — Rev. 17

                                                                                                                                                                  +

                                                                                                                                                                  Version 1.7  — Rev. 18


                                                                                                                                                                    diff --git a/dist/docs/zh-CN/license.html b/dist/docs/zh-CN/license.html index 822f3958a..27586702c 100644 --- a/dist/docs/zh-CN/license.html +++ b/dist/docs/zh-CN/license.html @@ -17,7 +17,7 @@

                                                                                                                                                                    OpenLiteSpeed Web Server Users' Manual

                                                                                                                                                                    -

                                                                                                                                                                    Version 1.7  — Rev. 17

                                                                                                                                                                    +

                                                                                                                                                                    Version 1.7  — Rev. 18


                                                                                                                                                                      diff --git a/dist/docs/zh-CN/security.html b/dist/docs/zh-CN/security.html index d5bb4510c..8f044c224 100644 --- a/dist/docs/zh-CN/security.html +++ b/dist/docs/zh-CN/security.html @@ -17,7 +17,7 @@

                                                                                                                                                                      OpenLiteSpeed Web Server Users' Manual

                                                                                                                                                                      -

                                                                                                                                                                      Version 1.7  — Rev. 17

                                                                                                                                                                      +

                                                                                                                                                                      Version 1.7  — Rev. 18


                                                                                                                                                                        @@ -96,73 +96,51 @@

                                                                                                                                                                        Version 1.7  — Rev. 17

                                                                                                                                                                      -

                                                                                                                                                                      Security

                                                                                                                                                                      +

                                                                                                                                                                      安全

                                                                                                                                                                      -

                                                                                                                                                                      LiteSpeed Web Server is designed with security as a top consideration. -LSWS supports SSL, has access control at server and virtual host levels, -and context-specific realm protection. Besides these standard features, -LSWS also has the following special security features:

                                                                                                                                                                      +

                                                                                                                                                                      LiteSpeed Web Server在设计安全性时是首要考虑因素。 +LSWS支持SSL,具有服务器和虚拟主机级别的访问控制, +以及特定于context的领域保护。 除了这些标准功能, +LSWS还具有以下特殊安全功能:

                                                                                                                                                                        -
                                                                                                                                                                      1. Connection level limits:

                                                                                                                                                                        +
                                                                                                                                                                      2. 连接级别限制:

                                                                                                                                                                          -
                                                                                                                                                                        • IP-level throttling limits network bandwidth to and from a single IP - address regardless of the number of connections.
                                                                                                                                                                        • -
                                                                                                                                                                        • IP-level connection accounting limits the number of concurrent connections - from a single IP address. You can controll this with the connection - soft limit, connection hard limit, grace - period, and banned period settings in the WebAdmin console.
                                                                                                                                                                        • +
                                                                                                                                                                        • IP级限制限制了与单个IP地址之间的网络带宽,而与连接数无关。
                                                                                                                                                                        • +
                                                                                                                                                                        • IP级别的连接限制了与单个IP地址的并发连接数。 + 您可以通过WebAdmin控制台中的软连接限制,硬连接限制,宽限期和禁止期设置来控制。
                                                                                                                                                                      3. -
                                                                                                                                                                      4. Request checking:

                                                                                                                                                                        -

                                                                                                                                                                        Every HTTP request is vetted by LiteSpeed Web Server. "/." is not allowed in - a decoded URL, thus denying accessing hidden files and parent directories.

                                                                                                                                                                        -

                                                                                                                                                                        Request size is limited by LiteSpeed Web Server's max request URL length, - max request header length, and max request body length settings.

                                                                                                                                                                        +
                                                                                                                                                                      5. 请求检查:

                                                                                                                                                                        +

                                                                                                                                                                        LiteSpeed Web服务器将审核每个HTTP请求。 “ /” 不允许在URL编码中, + 因此拒绝访问隐藏文件和其父目录。.

                                                                                                                                                                        +

                                                                                                                                                                        请求大小受LiteSpeed Web服务器的最大请求URL长度,最大请求标头长度和最大请求正文长度的限制。

                                                                                                                                                                      6. -
                                                                                                                                                                      7. Static file checking:

                                                                                                                                                                        -

                                                                                                                                                                        LiteSpeed Web Server will serve a static file only if the following conditions - are satisfied:

                                                                                                                                                                        +
                                                                                                                                                                      8. 静态文件检查:

                                                                                                                                                                        +

                                                                                                                                                                        只有满足以下条件,LiteSpeed Web Server才会提供静态文件:

                                                                                                                                                                          -
                                                                                                                                                                        • The file is readable by everyone.
                                                                                                                                                                        • -
                                                                                                                                                                        • The file is not executable.
                                                                                                                                                                        • -
                                                                                                                                                                        • The file is not in the access denied directory list.
                                                                                                                                                                        • -
                                                                                                                                                                        • The file does not contain symbolic link if symbolic links are not allowed.
                                                                                                                                                                        • -
                                                                                                                                                                        • By default, LiteSpeed Web Server does not index a directory by listing its - files, it has to be enabled explicitly.
                                                                                                                                                                        • +
                                                                                                                                                                        • 每个人都可以读取该文件。
                                                                                                                                                                        • +
                                                                                                                                                                        • 该文件不可执行.
                                                                                                                                                                        • +
                                                                                                                                                                        • 该文件不在拒绝访问目录列表中.
                                                                                                                                                                        • +
                                                                                                                                                                        • 如果不允许符号链接,那么文件不应包含符号链接。
                                                                                                                                                                        • +
                                                                                                                                                                        • 默认情况下,LiteSpeed Web Server不会通过列出目录文件来索引目录,除非明确的启用它.
                                                                                                                                                                      9. -
                                                                                                                                                                      10. External application firewall:

                                                                                                                                                                        -

                                                                                                                                                                        LiteSpeed Web Server forwards requests to external applications to process/generate -dynamic content. Those applications can use a lot of system resources. The performance of the -whole system will be severely degraded when system resource consumption reaches a certain point --- when swapping space has to be used, for example. One way to conduct a DoS attack is to flood -the web server with concurrent requests to a cumbersome external application.

                                                                                                                                                                        -

                                                                                                                                                                        LiteSpeed Web Server can pipeline requests and control the concurrent level of external -application use to prevent overconsumption of system resources. LSWS caches requests and only -forwards completed requests to the external application. This means the external application -will not be held waiting while the server is receiving the request. LSWS also caches the -external application's response so that the external application can be released as soon as -the response is completed and does not have to wait for the client to receive the complete response. -This way the server can utilize fewer external application instances to serve more concurrent -requests and achieve higher performance and scalability. LiteSpeed Web Server also uses its -own virtual memory to cache the request and response body to minimize the usage of system -memory without sacrificing performance.

                                                                                                                                                                      11. -
                                                                                                                                                                      12. CGI resources consumption limit:

                                                                                                                                                                        -

                                                                                                                                                                        LiteSpeed Web Server restricts the amount of system resources that can be consumed by - CGI applications. For each request to a CGI script, the web server needs to - start a standalone CGI process to handle it. On a Unix system, the number of concurrent - processes is limited. With the CGI resources consumption limit, you can configure - the maximum number of concurrent CGI instances that the web server can launch. -Excessive concurrent processes will degrade the performance -of the whole system. (CGI processes are a common weapon for DoS attacks.) -A system process limit can be specified per user in order to control the number -of processes that can be spawned by a CGI application. Each process is further confined by CPU and memory limits.

                                                                                                                                                                        +
                                                                                                                                                                      13. 外部应用防火墙:

                                                                                                                                                                        +

                                                                                                                                                                        LiteSpeed Web Server将请求转发到外部应用程序以处理/生成动态内容。 这些应用程序会占用大量系统资源. +当系统资源消耗达到一定程度时,整个系统的性能将严重降低-例如当必须使用交换空间时. 进行DoS攻击的一种方法是将大量并发请求发送给Web服务器, +使外部程序忙于处理对繁琐的请求。

                                                                                                                                                                        +

                                                                                                                                                                        LiteSpeed Web Server可以限制请求并控制外部应用程序的并发数量,以防止系统资源过度使用. LSWSh会缓存请求,并仅将完成的请求转发到外部应用程序. +这意味着当服务器接收请求时,外部应用程序将不会等待. LSWS还缓存了外部应用程序的响应,以便可以在响应完成后立即释放外部应用程序,而不必等待客户端收到完整的响应。 +这样服务器可以使用更少的外部应用程序进程来服务更多的请求并获得更高的性能和可扩展性。 +LiteSpeed Web Server还使用虚拟内存来缓存请求和响应正文,以在不牺牲性能的情况下最大程度地减少系统内存的使用.

                                                                                                                                                                      14. +
                                                                                                                                                                      15. CGI资源消耗限制:

                                                                                                                                                                        +

                                                                                                                                                                        LiteSpeed Web Server限制了CGI应用程序可以消耗的系统资源量。 对于每个对CGI脚本的请求,Web服务器都需要启动一个独立的CGI进程来处理它 + 在Unix系统上,并发进程数是有限的。 使用CGI资源消耗限制,可以配置Web服务器可以启动的并发CGI进程的最大数量。 过多的并发进程将降低整个系统的性能。 (CGI进程是DoS攻击的常用武器。),可以为每个用户指定系统进程限制,以控制CGI应用程序最多可以产生的进程数,每个进程都受到CPU和内存限制的限制

                                                                                                                                                                      16. -
                                                                                                                                                                      17. Enhanced CGI/FastCGI security with suEXEC:

                                                                                                                                                                        -

                                                                                                                                                                        In order to reduce the security risks of a CGI or Fast CGI script, LiteSpeed Web Server can restrict the system resources the CGI script can access by running it in "suEXEC" mode. -"suEXEC" starts the CGI or Fast CGI script with a different user ID from that of the web server. This greatly improves security in -shared hosting environment by preventing one user's CGI script from accessing other users' files.

                                                                                                                                                                        +
                                                                                                                                                                      18. suEXEC增强CGI/FastCGI的安全性:

                                                                                                                                                                        +

                                                                                                                                                                        为了降低CGI或Fast CGI脚本的安全风险,LiteSpeed Web Server可以通过以“suEXEC”模式运行,来限制CGI脚本可以使用的系统资源。 +"suEXEC”会使用与Web服务器不同的用户ID启动CGI或Fast CGI脚本. 通过防止一个用户的CGI脚本访问其他用户的文件,这大大提高了共享托管环境中的安全性。

                                                                                                                                                                      diff --git a/dist/docs/zh-CN/webconsole.html b/dist/docs/zh-CN/webconsole.html index b788832ff..fac9e77df 100644 --- a/dist/docs/zh-CN/webconsole.html +++ b/dist/docs/zh-CN/webconsole.html @@ -17,7 +17,7 @@

                                                                                                                                                                      OpenLiteSpeed Web Server Users' Manual

                                                                                                                                                                      -

                                                                                                                                                                      Version 1.7  — Rev. 17

                                                                                                                                                                      +

                                                                                                                                                                      Version 1.7  — Rev. 18


                                                                                                                                                                        @@ -98,14 +98,14 @@

                                                                                                                                                                        Version 1.7  — Rev. 17

                                                                                                                                                                        Web Console

                                                                                                                                                                        -

                                                                                                                                                                        The Web Console section controls the settings for the WebAdmin Console. Some of these settings include:

                                                                                                                                                                        +

                                                                                                                                                                        Web控制台可以控制一些Web控制台的设置. 其中包括:

                                                                                                                                                                          -
                                                                                                                                                                        • Session Timeout
                                                                                                                                                                        • -
                                                                                                                                                                        • Log Settings
                                                                                                                                                                        • -
                                                                                                                                                                        • Access Control
                                                                                                                                                                        • -
                                                                                                                                                                        • Create/Delete Admin Users
                                                                                                                                                                        • -
                                                                                                                                                                        • Reset Admin Passwords
                                                                                                                                                                        • -
                                                                                                                                                                        • WebAdmin Listeners & SSL Settings
                                                                                                                                                                        • +
                                                                                                                                                                        • 会话超时
                                                                                                                                                                        • +
                                                                                                                                                                        • 日志设定
                                                                                                                                                                        • +
                                                                                                                                                                        • 访问控制
                                                                                                                                                                        • +
                                                                                                                                                                        • 创建/删除管理员用户
                                                                                                                                                                        • +
                                                                                                                                                                        • 重置管理员密码
                                                                                                                                                                        • +
                                                                                                                                                                        • WebAdmin侦听器和SSL设置
                                                                                                                                                                      diff --git a/src/config.h.cmake b/src/config.h.cmake index 8ea7d93ed..2b5931ad6 100644 --- a/src/config.h.cmake +++ b/src/config.h.cmake @@ -5,6 +5,6 @@ #define DEFAULT_TMP_DIR "/tmp/lshttpd" #define PID_FILE "/tmp/lshttpd/openlitespeed.pid" -#define PACKAGE_VERSION "1.6.16" +#define PACKAGE_VERSION "1.6.17" #define LS_MODULE_VERSION_INFO "\tmodgzip 1.1\n\tcache 1.62\n\tmodinspector 1.1\n\tuploadprogress 1.1\n\tmod_security 1.3\n" #endif diff --git a/src/extensions/cgi/lscgid.cpp b/src/extensions/cgi/lscgid.cpp index 11753d049..751718409 100644 --- a/src/extensions/cgi/lscgid.cpp +++ b/src/extensions/cgi/lscgid.cpp @@ -70,7 +70,7 @@ void ls_stderr(const char * fmt, ...) vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); fprintf(stderr, "%s", buf); - DEBUG_MESSAGE("stderr message: %s", buf); + //DEBUG_MESSAGE("stderr message: %s", buf); } static uid_t s_uid; diff --git a/src/http/accesslog.cpp b/src/http/accesslog.cpp index 5c34424ed..b1ada19f9 100644 --- a/src/http/accesslog.cpp +++ b/src/http/accesslog.cpp @@ -340,17 +340,19 @@ int CustomFormat::parseFormat(const char *psFormat) } -static int logTime(char *pBuf, int len, time_t lTime, const char *pFmt) +static int logTime(AutoBuf *pBuf, time_t lTime, const char *pFmt) { struct tm gmt; struct tm *pTm = gmtime_r(&lTime, &gmt); int n; - n = strftime(pBuf, len, pFmt, pTm); - return n; + n = strftime(pBuf->end(), pBuf->available(), pFmt, pTm); + pBuf->used(n); + return 0; } + static int fixHttpVer(HttpSession *pSession, char *pBuf, int n) { if (pSession->isHttp2()) @@ -363,80 +365,87 @@ static int fixHttpVer(HttpSession *pSession, char *pBuf, int n) return n; } - -int AccessLog::appendEscape(char *pBuf, int destLen, const char *pStr, int len) +int AccessLog::appendEscape(const char *pStr, int len) { - char *pDestEnd = pBuf + destLen; - char last = '\0'; - char *p = pBuf; const char *pStrEnd = pStr + len; + char last = '\0'; while (pStr < pStrEnd) { unsigned char ch = *(const uint8_t *)pStr; + if (m_buf.available() < 10) + flush(); if ((ch < 0x20) || (ch >= 127)) { - if (p + 5 > pDestEnd) - break; - *p++ = '\\'; - *p++ = 'x'; - *p++ = StringTool::getHex(ch >> 4); - *p++ = StringTool::getHex(ch); + m_buf.append('\\'); + m_buf.append('x'); + m_buf.append(StringTool::getHex(ch >> 4)); + m_buf.append(StringTool::getHex(ch)); } else { - if (pBuf + 2 > pDestEnd) - break; - if ((*pStr == '"') || (*pStr == '\\') || (*pStr == '?' && last == '<')) - *p++ = '\\'; - *p++ = ch; + m_buf.append('\\'); + m_buf.append(ch); last = ch; } ++pStr; } - return p - pBuf; + return len; } -int AccessLog::appendStrNoQuote(char *pBuf, int len, int escape, const char *pSrc, - int srcLen, AccessLog *pLogger) +void AccessLog::appendStrNoQuote(int escape, const char *pStr, int len) { - if (pLogger && ((srcLen > 4096) - || (pLogger->m_buf.available() <= srcLen + 100))) + if (escape) { - pLogger->flush(); - pLogger->m_pAppender->append(pSrc, srcLen); - return LS_FAIL; + appendEscape(pStr, len); + return; + } + if ((len > 4096) || (m_buf.available() <= len + 100)) + { + flush(); + m_pAppender->append(pStr, len); } else + m_buf.append_unsafe(pStr, len); +} + + +char *AccessLog::appendReqVar(HttpSession *pSession, int id) +{ + char *pBuf = m_buf.end(); + int escape = 0; + int n = RequestVars::getReqVar(pSession, id, pBuf, m_buf.available()); + if (n > 0) { - if (escape) - return appendEscape(pBuf, len, pSrc, srcLen); - else if (srcLen > 0) + if (id == REF_REQ_LINE) { - if (srcLen > len) - srcLen = len; - memmove(pBuf, pSrc, srcLen); - return srcLen; + n = fixHttpVer(pSession, pBuf, n); + escape = 1; } + if (id < REF_STRING) + escape = 1; + if (pBuf != m_buf.end()) + appendStrNoQuote(escape, pBuf, n); + else + m_buf.used(n); } - return 0; + else + m_buf.append('-'); + return pBuf; } -int AccessLog::customLog(HttpSession *pSession, CustomFormat *pLogFmt, - char *pOutBuf, int buf_len, AccessLog *pLogger) +//Comments: For internal using, should use pOutBuf == NULL to use internal AutoStr. +void AccessLog::customLog(HttpSession *pSession, CustomFormat *pLogFmt, bool doFlush) { CustomFormat::iterator iter = pLogFmt->begin(); HttpReq *pReq = pSession->getReq(); LogFormatItem *pItem; const char *pValue = NULL; - char *pBuf = pOutBuf; - char *pBufEnd = pBuf + buf_len; - char *p; + char *pBuf; int n; - int ret; int escape; while (iter != pLogFmt->end()) { @@ -445,30 +454,24 @@ int AccessLog::customLog(HttpSession *pSession, CustomFormat *pLogFmt, switch (pItem->m_itemId) { case REF_STRING: - ret = appendStrNoQuote(pBuf, pBufEnd - pBuf, escape, pItem->m_sExtra.c_str(), - pItem->m_sExtra.len(), pLogger); - if (ret > 0) - pBuf += ret; - else if (ret < 0) - pBuf = pLogger->m_buf.end(); + appendStrNoQuote(escape, pItem->m_sExtra.c_str(), pItem->m_sExtra.len()); break; case REF_STRFTIME: if (pItem->m_sExtra.c_str()) - pBuf += logTime(pBuf, pBufEnd - pBuf, pSession->getReqTime(), - pItem->m_sExtra.c_str()); + logTime(&m_buf, pSession->getReqTime(), pItem->m_sExtra.c_str()); else { - DateTime::getLogTime(pSession->getReqTime(), pBuf); - pBuf += 28; + DateTime::getLogTime(pSession->getReqTime(), m_buf.end()); + m_buf.used(28); } break; case REF_CONN_STATE: if (pSession->getStream()->isAborted()) - *pBuf++ = 'X'; - else if (pSession->getReq()->isKeepAlive()) - *pBuf++ = '+'; + m_buf.append('X'); + else if (pSession->getStream()->isClosing()) + m_buf.append('-'); else - *pBuf++ = '-'; + m_buf.append('+'); break; case REF_COOKIE_VAL: case REF_ENV: @@ -479,12 +482,10 @@ int AccessLog::customLog(HttpSession *pSession, CustomFormat *pLogFmt, case REF_COOKIE_VAL: pValue = RequestVars::getCookieValue(pReq, pItem->m_sExtra.c_str(), pItem->m_sExtra.len(), n); - escape = 1; break; case REF_ENV: pValue = RequestVars::getEnv(pSession, pItem->m_sExtra.c_str(), pItem->m_sExtra.len(), n); - escape = 1; break; case REF_HTTP_HEADER: pValue = pReq->getHeader(pItem->m_sExtra.c_str(), pItem->m_sExtra.len(), @@ -500,58 +501,26 @@ int AccessLog::customLog(HttpSession *pSession, CustomFormat *pLogFmt, break; } if (pValue) - { - ret = appendStrNoQuote(pBuf, pBufEnd - pBuf, escape, pValue, n, pLogger); - if (ret > 0) - pBuf += ret; - else if (ret < 0) - pBuf = pLogger->m_buf.end(); - } + appendStrNoQuote(escape, pValue, n); else - *pBuf++ = '-'; + m_buf.append('-'); break; default: - p = pBuf; - n = RequestVars::getReqVar(pSession, pItem->m_itemId, p, pBufEnd - pBuf); - if (n > 0) - { - if (pItem->m_itemId == REF_REQ_LINE) - { - n = fixHttpVer(pSession, p, n); - escape = 1; - } - - if (p != pBuf) - { - ret = appendStrNoQuote(pBuf, pBufEnd - pBuf, escape, p, n, pLogger); - if (ret > 0) - pBuf += ret; - else if (ret < 0) - pBuf = pLogger->m_buf.end(); - } - else - pBuf += n; - } - else - *pBuf++ = '-'; + pBuf = appendReqVar(pSession, pItem->m_itemId); break; } ++iter; } - *pBuf++ = '\n'; - return pBuf - pOutBuf; -} + m_buf.append('\n'); - -void AccessLog::customLog(HttpSession *pSession, CustomFormat *pLogFmt) -{ - int n = customLog(pSession, pLogFmt, m_buf.end(), m_buf.available(), this); - m_buf.used(n); - if ((m_buf.available() < MAX_LOG_LINE_LEN) - || !asyncAccessLog()) - flush(); + if(doFlush) + { + if ((m_buf.available() < MAX_LOG_LINE_LEN) + || !asyncAccessLog()) + flush(); + } } @@ -701,17 +670,6 @@ void AccessLog::log(const char *pVHostName, int len, HttpSession *pSession) } -void AccessLog::appendEscape(const char *data, int len) -{ - if (m_buf.available() < 100 + len) - { - flush(); - m_buf.guarantee(100 + len); - } - appendEscape(m_buf.end(), m_buf.available(), data, len); -} - - void AccessLog::log(HttpSession *pSession) { int n; @@ -854,14 +812,23 @@ void AccessLog::setRollingSize(off_t size) } -int AccessLog::getLogString(HttpSession *pSession, const char *log_pattern, - char *pBuf, int bufLen) - +int AccessLog::getLogString(HttpSession *pSession, const char *log_pattern, char *pBuf, int bufLen) { - CustomFormat *pLogFmt = AccessLog::parseLogFormat(log_pattern); + CustomFormat *pLogFmt = parseLogFormat(log_pattern); if (!pLogFmt) return -1; - int ret = customLog(pSession, pLogFmt, pBuf, bufLen, NULL); + customLog(pSession, pLogFmt, false); //Set flase to not flush the buffer delete pLogFmt; + + //Need to copy the accesslog to pBuf + int ret = 0; + if (m_buf.size() > 0) + { + if(m_buf.size() < bufLen) + bufLen = m_buf.size(); + memcpy(pBuf, m_buf.begin(), bufLen); + ret = bufLen; + } + return ret; } diff --git a/src/http/accesslog.h b/src/http/accesslog.h index 66f810145..c8744e584 100644 --- a/src/http/accesslog.h +++ b/src/http/accesslog.h @@ -53,18 +53,16 @@ class AccessLog AutoBuf m_buf; int appendStr(const char *pStr, int len); - static int appendStrNoQuote(char *pBuf, int len, int escape, const char *pSrc, - int srcLen, AccessLog *pLogger); - void customLog(HttpSession *pSession, CustomFormat *pLogFmt); - static int customLog(HttpSession *pSession, CustomFormat *pLogFmt, - char *pOutBuf, int buf_len, AccessLog *pLogger); - static int appendEscape(char *pBuf, int destLen, const char *pStr, int len); + void appendStrNoQuote(int escape, const char *pSrc, int srcLen); + void customLog(HttpSession *pSession, CustomFormat *pLogFmt, bool doFlush = true); public: explicit AccessLog(const char *pPath); AccessLog(); ~AccessLog(); int init(const char *pName, int pipe); + + char *appendReqVar(HttpSession *pSession, int id); void log(HttpSession *pSession); void log(const char *pVHostName, int len, HttpSession *pSession); void flush(); @@ -86,15 +84,14 @@ class AccessLog char getCompress() const; const char *getLogPath() const; int reopenExist(); - void appendEscape(const char *data, int len); + int appendEscape(const char *data, int len); void closeNonPiped(); void setRollingSize(off_t size); int setCustomLog(const char *pFmt); - static int getLogString(HttpSession *pSession, const char *log_pattern, - char *pBuf, int bufLen); + int getLogString(HttpSession *pSession, const char *log_pattern, char *pBuf, int bufLen); - static CustomFormat *parseLogFormat(const char *pFmt); + CustomFormat *parseLogFormat(const char *pFmt); LS_NO_COPY_ASSIGN(AccessLog); }; diff --git a/src/http/chunkoutputstream.cpp b/src/http/chunkoutputstream.cpp index a30c067c4..bd0de1285 100644 --- a/src/http/chunkoutputstream.cpp +++ b/src/http/chunkoutputstream.cpp @@ -113,11 +113,24 @@ int ChunkOutputStream::write(const char *pBuf, int size) assert(m_pOS != NULL); if (m_iTotalPending) { - if (m_pLastBufBegin && pBuf != m_pLastBufBegin) + if (m_pLastBufBegin ) { - m_iov.adjust(m_pLastBufBegin, pBuf, m_iLastBufLen); - m_pLastBufBegin = pBuf; + if (pBuf != m_pLastBufBegin) + { + m_iov.adjust(m_pLastBufBegin, pBuf, m_iLastBufLen); + m_pLastBufBegin = pBuf; + } + else + { + //NOTE: size could be less than m_iLastBufLen for repeated attempts + // when bandwidth throttling is involved. We have to use + // m_iLastBufLen, + // this function could return a value larger than the input "size" + if (size < m_iLastBufLen) + size = m_iLastBufLen; + } } + ret = flush2(); switch (ret) { @@ -130,6 +143,7 @@ int ChunkOutputStream::write(const char *pBuf, int size) } } + left = size; if (m_pLastBufBegin != NULL) { left -= m_iLastBufLen; diff --git a/src/http/httpserverconfig.cpp b/src/http/httpserverconfig.cpp index fc45c6554..491285ac4 100644 --- a/src/http/httpserverconfig.cpp +++ b/src/http/httpserverconfig.cpp @@ -120,9 +120,12 @@ void HttpServerConfig::setMaxDynRespHeaderLen(uint32_t len) int HttpServerConfig::getSpdyKeepaliveTimeout() { int timeout = m_iKeepAliveTimeout; - timeout *= ConnLimitCtrl::getInstance().getSslAvailRatio() / 10 + 5; - if (timeout > 60) - timeout = 60; + if (timeout > 0) + { + timeout *= ConnLimitCtrl::getInstance().getSslAvailRatio() / 10 + 5; + if (timeout > 60) + timeout = 60; + } return timeout; } diff --git a/src/http/httpsession.cpp b/src/http/httpsession.cpp index 7c92b75a9..22a5e326e 100644 --- a/src/http/httpsession.cpp +++ b/src/http/httpsession.cpp @@ -3265,7 +3265,7 @@ off_t HttpSession::writeRespBodySendFile(int fdFile, off_t offset, if (written > 0) { - m_response.written(written); + bytesSent(written); LS_DBG_M(getLogSession(), "Response body sent: %lld.\n", (long long)m_response.getBodySent()); } @@ -3275,14 +3275,21 @@ off_t HttpSession::writeRespBodySendFile(int fdFile, off_t offset, #endif +inline void HttpSession::bytesSent(int bytes) +{ + m_response.written(bytes); + /* + * lslbd has the below code + if (m_request.getVHost()) + ((HttpVHost *)m_request.getVHost())->bytesSent(bytes, m_request.isHttps()); + */ +} + /** * @return -1 error * 0 complete * 1 continue */ - - - int HttpSession::writeRespBodyDirect(const char *pBuf, int size) { int written; @@ -3294,7 +3301,7 @@ int HttpSession::writeRespBodyDirect(const char *pBuf, int size) { LS_DBG_H(getLogSession(), "writeRespBodyDirect(): write(%p, %d) written %d, total sent: %lld\n", pBuf, size, written, (long long)m_response.getBodySent() + written); - m_response.written(written); + bytesSent(written); } return written; } @@ -3500,12 +3507,19 @@ void HttpSession::rewindRespBodyBuf() int HttpSession::sendDynBody() { - size_t toWrite; - char *pBuf; - - while (((pBuf = getRespBodyBuf()->getReadBuffer(toWrite)) != NULL) - && (toWrite > 0)) + while (1) { + size_t toWrite; + char *pBuf = getRespBodyBuf()->getReadBuffer(toWrite); + + LS_DBG_M(getLogSession(), + "sendDynBody() buffer: %p, len: %zd, sent %lld\n", + pBuf, toWrite, (long long)m_lDynBodySent); + if (!pBuf) + return LS_FAIL; + + if (toWrite <= 0) + break; int len = toWrite; if (m_response.getContentLen() > 0) { @@ -3519,12 +3533,19 @@ int HttpSession::sendDynBody() } } + + /** + * 10/28/2020 -- David + * Since we keep have crash for big file serving from this function, + * add this assert here, + * If the buffer is meesy up, access the last byte will crash. + */ + assert(*(pBuf + len -1) == 0x00 || *(pBuf + len -1) != 0x00); int ret = writeRespBody(pBuf, len); LS_DBG_M(getLogSession(), "writeRespBody() len = %d, returned %d.\n", len, ret); if (ret > 0) { - assert(ret <= len); m_lDynBodySent += ret; getRespBodyBuf()->readUsed(ret); if (ret < len) @@ -5478,7 +5499,7 @@ int HttpSession::handleAioSFEvent(Aiosfcb *event) } else if (written > 0) { - m_response.written(written); + bytesSent(written); LS_DBG_M(getLogSession(), "Aio Response body sent: %lld.", (long long)m_response.getBodySent()); m_sendFileInfo.incCurPos(written); diff --git a/src/http/httpsession.h b/src/http/httpsession.h index 80989c814..3651d4eb1 100644 --- a/src/http/httpsession.h +++ b/src/http/httpsession.h @@ -565,6 +565,7 @@ class HttpSession long getReqTime() const { return m_lReqTime; } int32_t getReqTimeUs() const { return m_iReqTimeUs; } + void bytesSent(int bytes); int writeRespBodyDirect(const char *pBuf, int size); int writeRespBody(const char *pBuf, int len); diff --git a/src/http/iptoloc.cpp b/src/http/iptoloc.cpp index e3f29bf93..14eef6da7 100644 --- a/src/http/iptoloc.cpp +++ b/src/http/iptoloc.cpp @@ -309,12 +309,12 @@ int IpToLoc::loadIpToLocDbFile(char *pFile, int flag) return LS_FAIL; } - if (IP2Location_open_mem(pIpToLoc, (IP2Location_mem_type)flag) == -1) + if (IP2Location_open_mem(pIpToLoc, (IP2Location_lookup_mode)flag) == -1) { LS_ERROR("loadIpToLocDbFile %s open mem failed.", pFile); } - int fd = fileno(pIpToLoc->filehandle); + int fd = fileno(pIpToLoc->file); if (fd != -1) ::fcntl(fd, F_SETFD, FD_CLOEXEC); diff --git a/src/http/rewriteengine.cpp b/src/http/rewriteengine.cpp index a1d629717..cdbab32ba 100644 --- a/src/http/rewriteengine.cpp +++ b/src/http/rewriteengine.cpp @@ -1361,7 +1361,7 @@ int RewriteEngine::processRuleSet(const RewriteRuleList *pRuleList, m_pQS, m_qsLen, pSession->isHttps()) == 0) { pReq->setRewriteLocation((char *)m_pSourceURL, m_sourceURLLen, - m_pQS, m_qsLen, m_flag & RULE_FLAG_NOESCAPE); + m_pQS, m_qsLen, (m_flag & RULE_FLAG_NOESCAPE) == 0); pReq->orContextState(REWRITE_REDIR); } else diff --git a/src/lsiapi/lsiapilib.cpp b/src/lsiapi/lsiapilib.cpp index 863b50fbd..eb17a0c04 100644 --- a/src/lsiapi/lsiapilib.cpp +++ b/src/lsiapi/lsiapilib.cpp @@ -1947,8 +1947,19 @@ static int get_access_log_string(const lsi_session_t *session, if ((pSession == NULL) || (!log_pattern) || (!buf)) return LS_FAIL; - int ret = AccessLog::getLogString(pSession, log_pattern, buf, bufLen); - return ret; + if (pSession->getReq()) + { + AccessLog *pLogger = NULL; + HttpVHost *host = (HttpVHost *)pSession->getReq()->getVHost(); + if (host && (pLogger = host->getAccessLog()) != NULL) + { + + int ret = pLogger->getLogString(pSession, log_pattern, buf, bufLen); + return ret; + } + } + + return LS_FAIL; } diff --git a/src/main/lshttpdmain.cpp b/src/main/lshttpdmain.cpp index e91609e3b..00d0beb51 100644 --- a/src/main/lshttpdmain.cpp +++ b/src/main/lshttpdmain.cpp @@ -83,7 +83,7 @@ /*** * Do not change the below format, it will be set correctly while packing the code */ -#define BUILDTIME " (built: Tue Sep 22 17:42:17 UTC 2020)" +#define BUILDTIME " (built: Thu Oct 29 15:05:03 UTC 2020)" #define GlobalServerSessionHooks (LsiApiHooks::getServerSessionHooks()) diff --git a/src/modules/cache/cache.cpp b/src/modules/cache/cache.cpp index 88773f43f..443454044 100644 --- a/src/modules/cache/cache.cpp +++ b/src/modules/cache/cache.cpp @@ -1438,8 +1438,9 @@ int checkBypassHeader(const char *header, int len) "content-encoding", "set-cookie", "x-litespeed-cache", //bypass itself, otherwise always value is 'miss' + "connection", //https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Connection }; - int8_t headersBypassLen[] = { 13, 4, 4, 14, 17, 16, 10, 17, }; + int8_t headersBypassLen[] = { 13, 4, 4, 14, 17, 16, 10, 17, 10,}; int count = sizeof(headersBypass) / sizeof(const char *); for (int i = 0; i < count ; ++i) @@ -1920,7 +1921,7 @@ static int createEntry(lsi_param_t *rec) { clearHooks(rec->session); g_api->log(rec->session, LSI_LOG_ERROR, - "[%s] createEntry failed.\n", ModuleNameStr); + "[%s] createEntry failed, may due to no permission to write file or file is updating.\n", ModuleNameStr); return 0; } diff --git a/src/quic/quicengine.cpp b/src/quic/quicengine.cpp index e9ed483d7..df1ae1c9d 100644 --- a/src/quic/quicengine.cpp +++ b/src/quic/quicengine.cpp @@ -175,7 +175,18 @@ lsquic_conn_ctx_t *QuicEngine::onNewConn(void *stream_if_ctx, return NULL; } - pClientInfo = ClientCache::getInstance().getClientInfo((sockaddr *)pPeer); + if ((AF_INET6 == pPeer->sa_family) && + (IN6_IS_ADDR_V4MAPPED(&((sockaddr_in6 *)pPeer)->sin6_addr))) + { + char serverAddr[28] = {0}; + struct sockaddr *pAddr = (sockaddr *)serverAddr; + pAddr->sa_family = AF_INET; + memmove(&((sockaddr_in *)pAddr)->sin_addr.s_addr, &((char *)pPeer)[20], 4); + pClientInfo = ClientCache::getInstance().getClientInfo((sockaddr *)pAddr); + } + else + pClientInfo = ClientCache::getInstance().getClientInfo((sockaddr *)pPeer); + if (!pClientInfo || (int) pClientInfo->getConns() >= pClientInfo->getPerClientHardLimit()) { diff --git a/src/shm/lsshm.cpp b/src/shm/lsshm.cpp index f01fe8f09..4e56ab31d 100644 --- a/src/shm/lsshm.cpp +++ b/src/shm/lsshm.cpp @@ -787,13 +787,11 @@ void LsShm::unmap() } -LsShmOffset_t LsShm::allocPage(LsShmSize_t pagesize, int &remap) +LsShmOffset_t LsShm::allocPage(LsShmSize_t pagesize) { LsShmOffset_t offset; LsShmSize_t availSize; - remap = 0; - // // MUTEX SHOULD BE HERE for multi process/thread environment // Only use lock when m_status is Ready. diff --git a/src/shm/lsshm.h b/src/shm/lsshm.h index 5f9d02874..31f30ebf2 100644 --- a/src/shm/lsshm.h +++ b/src/shm/lsshm.h @@ -155,7 +155,7 @@ class LsShm : public ls_shm_s LsShmOffset_t getMapStatOffset() const; - LsShmOffset_t allocPage(LsShmSize_t pagesize, int &remapped); + LsShmOffset_t allocPage(LsShmSize_t pagesize); int reserveAddrSpace(LsShmSize_t total) { return m_addrMap.mapAddrSpace(total); } diff --git a/src/shm/lsshmhash.cpp b/src/shm/lsshmhash.cpp index 6b1aec85b..15819791b 100644 --- a/src/shm/lsshmhash.cpp +++ b/src/shm/lsshmhash.cpp @@ -317,9 +317,9 @@ void *LsShmHash::getObsData(LsShmHElem *pElem) const } -LsShmOffset_t LsShmHash::alloc2(LsShmSize_t size, int &remapped) +LsShmOffset_t LsShmHash::alloc2(LsShmSize_t size) { - LsShmOffset_t ret = m_pPool->alloc2(size, remapped); + LsShmOffset_t ret = m_pPool->alloc2(size); if (ret != 0) getHTable()->x_stat.m_iHashInUse += LsShmPool::size2roundSize(size); return ret; @@ -457,9 +457,7 @@ LsShmOffset_t LsShmHash::allocHTable(LsShmPool * pPool, int init_size, int iMode, int iFlags, LsShmOffset_t lockOffset) { - int remapped; - // NOTE: system is not up yet... ignore remap here - LsShmOffset_t offset = pPool->alloc2(sizeof(LsShmHTable), remapped); + LsShmOffset_t offset = pPool->alloc2(sizeof(LsShmHTable)); if (offset == 0) { return 0; @@ -468,7 +466,7 @@ LsShmOffset_t LsShmHash::allocHTable(LsShmPool * pPool, int init_size, init_size = roundUp(init_size); int szTable = sz2TableSz(init_size); int szBitMap = sz2BitMapSz(init_size); - LsShmOffset_t iBase = pPool->alloc2(szTable + szBitMap, remapped); + LsShmOffset_t iBase = pPool->alloc2(szTable + szBitMap); if (iBase == 0) { @@ -698,8 +696,6 @@ int LsShmHash::rehash() LsShmSize_t newSize; LsShmOffset_t newIdxOff; LsShmOffset_t newBitOff; - LsShmHIterOff *pOldTbl; - LsShmHIterOff *pNewTbl; LsShmHIterOff *opIdx; LsShmHIterOff *npIdx; iterator iter; @@ -717,19 +713,18 @@ int LsShmHash::rehash() ); #endif LsShmHTable *pTable = getHTable(); - pOldTbl = (LsShmHIterOff *)m_pPool->offset2ptr(pTable->x_iHIdx); if (pTable->x_iHIdx != pTable->x_iHIdxNew) // rehash in progress { newSize = pTable->x_iCapacityNew; newIdxOff = pTable->x_iHIdxNew; - pNewTbl = (LsShmHIterOff *)m_pPool->offset2ptr(newIdxOff); if ((iterOff.m_iOffset = pTable->x_iWorkIterOff) != 0) // iter in progress { iter = offset2iterator(iterOff); - npIdx = pNewTbl + getIndex(iter->x_hkey, newSize); + npIdx = (LsShmHIterOff *)m_pPool->offset2ptr(newIdxOff + + sizeof(LsShmHIterOff) * getIndex(iter->x_hkey, newSize)); if (npIdx->m_iOffset != iterOff.m_iOffset) // not there yet { - opIdx = pOldTbl + getIndex(iter->x_hkey, oldSize); + opIdx = getHidx(getIndex(iter->x_hkey, oldSize)); if (opIdx->m_iOffset == iterOff.m_iOffset) opIdx->m_iOffset = iter->x_iNext.m_iOffset; // remove from old iter->x_iNext.m_iOffset = npIdx->m_iOffset; @@ -739,16 +734,14 @@ int LsShmHash::rehash() } else { - int remapped; newSize = s_primeList[findRange(oldSize) + growFactor()]; szTable = sz2TableSz(newSize); szBitMap = sz2BitMapSz(newSize); - if ((newBitOff = alloc2(szTable + szBitMap, remapped)) == 0) + if ((newBitOff = alloc2(szTable + szBitMap)) == 0) return LS_FAIL; uint8_t *ptr = (uint8_t *)offset2ptr(newBitOff); ::memset(ptr, 0, szTable + szBitMap); newIdxOff = newBitOff + szBitMap; - pNewTbl = (LsShmHIterOff *)(ptr + szBitMap); pTable = getHTable(); pTable->x_iBitMap = newBitOff; pTable->x_iBitMapSz = szBitMap; @@ -757,15 +750,15 @@ int LsShmHash::rehash() } iterOff = begin(); - pOldTbl = (LsShmHIterOff *)m_pPool->offset2ptr(pTable->x_iHIdx); while(iterOff.m_iOffset != 0) { uint32_t new_idx; iter = offset2iterator(iterOff); - opIdx = pOldTbl + getIndex(iter->x_hkey, oldSize); + opIdx = getHidx(getIndex(iter->x_hkey, oldSize)); iterNextOff = next(iterOff); new_idx = getIndex(iter->x_hkey, newSize); - npIdx = pNewTbl + new_idx; + npIdx = (LsShmHIterOff *)m_pPool->offset2ptr(newIdxOff + + sizeof(LsShmHIterOff) * new_idx); setBitMapEnt(new_idx); pTable->x_iWorkIterOff = iterOff.m_iOffset; @@ -1067,9 +1060,8 @@ LsShmHash::iteroffset LsShmHash::allocIter(int keyLen, int realValLen) int valLen = realValLen + m_dataExtraSpace; LsShmHElemLen_t elementSize = sizeof(LsShmHElem) + valueOff + sizeof(ls_vardata_t) + round4(valLen); - int remapped; iteroffset offset; - offset.m_iOffset = alloc2(elementSize, remapped); + offset.m_iOffset = alloc2(elementSize); if (offset.m_iOffset == 0) return offset; LsShmHElem *pNew = (LsShmHElem *)m_pPool->offset2ptr(offset.m_iOffset); @@ -1265,9 +1257,8 @@ LsShmHash::iteroffset LsShmHash::iterGrowValue(iteroffset iterOff, int valLen = pOld->getValLen(); int valOff = pOld->x_iValOff; int newTotalSize = pOld->x_iLen + round4(size_to_grow); - int remapped; iteroffset offset; - offset.m_iOffset = alloc2(newTotalSize, remapped); + offset.m_iOffset = alloc2(newTotalSize); if (offset.m_iOffset == 0) return offset; LsShmHElem *pNew = offset2iterator(offset); diff --git a/src/shm/lsshmhash.h b/src/shm/lsshmhash.h index 996f3d2d7..db3b37db4 100644 --- a/src/shm/lsshmhash.h +++ b/src/shm/lsshmhash.h @@ -241,7 +241,9 @@ class LsShmHash : public ls_shmhash_s // void *getObsData(LsShmHElem *pElem, LsShmObserver *pObserver) const; void *getObsData(LsShmHElem *pElem) const; - LsShmOffset_t alloc2(LsShmSize_t size, int &remapped); + LsShmOffset_t alloc2(LsShmSize_t size); + LsShmOffset_t alloc2(LsShmSize_t size, int &remapped) + { return alloc2(size); } void release2(LsShmOffset_t offset, LsShmSize_t size); diff --git a/src/shm/lsshmpool.cpp b/src/shm/lsshmpool.cpp index 143cf1509..7f8e8800c 100644 --- a/src/shm/lsshmpool.cpp +++ b/src/shm/lsshmpool.cpp @@ -207,9 +207,8 @@ int LsShmPool::init(LsShm *shm, const char *name, LsShmPool *gpool) // create memory for new Pool // allocate header from SYS POOL LsShmOffset_t offset; - int remapped; int rndPoolMemSz = roundDataSize(sizeof(LsShmPoolMem)); - offset = allocPage(LSSHM_SHM_UNITSIZE, remapped); + offset = allocPage(LSSHM_SHM_UNITSIZE); if (offset == 0) { m_status = LSSHM_BADMAPFILE; @@ -441,13 +440,13 @@ void LsShmPool::destroy() } -LsShmOffset_t LsShmPool::alloc2Ex(LsShmSize_t size, int &remapped) +LsShmOffset_t LsShmPool::alloc2Ex(LsShmSize_t size) { LsShmOffset_t offset; if (size >= LSSHM_SHM_UNITSIZE) { - if ((offset = allocPage(size, remapped)) != 0) + if ((offset = allocPage(size)) != 0) { incrCheck(&getDataMap()->x_stat.m_iPgAllocated, roundSize2pages(size)); } @@ -467,18 +466,17 @@ LsShmOffset_t LsShmPool::alloc2Ex(LsShmSize_t size, int &remapped) } -LsShmOffset_t LsShmPool::alloc2(LsShmSize_t size, int &remapped) +LsShmOffset_t LsShmPool::alloc2(LsShmSize_t size) { LsShmOffset_t offset; if ((size == 0) || (size&0x80000000) || (size>LSSHM_MAXSIZE)) return 0; - remapped = 0; size = roundDataSize(size); autoLock(); do { - offset = alloc2Ex(size, remapped); + offset = alloc2Ex(size); if (size > LARGE_PAGE_SIZE) break; int end_page = (offset + size - 1) >> LARGE_PAGE_BITS; @@ -1006,14 +1004,11 @@ LsShmOffset_t LsShmPool::allocFromDataChunk(LsShmSize_t size, if (needed < LSSHM_SHM_UNITSIZE) needed = LSSHM_SHM_UNITSIZE; - int remapped = 0; - if ((offset = allocPage(needed, remapped)) == 0) + if ((offset = allocPage(needed)) == 0) { num = 0; return 0; } - if (remapped != 0) - pDataMap = getDataMap(); pDataMap->x_stat.m_iFreeChunk += needed; if (releaseOffset != 0) @@ -1259,21 +1254,20 @@ bool LsShmPool::isFreeBlockBelow( } -LsShmOffset_t LsShmPool::allocPage(LsShmSize_t pagesize, int &remap) +LsShmOffset_t LsShmPool::allocPage(LsShmSize_t pagesize) { LsShmOffset_t offset; if ((pagesize&0x80000000) || (pagesize>LSSHM_MAXSIZE)) return 0; pagesize = roundPageSize(pagesize); - remap = 0; LsShmPool *pPagePool = ((m_pParent != NULL) ? m_pParent : this); if (m_pParent != NULL) pPagePool->autoLock(); if ((offset = pPagePool->getFromFreeList(pagesize)) == 0) { - if ((offset = m_pShm->allocPage(pagesize, remap)) == 0) + if ((offset = m_pShm->allocPage(pagesize)) == 0) { goto out; } diff --git a/src/shm/lsshmpool.h b/src/shm/lsshmpool.h index 50520239d..b45d710e8 100644 --- a/src/shm/lsshmpool.h +++ b/src/shm/lsshmpool.h @@ -74,9 +74,9 @@ typedef struct class LsShmPool : public ls_shmpool_s { + friend class LsShm; public: LsShmPool(); - ~LsShmPool(); public: LsShmHash *getNamedHash(const char *name, LsShmSize_t init_size, @@ -126,7 +126,9 @@ class LsShmPool : public ls_shmpool_s return ((size + (LSSHM_SHM_UNITSIZE - 1)) / LSSHM_SHM_UNITSIZE); }; - LsShmOffset_t alloc2(LsShmSize_t size, int &remapped); + LsShmOffset_t alloc2(LsShmSize_t size); + LsShmOffset_t alloc2(LsShmSize_t size, int &remapped) + { return alloc2(size); } void release2(LsShmOffset_t offset, LsShmSize_t size); void mvFreeList(); void mvFreeBucket(); @@ -196,7 +198,7 @@ class LsShmPool : public ls_shmpool_s LsShmOffset_t getReg(const char *name); - LsShmOffset_t allocPage(LsShmSize_t pagesize, int &remapped); + LsShmOffset_t allocPage(LsShmSize_t pagesize); void releasePageLocked(LsShmOffset_t offset, LsShmSize_t pagesize); void releasePageNoJoinLocked(LsShmOffset_t offset, LsShmSize_t pagesize); @@ -235,7 +237,7 @@ class LsShmPool : public ls_shmpool_s void incrCheck(LsShmXSize_t *ptr, LsShmSize_t size); - LsShmOffset_t alloc2Ex(LsShmSize_t size, int &remapped); + LsShmOffset_t alloc2Ex(LsShmSize_t size); void releasePageLockParent(LsShmOffset_t offset, LsShmSize_t size); void release2Ex(LsShmOffset_t offset, LsShmSize_t size); void release2NoJoin(LsShmOffset_t offset, LsShmSize_t size); @@ -245,6 +247,9 @@ class LsShmPool : public ls_shmpool_s LsShmPool &operator=(const LsShmPool &other); bool operator==(const LsShmPool &other); + //NOTE: make it private to disallow direct call, only use LsShmPool->close(). + ~LsShmPool(); + uint32_t m_iMagic; LsShm *m_pShm; // SHM handle LsShmStatus_t m_status; // Ready ... diff --git a/src/shm/lsshmtidmgr.cpp b/src/shm/lsshmtidmgr.cpp index e77b8aa0d..012c676bd 100644 --- a/src/shm/lsshmtidmgr.cpp +++ b/src/shm/lsshmtidmgr.cpp @@ -207,12 +207,12 @@ uint64_t LsShmTidMgr::getTidCb(LsShmHElem* pElem) LsShmOffset_t LsShmTidMgr::allocBlkIdx(LsShmOffset_t oldIdx, LsShmSize_t oldCnt, - LsShmSize_t newCnt, int &remapped) + LsShmSize_t newCnt) { LsShmOffset_t off, *pOld, *pNew; if (0 == newCnt) newCnt = oldCnt + LSSHMTID_BLKIDX_INCR; - if ((off = m_pHash->alloc2(LSSHMTID_BLKIDX_SIZE(newCnt), remapped)) == 0) + if ((off = m_pHash->alloc2(LSSHMTID_BLKIDX_SIZE(newCnt))) == 0) return 0; if (oldIdx == 0) return off; @@ -224,13 +224,12 @@ LsShmOffset_t LsShmTidMgr::allocBlkIdx(LsShmOffset_t oldIdx, LsShmSize_t oldCnt, } -LsShmOffset_t LsShmTidMgr::growTidTbl(uint64_t base, int &remapped) +LsShmOffset_t LsShmTidMgr::growTidTbl(uint64_t base) { LsShmTidInfo *pTidInfo; LsShmTidTblBlk *pBlk = NULL; LsShmOffset_t blkOff, idxOff, *pBlkIdx; - int iRemap; - if ((blkOff = m_pHash->alloc2(sizeof(LsShmTidTblBlk), remapped)) == 0) + if ((blkOff = m_pHash->alloc2(sizeof(LsShmTidTblBlk))) == 0) return 0; pTidInfo = getTidInfo(); // Increment blk index by LSSHMTID_BLKIDX_INCR (currently 0x100). @@ -239,16 +238,11 @@ LsShmOffset_t LsShmTidMgr::growTidTbl(uint64_t base, int &remapped) if ((pTidInfo->x_iBlkCnt & LSSHMTID_BLKIDX_CMP) == 0) { if ((idxOff = allocBlkIdx(pTidInfo->x_iBlkIdxOff, pTidInfo->x_iBlkCnt, - 0, iRemap)) == 0) + 0)) == 0) { m_pHash->release2(blkOff, sizeof(LsShmTidTblBlk)); return 0; } - if (iRemap != 0) - { - remapped = iRemap; - pTidInfo = getTidInfo(); - } pTidInfo->x_iBlkIdxOff = idxOff; } if (pTidInfo->x_iTidTblCurOff != 0) @@ -273,14 +267,13 @@ LsShmOffset_t LsShmTidMgr::growTidTbl(uint64_t base, int &remapped) int LsShmTidMgr::checkTidTbl() { - int remapped = 0; LsShmTidInfo *pTidInfo = getTidInfo(); uint64_t tid = pTidInfo->x_tid + 1; LsShmTidTblBlk *pBlk = (LsShmTidTblBlk *)m_pHash->offset2ptr(pTidInfo->x_iTidTblCurOff); if ((pBlk == NULL) || (tid >= (pBlk->x_tidBase + TIDTBLBLK_MAXSZ))) - growTidTbl(tid - (tid % TIDTBLBLK_MAXSZ), remapped); - return remapped; + growTidTbl(tid - (tid % TIDTBLBLK_MAXSZ)); + return LS_OK; } @@ -300,8 +293,7 @@ int LsShmTidMgr::setTidTblEnt(uint64_t tidVal, uint64_t *pTid) indx = (*pTid % TIDTBLBLK_MAXSZ); if ((pBlk == NULL) || (*pTid >= (pBlk->x_tidBase + TIDTBLBLK_MAXSZ))) { - int remapped; - LsShmOffset_t blkOff = growTidTbl(*pTid - indx, remapped); + LsShmOffset_t blkOff = growTidTbl(*pTid - indx); if (blkOff == 0) return -1; pBlk = (LsShmTidTblBlk *)m_pHash->offset2ptr(blkOff); @@ -393,11 +385,10 @@ uint64_t *LsShmTidMgr::nxtValInBlk(LsShmTidTblBlk *pBlk, int *pIndx) } -int LsShmTidMgr::shiftBlkIdx(uint64_t numToRemove, int &remapped) +int LsShmTidMgr::shiftBlkIdx(uint64_t numToRemove) { LsShmTidInfo *pTidInfo = getTidInfo(); LsShmOffset_t idxOff, *pBlkIdx = (LsShmOffset_t *)m_pHash->offset2ptr(pTidInfo->x_iBlkIdxOff); - remapped = 0; memmove(pBlkIdx, &pBlkIdx[numToRemove], LSSHMTID_BLKIDX_SIZE(pTidInfo->x_iBlkCnt - numToRemove)); @@ -416,14 +407,12 @@ int LsShmTidMgr::shiftBlkIdx(uint64_t numToRemove, int &remapped) // If the assert fails, we have a bad comparison. assert(newBlkIdxSize != curBlkIdxSize); - if ((idxOff = allocBlkIdx(pTidInfo->x_iBlkIdxOff, curBlkIdxSize, newBlkIdxSize, - remapped)) == 0) + if ((idxOff = allocBlkIdx(pTidInfo->x_iBlkIdxOff, curBlkIdxSize, + newBlkIdxSize)) == 0) { // Trouble spot. May have a SHM leak if we cannot shrink the current block. return -1; } - if (remapped) - pTidInfo = getTidInfo(); pTidInfo->x_iBlkIdxOff = idxOff; pBlkIdx = (LsShmOffset_t *)m_pHash->offset2ptr(idxOff); } @@ -469,11 +458,8 @@ uint64_t LsShmTidMgr::trim() if (blksIter) { - int remapped = 0; - if (0 == shiftBlkIdx(blksIter, remapped)) + if (0 == shiftBlkIdx(blksIter)) { - if (remapped) - pTidInfo = getTidInfo(); pBlkIdx = (LsShmOffset_t *)m_pHash->offset2ptr(pTidInfo->x_iBlkIdxOff); blksIter = 1; // We know 0 is not empty or it is the current block. blksTotal = pTidInfo->x_iBlkCnt - 1; diff --git a/src/shm/lsshmtidmgr.h b/src/shm/lsshmtidmgr.h index 06d7b398e..59a8e921b 100644 --- a/src/shm/lsshmtidmgr.h +++ b/src/shm/lsshmtidmgr.h @@ -70,7 +70,7 @@ class LsShmTidMgr ~LsShmTidMgr() {} int init(LsShmHash *pHash, LsShmOffset_t off, bool blkinit); void clrTidTbl(); - LsShmOffset_t growTidTbl(uint64_t base, int &remapped); + LsShmOffset_t growTidTbl(uint64_t base); int checkTidTbl(); void linkTid(LsShmHIterOff offElem, uint64_t *pTid); @@ -169,9 +169,9 @@ class LsShmTidMgr uint64_t *nxtValInBlk(LsShmTidTblBlk *pBlk, int *pIndx); LsShmOffset_t allocBlkIdx(LsShmOffset_t oldIdx, LsShmSize_t curSize, - LsShmSize_t newSize, int &remapped); + LsShmSize_t newSize); - int shiftBlkIdx(uint64_t numToRemove, int &remapped); + int shiftBlkIdx(uint64_t numToRemove); LsShmHash *m_pHash; LsShmOffset_t m_iOffset; diff --git a/src/spdy/unpackedheaders.cpp b/src/spdy/unpackedheaders.cpp index 04e944848..001771ebd 100644 --- a/src/spdy/unpackedheaders.cpp +++ b/src/spdy/unpackedheaders.cpp @@ -215,7 +215,7 @@ static int lookup[] = -58, //"timing-allow-origin" -59, //"upgrade-insecure-requests" HttpHeader::H_USERAGENT, //"user-agent" - -60, //"x-forwarded-for" + HttpHeader::H_X_FORWARDED_FOR, //"x-forwarded-for" -61, //"x-frame-options" -62, //"x-frame-options" }; diff --git a/src/util/autobuf.h b/src/util/autobuf.h index 1beccc229..c182170c9 100644 --- a/src/util/autobuf.h +++ b/src/util/autobuf.h @@ -134,6 +134,13 @@ class AutoBuf : private ls_buf_t int append(const char *pBuf) { return ls_buf_append(this, pBuf); } + void append(char ch) + { + if (available() < 1) + grow(1); + *pend++ = ch; + } + void append_unsafe(char ch) { *pend++ = ch; } int append_unsafe(const char *pBuf, int size)