moonbridge

diff reference.txt @ 50:0dd15d642124

Proper handling of I/O errors; Added property "request.faulty"; Removed "io_error_handler" hook; Added documentation for global function "timeout"
author jbe
date Fri Mar 20 02:27:28 2015 +0100 (2015-03-20)
parents e835cda61478
children 042bb4854aa6
line diff
     1.1 --- a/reference.txt	Thu Mar 19 22:49:28 2015 +0100
     1.2 +++ b/reference.txt	Fri Mar 20 02:27:28 2015 +0100
     1.3 @@ -21,6 +21,26 @@
     1.4  
     1.5  
     1.6  
     1.7 +Global function timeout(...)
     1.8 +----------------------------
     1.9 +
    1.10 +Calling this function with a positive number (time in seconds) sets a timer
    1.11 +that kills the current process after the selected time runs out. The remaining
    1.12 +time can be queried by calling this function without arguments.
    1.13 +
    1.14 +Calling this function with a single argument that is the number zero will
    1.15 +disable the timeout.
    1.16 +
    1.17 +Another mode of operation is selected by passing two arguments: a time (in
    1.18 +seconds) as first argument and a function as second argument. In this case, a
    1.19 +sub-timer will be used to limit the execution time of the function. In case of
    1.20 +timeout, the process will be killed (and the timeout function does not return).
    1.21 +If the time for the sub-timer is longer than a previously set timeout (using
    1.22 +the timeout(...) function with one argument), the shorter timeout (of the
    1.23 +previous call of timeout(...)) will have precedence.
    1.24 +
    1.25 +
    1.26 +
    1.27  Socket object passed to "connect" handler
    1.28  -----------------------------------------
    1.29  
    1.30 @@ -163,8 +183,6 @@
    1.31    ignored when request:flush() is called)
    1.32  - static_headers: a set of headers to be included in every HTTP response
    1.33    (may be a string, a table or strings, or a table of key-value pairs)
    1.34 -- io_error_handler: a function to be called when an I/O operation with the
    1.35 -  client fails (must not return or an error will be raised automatically)
    1.36  
    1.37  The callback function receives a single request object as argument, which is
    1.38  described below.
    1.39 @@ -200,6 +218,14 @@
    1.40  are desired.
    1.41  
    1.42  
    1.43 +### request.faulty
    1.44 +
    1.45 +Normally set to false. In case of a read or write error on the client
    1.46 +connection, this value is set to true before a Lua error is raised.
    1.47 +
    1.48 +A faulty request handle must not be used, or another Lua error will be raised.
    1.49 +
    1.50 +
    1.51  ### request:finish()
    1.52  
    1.53  Finishes and flushes a HTTP response. May be called multiple times. An

Impressum / About Us