40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
+
-
-
+
+
-
+
-
+
-
-
-
-
-
+
+
-
+
+
+
+
|
|**wapp-cache-control** _CONTROL_|→|Set caching behavior of current page|
|**wapp-content-security-policy** _POLICY_|→|Set the CSP for the current page|
|**wapp-debug-env**|→|Return a text description of the Wapp environment|
|**wapp** {_TEXT_}|→|Append _TEXT_ without substitution|
|**wapp-unsafe** _TEXT_|→|Append _TEXT_ that contains nothing that needs to be escaped|
<a name="cgiparams"></a>
3.0 Parameters
--------------
3.0 CGI Parameters
------------------
>
|BASE\_URL|→|URL for the Wapp script without a method|
|CONTENT|→|Raw (unparsed) POST content|
|CONTENT\_LENGTH|→|Number of bytes of raw, unparsed POST content|
|CONTENT\_TYPE|→|Mimetype of the POST content|
|DOCUMENT\_ROOT|→|Directory that is the root of the webserver content tree|
|HTTP\_COOKIE|→|Raw, unparsed cookies|
|HTTP\_HOST|→|Hostname to which this request was sent|
|HTTP\_USER\_AGENT|→|Name of client program that sent current request|
|HTTPS|→|Exists and has value "on" if the request is encrypted|
|HTTPS|→|Exists and has value "on" if the request is TLS encrypted|
|PATH\_HEAD|→|First element of PATH\_INFO. Determines request handler|
|PATH\_INFO|→|URL path beyond the application script name|
|PATH\_TAIL|→|Part of PATH\_INFO beyond PATH\_HEAD|
|REMOTE\_ADDR|→|IP address of the client|
|REMOTE\_PORT|→|TCP port of the client|
|REQUEST\_METHOD|→|"GET" or "POST" or "HEAD"|
|SAME\_ORIGIN|→|True if this request is from the same origin|
|SCRIPT\_FILENAME|→|Full pathname of the Wapp application script|
|SCRIPT\_NAME|→|Prefix of PATH\_INFO that identifies the application script|
|SELF\_URL|→|URL of this request without PATH\_TAIL|
|WAPP\_MODE|→|One of "cgi", "scgi", "server", or "local"|
4.0 URL Parsing
---------------
Assuming "env.tcl" is the name of the Wapp application script:
>
https://wapp.tcl.tk/demo/env.tcl/abc/def/ghi?a=5&b=22.425#point42
\_________/ \__________/\__________/
\_________/\___________/\__________/
| | |
HTTP_HOST SCRIPT_NAME PATH_INFO
>
SCRIPT_FILENAME := DOCUMENT_ROOT + SCRIPT_NAME
>
https://wapp.tcl.tk/demo/env.tcl/abc/def/ghi?a=5&b=22.425#point42
\______________________________/ \_/ \_____/
| | |
BASE_URL PATH_HEAD '-- PATH_TAIL
BASE_URL PATH_HEAD |-- PATH_TAIL
| __|__
>
/ \ / \
https://wapp.tcl.tk/demo/env.tcl/abc/def/ghi?a=5&b=22.425#point42
\__________________________________/ \__________/
| |
SELF_URL QUERY_STRING
>
SCRIPT_FILENAME := DOCUMENT_ROOT + SCRIPT_NAME
|