VividCortex / siesta

Composable framework for writing HTTP handlers in Go.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Quit signal ignored for some handlers

gkristic opened this issue · comments

Context handlers receive a quit function, to be called in case a handler decides that the request cannot proceed. However, this instruction is not always honored by siesta. Handlers at the end of a composition will never be able to trigger an abort, because the quit signal won't be checked after them. See here. Given the properties of composition itself, the ignored handler can actually be anywhere in the final chain of handlers provided to siesta. It all depends on how the application decides to compose. Say:

finalChain := siesta.Compose(
    siesta.Compose(h1, h2, ..., H),
    k1, k2, ...,
)

In this setup siesta will ignore H's abort signal. Needless to say, this may result in the following steps failing (even crashing), because expected values could be missing from the context.