Commit d71fbf0d authored by Ad Schellevis's avatar Ad Schellevis

webgui, allow use of output compression for dynamic content. in same cases...

webgui, allow use of output compression for dynamic content. in same cases saves approx. 90% of datatransfer to client, at some cpu cost. default Off
parent 7560c617
......@@ -30,10 +30,21 @@ chmod 644 ${PHP_INI}
# Fetch the timezone from the XML and set it here
TIMEZONE=Etc/UTC
ZLIB_COMPRESSION_LEVEL=""
if [ -f /conf/config.xml ]; then
TIMEZONE=`cat /conf/config.xml | egrep -E '<timezone>(.*?)</timezone>' | awk -F'>' '{print $2}'|awk -F'<' '{print $1}'`
ZLIB_COMPRESSION_LEVEL=`cat /conf/config.xml | egrep -E '<webuicompression>(.*?)</webuicompression>' | awk -F'>' '{print $2}'|awk -F'<' '{print $1}'`
fi
# enable zlib compression on output processing when selected
if [ -z "$ZLIB_COMPRESSION_LEVEL" ]; then
ZLIB_COMPRESSION_LEVEL=1
ZLIB_COMPRESSION="Off"
else
ZLIB_COMPRESSION="On"
fi
# Get a loaded module list in the stock php
# Populate a dummy php.ini to avoid
# the file being clobbered and the firewall
......@@ -56,8 +67,8 @@ upload_tmp_dir = /tmp
upload_max_filesize = 200M
post_max_size = 200M
html_errors = Off
zlib.output_compression = Off
zlib.output_compression_level = 1
zlib.output_compression = $ZLIB_COMPRESSION
zlib.output_compression_level = $ZLIB_COMPRESSION_LEVEL
include_path = ".:/usr/local/etc/inc:/usr/local/www:/usr/local/opnsense/mvc:/usr/local/share/pear:/usr/local/opnsense/contrib"
ignore_repeated_errors = on
error_reporting = E_ALL ^ (E_NOTICE | E_DEPRECATED | E_STRICT)
......
......@@ -39,6 +39,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig['webguiproto'] = $config['system']['webgui']['protocol'];
$pconfig['webguiport'] = $config['system']['webgui']['port'];
$pconfig['ssl-certref'] = $config['system']['webgui']['ssl-certref'];
$pconfig['webuicompression'] = isset($config['system']['webgui']['webuicompression']) ? $config['system']['webgui']['webuicompression'] : null;
if (!empty($config['system']['webgui']['ssl-ciphers'])) {
$pconfig['ssl-ciphers'] = explode(':', $config['system']['webgui']['ssl-ciphers']);
} else {
......@@ -98,6 +99,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if ($config['system']['webgui']['protocol'] != $pconfig['webguiproto'] ||
$config['system']['webgui']['port'] != $pconfig['webguiport'] ||
$config['system']['webgui']['ssl-certref'] != $pconfig['ssl-certref'] ||
$config['system']['webgui']['webuicompression'] != $pconfig['webuicompression'] ||
$config['system']['webgui']['ssl-ciphers'] != $newciphers ||
($pconfig['disablehttpredirect'] == "yes") != !empty($config['system']['webgui']['disablehttpredirect'])
) {
......@@ -110,6 +112,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$config['system']['webgui']['port'] = $pconfig['webguiport'];
$config['system']['webgui']['ssl-certref'] = $pconfig['ssl-certref'];
$config['system']['webgui']['ssl-ciphers'] = $newciphers;
$config['system']['webgui']['webuicompression'] = $pconfig['webuicompression'];
if ($pconfig['disablehttpredirect'] == "yes") {
$config['system']['webgui']['disablehttpredirect'] = true;
......@@ -485,6 +488,28 @@ include("head.inc");
</div>
</td>
</tr>
<tr>
<td><a id="help_for_webuicompression" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("WebGui Compression")?></td>
<td width="78%">
<select name="webuicompression" class="formselect selectpicker">
<option value="" <?=empty($pconfig['webuicompression'])? 'selected="selected"' : '';?>>
<?=gettext("Off");?>
</option>
<option value="1" <?=$pconfig['webuicompression'] == "1" ? 'selected="selected"' : '';?>>
<?=gettext("Low");?>
</option>
<option value="5" <?=$pconfig['webuicompression'] == "5" ? 'selected="selected"' : '';?>>
<?=gettext("Medium");?>
</option>
<option value="9" <?=$pconfig['webuicompression'] == "9" ? 'selected="selected"' : '';?>>
<?=gettext("High");?>
</option>
</select>
<div class="hidden" for="help_for_webuicompression">
<?=gettext("Enable compression of webgui pages and dynamic content (transfer less data to the client for an additional cost in processing power).") ?>
</div>
</td>
</tr>
<tr>
<td><a id="help_for_nohttpreferercheck" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("HTTP_REFERER enforcement"); ?></td>
<td>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment