Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add a "package provide" to the main script. Further documentation updates. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
97b3ea17167fddb7e8ee230331a19c2c |
User & Date: | drh 2017-12-13 15:25:24.387 |
Context
2017-12-13
| ||
17:28 | Typo fix in the README.md (check-in: 0d5698a0e2 user: drh tags: trunk) | |
15:25 | Add a "package provide" to the main script. Further documentation updates. (check-in: 97b3ea1716 user: drh tags: trunk) | |
15:09 | SCGI processing now working on Nginx. (check-in: 788f9d0118 user: drh tags: trunk) | |
Changes
Changes to README.md.
1 2 3 4 5 6 | Wapp - A Web-Application Framework for TCL ========================================== 1.0 Introduction ---------------- | | | < < < | | | 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 | Wapp - A Web-Application Framework for TCL ========================================== 1.0 Introduction ---------------- Wapp is a lightweight framework that simplifies the construction of web application written in TCL. The same Wapp-based application can be launched in multiple ways: 1. From the command-line, without automatic web-browser startup 2. As a stand-alone web server 3. As a CGI script 4. As an SCGI program All four methods use the exact same application code and present the same interface to the application user. An application can be developed on the desktop using stand-alone mode (1), then deployed as a stand-alone server (2), or a CGI script (3), or as an SCGI program (4). 2.0 Hello World! ---------------- Wapp is designed to be easy to use. A hello-world program is as follows: > package require wapp ;# OR source wapp.tcl proc wapp-default {req} { wapp "<h1>Hello, World!</h1>\n" } wapp-start $::argv The application defines one or more procedures that accept HTTP requests and generate appropriate replies. |
︙ | ︙ | |||
115 116 117 118 119 120 121 | the same as "wapp" (it appends its argument text to the web page under construction) except that the argument to "wapp-unsafe" is allowed to contain TCL variable and command expansions. The "wapp" command will generate a warning if its argument contains TCL variable or command expansions, as a defense against accidental XSS vulnerabilities. The /env page is implemented by the "wapp-page-env" proc. This proc | | | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | the same as "wapp" (it appends its argument text to the web page under construction) except that the argument to "wapp-unsafe" is allowed to contain TCL variable and command expansions. The "wapp" command will generate a warning if its argument contains TCL variable or command expansions, as a defense against accidental XSS vulnerabilities. The /env page is implemented by the "wapp-page-env" proc. This proc generates HTML that describes the content of the ::wapp dict. Keys that begin with "." are for internal use by Wapp and are skipped for this display. The "wapp-escape-html" command is like "wapp" and "wapp-unsafe" except that "wapp-escape-html" escapes HTML markup so that it displays correctly in the output. 4.0 The ::wapp Global Dict -------------------------- |
︙ | ︙ | |||
284 285 286 287 288 289 290 291 292 293 294 295 296 297 | Cause an HTTP redirect to the specified URL. + **wapp-reset** Reset the web page under construction back to an empty string. + **wapp-set-cookie** \[-path _PATH_\] \[-expires _DAYS_\] _NAME_ _VALUE_ Cause the cookie _NAME_ to be set to _VALUE_. + **wapp-send-hex** _HEX_ Cause the HTTP reply to be binary that is constructed from the hexadecimal text in the _HEX_ argument. Whitespace in _HEX_ is ignored. This command is useful for returning small images from a pure script input. The "wapp-file-to-hex" command can be used at development time to generate appropriate _HEX_ for an image file. | > > > > > > > | 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | Cause an HTTP redirect to the specified URL. + **wapp-reset** Reset the web page under construction back to an empty string. + **wapp-set-cookie** \[-path _PATH_\] \[-expires _DAYS_\] _NAME_ _VALUE_ Cause the cookie _NAME_ to be set to _VALUE_. * **wapp-safety-check** Examine all TCL procedures in the application and report errors about unsafe usage of "wapp". The following additional interfaces are envisioned, but are not yet implemented: + **wapp-send-hex** _HEX_ Cause the HTTP reply to be binary that is constructed from the hexadecimal text in the _HEX_ argument. Whitespace in _HEX_ is ignored. This command is useful for returning small images from a pure script input. The "wapp-file-to-hex" command can be used at development time to generate appropriate _HEX_ for an image file. |
︙ | ︙ | |||
320 321 322 323 324 325 326 | For debugging use only: open a listening TCP socket on _PORT_ and run an interactive TCL shell on connections to that port. This allows for interactive debugging of a running instance of the Wapp server. This command is a no-op for short-lived CGI programs, obviously. Also, this command should only be used during debugging, as otherwise it introduces a severe security vulnerability into the application. | < < < < | 324 325 326 327 328 329 330 331 332 333 334 335 336 | For debugging use only: open a listening TCP socket on _PORT_ and run an interactive TCL shell on connections to that port. This allows for interactive debugging of a running instance of the Wapp server. This command is a no-op for short-lived CGI programs, obviously. Also, this command should only be used during debugging, as otherwise it introduces a severe security vulnerability into the application. 6.0 Design Rules ---------------- All global procs and variables used by Wapp begin with the four character prefix "wapp". Procs and variable intended for internal use begin with the seven character prefix "wappInt". |
Changes to wapp.tcl.
︙ | ︙ | |||
593 594 595 596 597 598 599 | if {[dict get $W .toread]<=0} { # Handle the request as soon as all the query content is received set wapp $W wappInt-handle-request $chan 0 } } } | > > > | 593 594 595 596 597 598 599 600 601 602 | if {[dict get $W .toread]<=0} { # Handle the request as soon as all the query content is received set wapp $W wappInt-handle-request $chan 0 } } } # Call this version 1.0 package provide wapp 1.0 |