Security & Performance
Runtime Parameters
-
CSS charset
private const string AT_CHARSET; CatMice::LINE["38"];
If true, '
@charset "UTF-8";
' will be automatically prepended to the very beginning after all found charset declaration suspects were automatically removed. If false, it will not mock or prepend anything, but will leave collection as is. Each and every external stylesheet should have charset declaration at the top most of the file, therefore settings this to true, might result as very helpful if stylesheets are created very often. -- Production Value: depends Development Value: depends -
No Literal Zero Cache
private const bool ZERO_HOUR_SKEPTIC; CatMice::LINE["41"];
Tries to prevent TOTAL fresh content. Hours will turn into approx. 7 seconds only if 'hrs' value is set to 0 and this value is set to
TRUE
. This will forceCache/Expires
headers towards client at all costs. That doesn't necessarily mean it surely will handle all rapid flood or DDOS attackes efficiently, but it kinda provides a bit of preventive support for such scenarios. -- Production Value: true Development Value: false -
Zero Cache Tune
private const float ZERO_POINT_IMMUTABLE; CatMice::LINE["44"];
Works only if
$hours === 0
andself::ZERO_HOUR_SKEPTIC === true
This float with its default value will force all 0 hour requests into +7 seconds. As stated above, it depends on ZERO_HOUR_SKEPTIC constant will it behave like so. The default calculation goes like this: -((int)(60 * (60 * $hours)))
This very constantself::ZERO_POINT_IMMUTABLE
will replace$hours
value either from the default parameter of via_GET['hrs']
Default self::ZERO_POINT_IMMUTABLE value for multiplier is 0.0020. So, You may want to tune it more. -- Production Value: depends Development Value: depends -
Third-Party Timeouts
private const int STREAM_CONTEXT_TIMEOUT; CatMice::LINE["47"];
This value is expandExternals related, for when one wants to encode url value directly into sylesheet, where targeted item is not on local filesystem. Sometimes, depending on various factors, third-party server from which one wants to get particular image or font or any encodable asset may become non-responsive or too busy. This might tremendously slow down entire process of fetching and injecting those assets into stylesheet. This value sets timeout value for such stream negotiations - in seconds. All negotiations in fact, unless provided CSS
url()
value is relative or absolute path on local filesystem or points to primary, self-domain. Recommended value is 30 seconds timeout. If self-domain is all about, but there are protocols involved in the url value, timeout would almost never occur, therefore lower value should be ok. How much low, depends on particular server setup. -- Production Value: depends Development Value: depends -
Development Server Streaming
private const bool CLI_SERVER_STREAM; CatMice::LINE["50"];
This value concerns local PHP built-in server and is expandExternals related.
boolean false
will completely disable encoding over cli-server. String transformation mockery will not take action. Original value is returned.if (!is_bool ('PHP_SAPI (cli-server) is NOT in play .. ')): return " .. and apache or ngnix or any other similar full-fledged http server software is running - all good, value of this boolean is irrelevant in that case. "; elseif (in_array ($CSS_url, [ '/images/?fetch=mybackground.webp', '/?fetch=mybackground.webp' // with ? but no port and host , 'http://localhost:8080/?...' // or with ? + host and port, // but .. *(127.0.0.1:) ? ])): print_r (" Built-in server is excellent for local ngnix or apache replacement, but it will 'chug' with subsequental requests. It is single-threaded. For example, calling some stream aka: 'http://localhost/page.php?some=value' from within a closure that is called by primary request, while primary request is still processing itself, method will reach timeout, chug."); ## This is standard 'chug' scenario `php -S localhost:8080 -t /webroot router.php`; ## This will overcome chug scenario: `PHP_CLI_SERVER_WORKERS=8 php -S localhost:8080 -t /webroot router.php`; # Experimental env. variable for mutli-threaded runtime. echo 'Optimal number of server workers depends on a situation.'; else: // Eitherway, actually. # If this value is true, and PHP_CLI_SERVER_WORKERS env is NOT employed die ('STYLE WILL NOT FINISH LOADING !'); # else, if url is pointing to abs. or relative local filesystem path echo 'ALL OK !'; # If NOT all ok! but neither is 'chugging' ... return " 'url()' will be returned as is, the resource will be treated as secondary, ordinary, non-encoded synchronous request with raw, original, static asset response data "; endif;
^^ Production Value: depends Development Value: depends
There is also
-c
parameter for PHP built-in server, which is very nice thing to reconsider in combination withrouter.php
script if one needs to set/modify non-public ini directives as there are rules that cannot be modified during runtime. On top of that, running with sudo priviledges will enable embeded-server over port 80.~$ PHP_CLI_SERVER_WORKERS=8 sudo php -S localhost:80 -c config.ini -t /webroot router.php