Software: Apache. PHP/8.1.30 uname -a: Linux server1.tuhinhossain.com 5.15.0-163-generic #173-Ubuntu SMP Tue Oct 14 17:51:00 UTC uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root) Safe-mode: OFF (not secure) /usr/share/doc/node-negotiator/examples/ drwxr-xr-x | |
| Viewing file: Select action/file-type: (function() {
var Negotiator, gbuf, http, messages;
Negotiator = require('../lib/negotiator').Negotiator;
http = require('http');
gbuf = require('gzip-buffer');
messages = {
identity: 'Hello World'
};
gbuf.gzip(messages.identity, function(zipped) {
var availableEncodings, key, server, val;
messages.gzip = zipped;
availableEncodings = (function() {
var _results;
_results = [];
for (key in messages) {
val = messages[key];
_results.push(key);
}
return _results;
})();
console.log(availableEncodings);
server = http.createServer(function(req, res) {
var encoding, negotiator;
negotiator = new Negotiator(req);
console.log("Accept-Encoding: " + req.headers['accept-encoding']);
console.log("Preferred: " + (negotiator.encodings()));
console.log("Possible: " + (negotiator.encodings(availableEncodings)));
encoding = negotiator.encoding(availableEncodings);
console.log("Selected: " + encoding);
if (encoding) {
res.writeHead(200, {
'Content-Encoding': encoding
});
return res.end(messages[encoding]);
} else {
res.writeHead(406);
return res.end();
}
});
return server.listen(8080);
});
}).call(this);
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0039 ]-- |