Wapp

Check-in [a8fb6ca1fd]
Login

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

Overview
Comment:Enhance the wapp-reply-code command so that if given the argument of just "ABORT" Wapp will drop the TCP/IP connection without sending any reply at all.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a8fb6ca1fd45062d8f7137f491ed5199f43a32121f54e099b387310fb81479e7
User & Date: drh 2021-09-20 12:10:40.526
Context
2021-11-26
12:23
Require that all POST parameters have lower-case alphanumeric names. Ignore any POST parameter that have upper-case letters or special characters in their names. See forum post 5220ee9ac0. (check-in: 27c4c3a75e user: drh tags: trunk)
2021-09-20
12:10
Enhance the wapp-reply-code command so that if given the argument of just "ABORT" Wapp will drop the TCP/IP connection without sending any reply at all. (check-in: a8fb6ca1fd user: drh tags: trunk)
12:10
Update the documentation to describe the new capabilities of wapp-reply-code. (Leaf check-in: f4a169b8db user: drh tags: abort-request)
2021-06-18
13:33
Further rebustness in the %qp and %url substitutions. This is a correction to the previous check-in. (check-in: d776a1b60b user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to docs/commands.md.
88
89
90
91
92
93
94



95
96
97
98
99
100
101
     parameters to be decoded.

  +  **wapp-mimetype** _MIMETYPE_  
     Set the MIME-type for the generated web page.  The default is "text/html".

  +  **wapp-reply-code** _CODE_  
     Set the reply-code for the HTTP request.  The default is "200 Ok".




  +  **wapp-redirect** _TARGET-URL_  
     Cause an HTTP redirect to _TARGET-URL_.

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








>
>
>







88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
     parameters to be decoded.

  +  **wapp-mimetype** _MIMETYPE_  
     Set the MIME-type for the generated web page.  The default is "text/html".

  +  **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-reset**  
     Reset the web page under construction back to an empty string.

Changes to wapp.tcl.
738
739
740
741
742
743
744






745
746
747
748
749
750
751
752
753
754
755
    }
    dict unset wapp .new-cookies
  }
  wapp-before-reply-hook

  # Transmit the HTTP reply
  #






  if {$chan=="stdout"} {
    puts $chan "Status: [dict get $wapp .reply-code]\r"
  } else {
    puts $chan "HTTP/1.1 [dict get $wapp .reply-code]\r"
    puts $chan "Server: wapp\r"
    puts $chan "Connection: close\r"
  }
  if {[dict exists $wapp .reply-extra]} {
    foreach {name value} [dict get $wapp .reply-extra] {
      puts $chan "$name: $value\r"
    }







>
>
>
>
>
>
|
|

|







738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
    }
    dict unset wapp .new-cookies
  }
  wapp-before-reply-hook

  # Transmit the HTTP reply
  #
  set rc [dict get $wapp .reply-code]
  if {$rc=="ABORT"} {
    # If the page handler invokes "wapp-reply-code ABORT" then close the
    # TCP/IP connection without sending any reply
    wappInt-close-channel $chan
    return
  } elseif {$chan=="stdout"} {
    puts $chan "Status: $rc\r"
  } else {
    puts $chan "HTTP/1.1 $rc\r"
    puts $chan "Server: wapp\r"
    puts $chan "Connection: close\r"
  }
  if {[dict exists $wapp .reply-extra]} {
    foreach {name value} [dict get $wapp .reply-extra] {
      puts $chan "$name: $value\r"
    }