diff options
Diffstat (limited to 'doc/state.txt')
-rw-r--r-- | doc/state.txt | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/doc/state.txt b/doc/state.txt index d0768bc..5e8277b 100644 --- a/doc/state.txt +++ b/doc/state.txt @@ -14,10 +14,10 @@ Module: core This is a short summary of the state-engine which is driving the lighttpd webserver. It describes the basic concepts and the way the different parts of the server are connected. - + .. meta:: :keywords: lighttpd, state-engine - + .. contents:: Table of Contents Description @@ -52,72 +52,72 @@ and some may never be hit at all. reset connection (incl. close()) :close: close connection (handle lingering close) - + .. image:: state.png - + A simple GET request (green path) --------------------------------- - + The connection is idling in the 'connect' state waiting for a connection. As soon as the connection is set up we init the read-timer in 'reqstart' and start to read data from the network. As soon as we get the HTTP-request terminator (CRLFCRLF) we forward the header to the parser. - + The parsed request is handled by 'handlereq' and as soon as a decision out the request is made it is sent to 'respstart' to prepare the HTTP-response header. In the 'write' state the prepare content is sent out to the network. When everything is sent 'respend' is entered to log the -request and cleanup the environment. After the close() call the connection +request and cleanup the environment. After the close() call the connection is set back to the 'connect' state again. - + Keep-Alive (blue path) ---------------------- - + The Keep-Alive handling is implemented by going from the 'respend' directly to 'reqstart' without the close() and the accept() calls. - + POST requests (grey path) ------------------------- - + As requests might contain a request-body the state 'readpost' entered as soon as the header is parsed and we know how much data we expect. - + Pipelining ---------- - + HTTP/1.1 supportes pipelining (sending multiple requests without waiting for the response of the first request). This is handled transparently by the 'read' state. - + Unexpected errors (red path) ---------------------------- - + For really hard errors we use the 'error' state which resets the connection and can be call from every state. It is only use if there is no other way to handle the issue (e.g. client-side close of the connection). If possible we should use http-status 500 ('internal server error') and log the issue in the errorlog. - + If we have to take care of some data which is coming in after we ran into the error condition the 'close' state is used the init a half-close and read all the delay packet from the network. - + Sub-Requests (lightblue) ------------------------ - + The FastCGI, CGI, ... intergration is done by introducing a loop in 'handlereq' to handle all aspect which are neccesary to find out what has to be sent back to the client. - + Functions ========= Important functions used by the state-engine - + :state-engine: - ``connection_state_machine()`` - + :connect: - (nothing) |