This repository has been archived by the owner on Dec 18, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 526
When HttpResponse.Body is replaced, the replacement is used for future requests #940
Comments
Nice catch. These lines should be moved outside the if condition so the streams get reset between every request. |
@halter73 good follow though; couldn't find what situation |
Eeek 😄 |
@jodavis As a workaround until we get a new release out, you can store the original |
cesarblum
pushed a commit
that referenced
this issue
Jul 6, 2016
cesarblum
pushed a commit
that referenced
this issue
Jul 6, 2016
xabikos
added a commit
to xabikos/aspnet-webpack
that referenced
this issue
Jul 24, 2016
… add a workaround for correctly replacing the response because of a bug in kestrel aspnet/KestrelHttpServer#940
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
This is a contrived example to illustrate the point:
Run the application and browse to it. The first request returns nothing (content was written to the MemoryStream). Subsequent requests will hit the Exception.
The real-world case is when the Body stream is decorated for a given request. The decorator stream will be re-used for a subsequent request, which could result in re-decorating the stream, and ultimately produce a long chain of decorators.
It appears that Kestrel is trying to be efficient by re-using its underlying Stream instances. But the reusable instances are being replaced, with unintended consequences for future requests.
The text was updated successfully, but these errors were encountered: