WebServer: Enable deflate and gzip compression (#3677)

* get-index: Enable deflate and gzip compression

* Spaces -> Tabs

* listen: Add optional `gzip=yes` parameter (defaults to "no")

* get-index: Add comment explaining the usage of `zlib.*Sync` instead of async.
This commit is contained in:
Moritz Ulrich
2019-01-27 17:23:24 +01:00
committed by Jeremy Ruston
parent 02fbae4200
commit 049244e8a8
3 changed files with 33 additions and 3 deletions

View File

@@ -43,6 +43,8 @@ function Server(options) {
$tw.utils.extend({},this.defaultVariables,options.variables);
// Initialise CSRF
this.csrfDisable = this.get("csrf-disable") === "yes";
// Initialize Gzip compression
this.enableGzip = this.get("gzip") === "yes";
// Initialise authorization
var authorizedUserName = (this.get("username") && this.get("password")) ? this.get("username") : "(anon)";
this.authorizationPrincipals = {
@@ -84,7 +86,8 @@ Server.prototype.defaultVariables = {
"tiddler-render-template": "$:/core/templates/server/static.tiddler.html",
"system-tiddler-render-type": "text/plain",
"system-tiddler-render-template": "$:/core/templates/wikified-tiddler",
"debug-level": "none"
"debug-level": "none",
"gzip": "no"
};
Server.prototype.get = function(name) {