Prevent "add" after "close" on stream, 2.0.0-rc.1
This commit is contained in:
parent
d210456d44
commit
13538b5ddb
3 changed files with 38 additions and 31 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
# 2.0.0-rc.1
|
||||||
|
* Fix logic error that allowed content to be written to streaming responses after `close` was closed.
|
||||||
|
|
||||||
# 2.0.0-rc.0
|
# 2.0.0-rc.0
|
||||||
* Log a warning when no `reflector` is provided.
|
* Log a warning when no `reflector` is provided.
|
||||||
* Add `AngelEnvironment` class.
|
* Add `AngelEnvironment` class.
|
||||||
|
|
|
@ -159,6 +159,7 @@ class HttpResponseContext extends ResponseContext<HttpResponse> {
|
||||||
if (_isClosed && isBuffered)
|
if (_isClosed && isBuffered)
|
||||||
throw ResponseContext.closed();
|
throw ResponseContext.closed();
|
||||||
else if (!isBuffered) {
|
else if (!isBuffered) {
|
||||||
|
if (!_isClosed) {
|
||||||
_openStream();
|
_openStream();
|
||||||
|
|
||||||
if (encoders.isNotEmpty && correspondingRequest != null) {
|
if (encoders.isNotEmpty && correspondingRequest != null) {
|
||||||
|
@ -182,6 +183,7 @@ class HttpResponseContext extends ResponseContext<HttpResponse> {
|
||||||
}
|
}
|
||||||
|
|
||||||
rawResponse.add(data);
|
rawResponse.add(data);
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
buffer.add(data);
|
buffer.add(data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,6 +166,7 @@ class Http2ResponseContext extends ResponseContext<ServerTransportStream> {
|
||||||
else if (!isBuffered) {
|
else if (!isBuffered) {
|
||||||
_openStream();
|
_openStream();
|
||||||
|
|
||||||
|
if (!_isClosed) {
|
||||||
if (encoders.isNotEmpty && correspondingRequest != null) {
|
if (encoders.isNotEmpty && correspondingRequest != null) {
|
||||||
if (_allowedEncodings != null) {
|
if (_allowedEncodings != null) {
|
||||||
for (var encodingName in _allowedEncodings) {
|
for (var encodingName in _allowedEncodings) {
|
||||||
|
@ -187,6 +188,7 @@ class Http2ResponseContext extends ResponseContext<ServerTransportStream> {
|
||||||
}
|
}
|
||||||
|
|
||||||
stream.sendData(data);
|
stream.sendData(data);
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
buffer.add(data);
|
buffer.add(data);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue