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

Return (potentially) partial buffers on error. #51

Merged
merged 1 commit into from
Nov 8, 2024

Conversation

mfycheng
Copy link
Contributor

@mfycheng mfycheng commented Nov 6, 2024

In some cases, servers will response with an error, and then immediately close the connection. In those cases, we can still recover some information to be parsed for better error handling downstream.

One notable example is rate limiting. The current behaviour makes it appear to be a connection issue (connection reset by peer). However, if we inspect the buffer, we notice a rate limiting message. If we in turn pass this to the whoisparser, we can treat it like other generic rate limiting errors, and act accordingly.

In some cases, servers will response with an error, and then immediately
close the connection. In those cases, we can still recover some
information to be parsed for better error handling downstream.

One notable example is rate limiting. The current behaviour makes it
appear to be a connection issue (connection reset by peer). However, if
we inspect the buffer, we notice a rate limiting message. If we in turn
pass this to the whoisparser, we can treat it like other generic rate
limiting errors, and act accordingly.
@mfycheng
Copy link
Contributor Author

mfycheng commented Nov 6, 2024

An alternative solution:

  1. Attempt to detect rate limit errors inline, and return a whois.ErrDomainLimitExceeded.
  2. Fall back with injecting the error response in to the err being returned.

It felt like it overlaps a bit with the whoisparser library, which also does a form of rate limit detection.

@likexian likexian merged commit 51c35de into likexian:master Nov 8, 2024
5 checks passed
@likexian
Copy link
Owner

likexian commented Nov 8, 2024

Hello @mfycheng
Thanks for your works.


If you think this repository is helpful, please share it with friends, thanks.

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