Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | CGI mode is now working. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
d637e1ba1d66e97767a617a97c0774e7 |
User & Date: | drh 2017-12-13 12:30:09.874 |
Context
2017-12-13
| ||
12:32 | Add the CGI test script and fix auto-detection of CGI. (check-in: 820bdf0f00 user: drh tags: trunk) | |
12:30 | CGI mode is now working. (check-in: d637e1ba1d user: drh tags: trunk) | |
12:10 | Refactor for CGI support. The CGI support is still untested. (check-in: 9697edc9ed user: drh tags: trunk) | |
Changes
Changes to test01.tcl.
1 2 3 4 5 6 7 8 9 | # Invoke as "tclsh test01.tcl" and then surf the website that pops up # to verify the logic in wapp. # source wapp.tcl proc wapp-default {} { global wapp set B [dict get $wapp BASE_URL] wapp "<h1>Hello, World!</h1>\n" wapp "<ol>" | > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # Invoke as "tclsh test01.tcl" and then surf the website that pops up # to verify the logic in wapp. # source wapp.tcl proc wapp-default {} { global wapp set B [dict get $wapp BASE_URL] set R [dict get $wapp SCRIPT_NAME] wapp "<h1>Hello, World!</h1>\n" wapp "<ol>" wapp-unsafe "<li><p><a href='$R/env'>Wapp Environment</a></p>\n" wapp-unsafe "<li><p><a href='$B/fullenv'>Full Environment</a>\n" wapp-unsafe "<li><p><a href='$B/lint'>Lint</a>\n" wapp-unsafe "<li><p><a href='$B/errorout'>Deliberate error</a>\n" wapp "</ol>" } proc wapp-page-env {} { global wapp |
︙ | ︙ |
Changes to wapp.tcl.
︙ | ︙ | |||
126 127 128 129 130 131 132 | } } if {($mode=="auto" && [info exists env(GATEWAY_INTERFACE)] && $env(GATEWAY_INTERFACE)=="CGI/1.0") || $mode=="cgi" } { | | | | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | } } if {($mode=="auto" && [info exists env(GATEWAY_INTERFACE)] && $env(GATEWAY_INTERFACE)=="CGI/1.0") || $mode=="cgi" } { wappInt-handle-cgi-request return } if {$mode=="server"} { wappInt-start-listener $port 0 0 } else { wappInt-start-listener $port 1 1 } vwait ::forever |
︙ | ︙ | |||
323 324 325 326 327 328 329 330 331 332 333 334 335 336 | } if {![dict exists $wapp HTTP_HOST]} { dict set wapp BASE_URL {} } elseif {[dict exists $wapp HTTPS]} { dict set wapp BASE_URL https://[dict get $wapp HTTP_HOST] } else { dict set wapp BASE_URL http://[dict get $wapp HTTP_HOST] } dict set wapp SELF_URL [dict get $wapp BASE_URL]/[dict get $wapp PATH_HEAD] # Parse query parameters from the query string, the cookies, and # POST data # if {[dict exists $wapp HTTP_COOKIE]} { | > > > > > | 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 | } if {![dict exists $wapp HTTP_HOST]} { dict set wapp BASE_URL {} } elseif {[dict exists $wapp HTTPS]} { dict set wapp BASE_URL https://[dict get $wapp HTTP_HOST] } else { dict set wapp BASE_URL http://[dict get $wapp HTTP_HOST] } if {[dict exists $wapp SCRIPT_NAME]} { dict append wapp BASE_URL [dict get $wapp SCRIPT_NAME] } else { dict set wapp SCRIPT_NAME {} } dict set wapp SELF_URL [dict get $wapp BASE_URL]/[dict get $wapp PATH_HEAD] # Parse query parameters from the query string, the cookies, and # POST data # if {[dict exists $wapp HTTP_COOKIE]} { |
︙ | ︙ | |||
474 475 476 477 478 479 480 | regsub -all -- {[][{})\\]\)} $str {\\&} str return [subst -nocommand $str] } # Process a single CGI request # proc wappInt-handle-cgi-request {} { | | | 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 | regsub -all -- {[][{})\\]\)} $str {\\&} str return [subst -nocommand $str] } # Process a single CGI request # proc wappInt-handle-cgi-request {} { global wapp env foreach key { CONTENT_LENGTH CONTENT_TYPE HTTP_COOKIE HTTP_HOST HTTP_REFERER HTTP_USER_AGENT |
︙ | ︙ |