diff --git a/examples/SpdyServer.cc b/examples/SpdyServer.cc index fe113b42..269e64c8 100644 --- a/examples/SpdyServer.cc +++ b/examples/SpdyServer.cc @@ -37,6 +37,7 @@ #include #include +#include #include "spdylay_ssl.h" #include "uri.h" @@ -435,14 +436,18 @@ void prepare_status_response(Request *req, SpdyEventHandler *hd, << "" << ""; std::string body = ss.str(); - write(pipefd[1], body.c_str(), body.size()); + gzFile write_fd = gzdopen(pipefd[1], "w"); + gzwrite(write_fd, body.c_str(), body.size()); + gzclose(write_fd); close(pipefd[1]); req->file = pipefd[0]; spdylay_data_provider data_prd; data_prd.source.fd = pipefd[0]; data_prd.read_callback = file_read_callback; - hd->submit_file_response(status, req->stream_id, 0, body.size(), &data_prd); + std::vector > headers; + headers.push_back(std::make_pair("content-encoding", "gzip")); + hd->submit_response(status, req->stream_id, headers, &data_prd); } } } // namespace