Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugin handlers are broken #129

Open
Tieske opened this issue Feb 19, 2023 · 0 comments
Open

plugin handlers are broken #129

Tieske opened this issue Feb 19, 2023 · 0 comments

Comments

@Tieske
Copy link
Contributor

Tieske commented Feb 19, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant