-
-
Notifications
You must be signed in to change notification settings - Fork 53
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
Prevent users from iterating a request's body after having responded to that request #382
Comments
Are you talking about iterating the request body in an unstructured task? |
Exactly, but explicitly after the response was already returned |
You could set the request body to have been iterated as soon as the response body has finished writing. So any subsequent attempts to iterate via an unstructured task will fail and provide a better indication as to why it failed. |
I'm going to take a look at this for you. I'm at an intermediate stage with Swift, so will enjoy helping out while improving my skills 😃 |
Hi Jon, what I mention above has been implemented but it doesn't really resolve the issue completely as the compiler stills allows you to iterate the request body in an unstructured Task. At this point in time there isn't really anything in Swift to resolve this issue but Swift 6 has a number of features that might help (~Escapable, better control of concurrency isolation) but they aren't available just now. |
Ah ok, thanks for letting me know :) I’ll keep my eye open for something else I can take a look at. |
I can't think of anything obvious at the moment. But contributions are always welcome |
Currently, we implement an HBRequest's Body with the NIOAsyncChannel's
inbound
. This is efficient, but might lead to users escaping therequest.body
for later consumption. This will lead to bugs.The text was updated successfully, but these errors were encountered: