-
Notifications
You must be signed in to change notification settings - Fork 79
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
add ability to abort the response #155
Conversation
pavelsavara
commented
Feb 27, 2025
- refactor ResponseOptions parameters
- add ability to abort the response
- add ability to abort the response
Is the intent of this to simulate longer running requests or requests that are only partially successful (ie - aborted)? Also, isn't having an aborted request going to be a false representation of the status code that is being returned, like, using the abort during body pipeline would result in (potentially) invalid JSON being returned on a 200 OK response, which kind of suggests that it wasn't really OK after all. My other concern is around adding more sleeps as that can reduce the concurrent requests that can be processed. I've seen malicious traffic spikes in the past in which the max sleep is set which does mean that the server has a lot of awaited threads and becomes really slow. |
I'm just scratching my itch locally with this change and wanted contribute back. I don't mind if this is not merged :)
I'm testing edge-cases of browser behavior in case of server abort/disconnect.
Yes, the simulated scenario is server wanted to return OK 200, but something went wrong (like mobile network disconnect or Ethernet cable unplugged). In such cases the raw partial payload on the wire starts with 200 header, but doesn't finish.
Hmm, there is already one such sleep and that's enough for such DDOS. My PR doesn't really change the situation. I put few sleeps with constant 10ms, to make sure the bytes are on the wire before I abort.
Done ^^ Further improvement could be some DDOS protection based on source IP address. I not willing to work on that. |
Now I see there is |
- implement body dribbling
I think I also implemented body dribbling - responding with first 20 characters on separate packets. |
Unfortunately the rate limiter isn't enabled as I turned it on and it broke everything and I can't find enough docs on how to make it actually work 🤣 |
On a second read through, I think you're right that it's not really adding any additional sleep overheads. So I'd prefer to leave the max sleep where it was for prod as that has been the expected for a few years now so I wouldn't want a regression/major change like that. |
Reverted |