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

Handling destroyed sockets necessary? #42

Closed
2 tasks done
Uzlopak opened this issue Jul 7, 2022 · 1 comment
Closed
2 tasks done

Handling destroyed sockets necessary? #42

Uzlopak opened this issue Jul 7, 2022 · 1 comment

Comments

@Uzlopak
Copy link
Contributor

Uzlopak commented Jul 7, 2022

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the issue has not already been raised

Issue

In the original repo of forwarded is an old issue regarding destroyed sockets.
jshttp/forwarded#12

So I think it is something like the following scenario

Browser connects to server by obviously opening a socket connection. While the request is being processed, browser disconnects and so the socket gets destroyed on server-side. Now the socketAddr is undefined.

What should be then the actual behaviour? I mean it is a very very slim chance, that exactly in that moment while the forwarded header is processed the socket gets destroyed, but in the current implementation we will end up with an undefined value as first element in the resulting array.

@mcollina
Copy link
Member

mcollina commented Jul 7, 2022

What should be then the actual behaviour? I mean it is a very very slim chance, that exactly in that moment while the forwarded header is processed the socket gets destroyed, but in the current implementation we will end up with an undefined value as first element in the resulting array.

I think there should be no chance of this happening. If there is no underlining socket, processing the request should be aborted immediately. I would rather add some protection in Fastify for this use case.

@Uzlopak Uzlopak closed this as completed Jul 10, 2022
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

2 participants