void onContent(const x0::BufferRef& chunk) { if (chunk.empty()) { if (created_) request_->status = x0::HttpStatus::Created; else request_->status = x0::HttpStatus::NoContent; request_->finish(); ::close(fd_); delete this; } else { ::write(fd_, chunk.data(), chunk.size()); // check return code and possibly early abort request with error code indicating diagnostics } }