Skip to content

Add callback handler to report internal HTTP parsing errors(431, 400, 505)#1191

Open
pdeltour-syna wants to merge 3 commits intouNetworking:masterfrom
pdeltour-syna:master
Open

Add callback handler to report internal HTTP parsing errors(431, 400, 505)#1191
pdeltour-syna wants to merge 3 commits intouNetworking:masterfrom
pdeltour-syna:master

Conversation

@pdeltour-syna
Copy link
Copy Markdown

In order to track all requests in a node.js project, I also want to keep track incoming requests that produce an internal http parsing error (mainly 431 Request Header Fields Too Large). As internal parsing errors result in response being written to the socket and closing the socket, there is no notion of these requests in the application.

By adding a callback handler, the application can be informed of requests that produced an internal error, allowing for an application to keep track of these requests and keep metrics on that.

@uNetworkingAB
Copy link
Copy Markdown
Contributor

The problem is real, most solve it by having metrics in Cloudflare or some proxy, but yes it is a problem. However, a more generic logging callback that can be used for everything, not just HTTP would be better and has been discussed before.

Probably something based on strings - strings are generic and in C/C++ you can compare them in constant time if you know the pointers, we already have this interface for WebSocket close reasons strings

So the interface could probably be as simple as log((some reference, some string) => {

})

the problem is that once you introduce such a callback, you need to review all the places it emits and test all possible actions one could take in that callback

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

Successfully merging this pull request may close these issues.

2 participants