You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by sh...@apache.org on 2020/06/10 21:18:28 UTC
[trafficserver] branch master updated: Return null when do_io_write
called on closed stream (#6826)
This is an automated email from the ASF dual-hosted git repository.
shinrich pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new af9c4f3 Return null when do_io_write called on closed stream (#6826)
af9c4f3 is described below
commit af9c4f39aeb40515bb42469cb0aeeb0ac27fec54
Author: Susan Hinrichs <sh...@yahoo-inc.com>
AuthorDate: Wed Jun 10 16:18:12 2020 -0500
Return null when do_io_write called on closed stream (#6826)
Co-authored-by: Susan Hinrichs <sh...@verizonmedia.com>
---
proxy/http/HttpTunnel.cc | 3 +++
proxy/http2/Http2Stream.cc | 8 ++++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/proxy/http/HttpTunnel.cc b/proxy/http/HttpTunnel.cc
index 4fbac85..1bfc10b 100644
--- a/proxy/http/HttpTunnel.cc
+++ b/proxy/http/HttpTunnel.cc
@@ -956,6 +956,9 @@ HttpTunnel::producer_run(HttpTunnelProducer *p)
// Start the writes now that we know we will consume all the initial data
c->write_vio = c->vc->do_io_write(this, c_write, c->buffer_reader);
ink_assert(c_write > 0);
+ if (c->write_vio == nullptr) {
+ consumer_handler(VC_EVENT_ERROR, c);
+ }
}
}
if (p->alive) {
diff --git a/proxy/http2/Http2Stream.cc b/proxy/http2/Http2Stream.cc
index 5a71250..ebafb25 100644
--- a/proxy/http2/Http2Stream.cc
+++ b/proxy/http2/Http2Stream.cc
@@ -333,8 +333,12 @@ Http2Stream::do_io_write(Continuation *c, int64_t nbytes, IOBufferReader *abuffe
write_vio.op = VIO::WRITE;
response_reader = abuffer;
- update_write_request(abuffer, nbytes, false);
-
+ if (c != nullptr && nbytes > 0 && this->is_client_state_writeable()) {
+ update_write_request(abuffer, nbytes, false);
+ } else if (!this->is_client_state_writeable()) {
+ // Cannot start a write on a closed stream
+ return nullptr;
+ }
return &write_vio;
}