Wapp

Check-in [98bf94e32b]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Enhance the wapp-redirect command so that you can add an optional result code value (ex: 301) to override the default HTTP reply code of 303.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 98bf94e32b31b6f04719a9b7156066cd5923d25c4138a744232e047b397faa8d
User & Date: drh 2025-04-04 14:55:48.636
Context
2025-04-09
16:15
Do not allow the content-length to be zero in a redirect. Put in some content, even if it is not used. (check-in: b46ad175c5 user: drh tags: trunk)
2025-04-04
14:55
Enhance the wapp-redirect command so that you can add an optional result code value (ex: 301) to override the default HTTP reply code of 303. (check-in: 98bf94e32b user: drh tags: trunk)
2025-02-18
12:30
Update the built-in SQLite to the latest trunk version including all fixes. (check-in: ab08ae6abc user: drh tags: trunk)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to docs/commands.md.
94
95
96
97
98
99
100
101
102




103
104
105
106
107
108
109
94
95
96
97
98
99
100


101
102
103
104
105
106
107
108
109
110
111







-
-
+
+
+
+








  +  **wapp-reply-code** _CODE_  
     Set the reply-code for the HTTP request.  The default is "200 Ok".
     If this value is set to ABORT (with no numeric code, just the 5
     upper-case letters "ABORT") then Wapp will drop the connection without
     sending any reply at all.

  +  **wapp-redirect** _TARGET-URL_  
     Cause an HTTP redirect to _TARGET-URL_.
  +  **wapp-redirect** _TARGET-URL_  _?CODE?_
     Cause an HTTP redirect to _TARGET-URL_.  The optional _CODE_ parameter
     is the HTTP result code.  303 is the default.  Use 301 for a
     permanent redirect.

  +  **wapp-reset**  
     Reset the web page under construction back to an empty string.

  +  **wapp-set-cookie** _NAME_ _VALUE_  
     Cause the cookie _NAME_ to be set to _VALUE_.

Changes to docs/quickref.md.
29
30
31
32
33
34
35
36

37
38
39
40
41
42
43
29
30
31
32
33
34
35

36
37
38
39
40
41
42
43







-
+







|**wapp-param** _NAME_ _DEFAULT_|→|Return value of parameter _NAME_|
|**wapp-set-param** _NAME_ _VALUE_|→|Set parameter _NAME_ to _VALUE_|
|**wapp-param-exists** _NAME_|→|True if parameter _NAME_ exists|
|**wapp-param-list** _GLOB_|→|Return parameter names matching _GLOB_|
|**wapp-allow-xorigin-params**|→|Allow GET and POST parameters for cross-origin requests|
|**wapp-mimetype** _MIMETYPE_|→|Set the reply mimetype|
|**wapp-reply-code** _CODE_|→|Set the HTTP reply code|
|**wapp-redirect** _TARGET_|→|Redirect to _TARGET_|
|**wapp-redirect** _TARGET_ _?CODE?_|→|Redirect to _TARGET_|
|**wapp-reset**|→|Reset the output back to an empty string|
|**wapp-set-cookie** _NAME_ _VALUE_|→|Set cookie _NAME_ to have _VALUE_|
|**wapp-clear-cookie** _NAME_|→|Delete cookie _NAME_|
|**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|
Changes to wapp.tcl.
241
242
243
244
245
246
247
248

249
250

251
252
253
254
255
256
257
241
242
243
244
245
246
247

248
249

250
251
252
253
254
255
256
257







-
+

-
+







#
proc wapp-cache-control {x} {
  wapp-reply-extra Cache-Control $x
}

# Redirect to a different web page
#
proc wapp-redirect {uri} {
proc wapp-redirect {uri {code {303 Redirect}}} {
  wapp-reset
  wapp-reply-code {303 Redirect}
  wapp-reply-code $code
  wapp-reply-extra Location $uri
}

# Return the value of a wapp parameter
#
proc wapp-param {name {dflt {}}} {
  global wapp