untangle overly complex control flow logic
commitbbbbfb3de0db3a09cd3fb91f5287fc004c337a37
authorGlenn Strauss <gstrauss@gluelogic.com>
Thu, 7 Apr 2016 00:46:43 +0000 (6 20:46 -0400)
committerGlenn Strauss <gstrauss@gluelogic.com>
Mon, 18 Apr 2016 10:19:03 +0000 (18 06:19 -0400)
tree635a3a1c40d0b5da7e6455d6b9be293e20632fca
parent77bd45121cd50ca317b3daed5b5b1a567a79b315
untangle overly complex control flow logic

for dynamic handlers mod_cgi, mod_fastcgi, mod_scgi, mod_proxy
(mod_cgi control flow logic simplification began in a prior commit)

- connection state machine calls the subrequest handler
- subrequest handler sets up the connection to the backend
  and registers fdevent handler to handle backend events
- fdevent handler handles backend events and then schedules
  a call to connection state machine
- when retrying an alternate backend, backend state is reset
  and then response state is reset so that the connection state
  machine will call back into the subrequest handler to retry

Dynamic handlers no longer directly modify connection state
(calls to connection_set_state() from dynamic handlers were removed)

Dynamic handlers no longer reset con->physical.path, and they
preserve con->mode when retrying alternate backends.  This is done
to skip repeated processing in response.c:http_response_prepare()

While this patch increases consistency in control flow handling,
there is more work to be done that can further improve upon this.

x-ref:
  "handle-req time too long"
  https://redmine.lighttpd.net/issues/1149
src/mod_cgi.c
src/mod_fastcgi.c
src/mod_proxy.c
src/mod_scgi.c