Wapp

Changes On Branch abort-request
Login

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

Changes In Branch abort-request Excluding Merge-Ins

This is equivalent to a diff from d776a1b60b to f4a169b8db

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-09-15
12:04
In this branch is a proposed patch whereby if the page handler calls "wapp-reply-code ABORT" then the request is cancelled and the TCP/IP connection is closed without sending any reply at all. (check-in: a757b342da 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)
13:09
Fix a problem with backslashes in the %qp() and %url() encoders. See https://sqlite.org/forum/forumpost/8fb639b5ad for the original report. (check-in: edd8b4f267 user: drh tags: trunk)

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"
    }