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

Reject overflowing connection with status code 429 #456

Merged
merged 5 commits into from
Sep 14, 2021

Conversation

maciejhirsz
Copy link
Contributor

Addresses #398.

Needs an extra PR in soketto to add the Retry-After header, although I think this might be a case of perfect is the enemy of good here.

ws-server/src/server.rs Outdated Show resolved Hide resolved
server.send_response(&reject).await?;

return Err(error);
Ok(())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does Ok(()) vs Err(error) imply here?

I suppose we don't have any error for it in Incoming and return Ok(()) is probably fine because it's already logged once the connection limit is exceeded when Handshake::Reject is detected.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, returning 429 rejection isn't an error here, it's expected behavior (but we can still get an io error when sending the response for whatever reason).

Copy link
Member

@niklasad1 niklasad1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, a couple of questions :)

ws-server/src/server.rs Outdated Show resolved Hide resolved
ws-server/src/server.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@dvdplm dvdplm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, modulo possibly the name, up to you @maciejhirsz.

@maciejhirsz maciejhirsz merged commit bf2fff0 into master Sep 14, 2021
@maciejhirsz maciejhirsz deleted the mh-reject-with-429 branch September 14, 2021 06:45
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.

3 participants