| 25 | } |
| 26 | |
| 27 | std::shared_ptr<std::ostream> HTTPServerResponse::send() |
| 28 | { |
| 29 | poco_assert(!stream); |
| 30 | |
| 31 | if ((request && request->getMethod() == HTTPRequest::HTTP_HEAD) || getStatus() < 200 || getStatus() == HTTPResponse::HTTP_NO_CONTENT |
| 32 | || getStatus() == HTTPResponse::HTTP_NOT_MODIFIED) |
| 33 | { |
| 34 | Poco::CountingOutputStream cs; |
| 35 | write(cs); |
| 36 | stream = std::make_shared<Poco::Net::HTTPFixedLengthOutputStream>(session, cs.chars()); |
| 37 | write(*stream); |
| 38 | } |
| 39 | else if (getChunkedTransferEncoding()) |
| 40 | { |
| 41 | Poco::Net::HTTPHeaderOutputStream hs(session); |
| 42 | write(hs); |
| 43 | stream = std::make_shared<Poco::Net::HTTPChunkedOutputStream>(session); |
| 44 | } |
| 45 | else if (hasContentLength()) |
| 46 | { |
| 47 | Poco::CountingOutputStream cs; |
| 48 | write(cs); |
| 49 | stream = std::make_shared<Poco::Net::HTTPFixedLengthOutputStream>(session, getContentLength64() + cs.chars()); |
| 50 | write(*stream); |
| 51 | } |
| 52 | else |
| 53 | { |
| 54 | stream = std::make_shared<Poco::Net::HTTPOutputStream>(session); |
| 55 | setKeepAlive(false); |
| 56 | write(*stream); |
| 57 | } |
| 58 | |
| 59 | return stream; |
| 60 | } |
| 61 | |
| 62 | std::pair<std::shared_ptr<std::ostream>, std::shared_ptr<std::ostream>> HTTPServerResponse::beginSend() |
| 63 | { |
no test coverage detected