File: dump-env.js

package info (click to toggle)
websocketd 0.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 612 kB
  • sloc: makefile: 131; sh: 85; ansic: 78; javascript: 65; cs: 58; perl: 51; python: 43; ruby: 41; php: 40; java: 26; haskell: 20
file content (47 lines) | stat: -rw-r--r-- 1,101 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright 2013 Joe Walnes and the websocketd team.
// All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.


// Standard CGI(ish) environment variables, as defined in
// http://tools.ietf.org/html/rfc3875
var names = [
  'AUTH_TYPE',
  'CONTENT_LENGTH',
  'CONTENT_TYPE',
  'GATEWAY_INTERFACE',
  'PATH_INFO',
  'PATH_TRANSLATED',
  'QUERY_STRING',
  'REMOTE_ADDR',
  'REMOTE_HOST',
  'REMOTE_IDENT',
  'REMOTE_PORT',
  'REMOTE_USER',
  'REQUEST_METHOD',
  'REQUEST_URI',
  'SCRIPT_NAME',
  'SERVER_NAME',
  'SERVER_PORT',
  'SERVER_PROTOCOL',
  'SERVER_SOFTWARE',
  'UNIQUE_ID',
  'HTTPS'
];

var shell = WScript.CreateObject("WScript.Shell");
var env = shell.Environment('PROCESS');

for (var i = 0; i < names.length; i++) {
  var name = names[i];
  var value = env(name) || '<unset>';
  WScript.echo(name + '=' + value);
}

for(var en = new Enumerator(env); !en.atEnd(); en.moveNext()) {
  var item = en.item();
  if (item.indexOf('HTTP_') == 0) {
    WScript.Echo(item);
  }
}