diff --git a/src/Server/HTTP/HTTPServerResponse.cpp b/src/Server/HTTP/HTTPServerResponse.cpp index 0bfaa04ad54..4471c3a705a 100644 --- a/src/Server/HTTP/HTTPServerResponse.cpp +++ b/src/Server/HTTP/HTTPServerResponse.cpp @@ -37,7 +37,7 @@ std::shared_ptr HTTPServerResponse::send() // Send header Poco::Net::HTTPHeaderOutputStream hs(session); write(hs); - // Don't create stream - it's a header-only response + stream = std::make_shared(session.socket(), write_metric); } else if (getChunkedTransferEncoding()) { diff --git a/src/Server/HTTPHandler.cpp b/src/Server/HTTPHandler.cpp index 067b94ddfd6..d9556e66bdc 100644 --- a/src/Server/HTTPHandler.cpp +++ b/src/Server/HTTPHandler.cpp @@ -913,7 +913,7 @@ try { /// In case data has already been sent, like progress headers, try using the output buffer to /// set the exception code since it will be able to append it if it hasn't finished writing headers - if (response.sent() && used_output.out) + if (response.sent() && used_output.out_holder) used_output.out_holder->setExceptionCode(exception_code); else response.set("X-ClickHouse-Exception-Code", toString(exception_code));