Skip to content

plugin handlers are broken #129

@Tieske

Description

@Tieske

the handler file has a lot of plugin handlers, but a number of them are never invoked. Also some are quite obscure (eg the metatable one).

However there seems no way to fix this without some serious breaking changes. Hence I think it makes sense to redesign the handlers all together.

Here's a stab at an updated set of handlers;

  • newConnection; when a new client tcp socket is created, before reading any data (eg TLS handshake goes here)
  • beforeHeaderRead; after the request line has been read (1st line) before headers have been read
  • afterHeaderRead; after the request headers have been read
  • requestBody; for each chunk of data read from the request body (can repeat, called once with nil if body is empty). Handlers can cache chunks to prevent further processing by next handler. After last chunk, will be called once more with nil to indicate done.
  • requestComplete; after full request has been read
  • beforeHeaderSend; before the status line and response headers are being send
  • afterHeaderSend; after the headers have been sent, but before the body is being processed (also called if there is no body)
  • responseBody; for each chunk of data to be sent in the response body (can repeat, called once with nil if body is empty). Handlers can cache chunks to prevent further processing by next handler. After last chunk, will be called once more with nil to indicate done.
  • responseComplete; after each request is finished

The list doesn't have file send handlers, since imho the file send logic itself should actually be a plugin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions