Unverified Commit 3fa95beb authored by Kenton Varda's avatar Kenton Varda Committed by GitHub

Merge pull request #670 from capnproto/HttpChunkedEntityWriter-destructor-nothrow

Don't throw from ~HttpChunkedEntityWriter after write cancellation.
parents eebec489 443ac893
......@@ -1610,6 +1610,10 @@ public:
return !inBody && !broken && !writeInProgress;
}
bool canWriteBodyData() {
return !writeInProgress && inBody;
}
void writeHeaders(String content) {
// Writes some header content and begins a new entity body.
......@@ -1833,8 +1837,12 @@ public:
HttpChunkedEntityWriter(HttpOutputStream& inner)
: inner(inner) {}
~HttpChunkedEntityWriter() noexcept(false) {
inner.writeBodyData(kj::str("0\r\n\r\n"));
inner.finishBody();
if (inner.canWriteBodyData()) {
inner.writeBodyData(kj::str("0\r\n\r\n"));
inner.finishBody();
} else {
inner.abortBody();
}
}
Promise<void> write(const void* buffer, size_t size) override {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment